Skip to content
Snippets Groups Projects
Commit a6b7b99a authored by Laurent Destailleur's avatar Laurent Destailleur
Browse files

Qual: Utilise methode add de classe ActionComm pour insérer actions an base...

Qual: Utilise methode add de classe ActionComm pour insérer actions an base plutot que l'insert spécifique.
parent 0db9887e
No related branches found
No related tags found
No related merge requests found
...@@ -51,8 +51,6 @@ if ($conf->commande->enabled) require_once "../commande/commande.class.php"; ...@@ -51,8 +51,6 @@ if ($conf->commande->enabled) require_once "../commande/commande.class.php";
require_once DOL_DOCUMENT_ROOT."/lib/CMailFile.class.php"; require_once DOL_DOCUMENT_ROOT."/lib/CMailFile.class.php";
if ($_GET["socidp"]) { $socidp=$_GET["socidp"]; } if ($_GET["socidp"]) { $socidp=$_GET["socidp"]; }
if (isset($_GET["msg"])) { $msg=urldecode($_GET["msg"]); } if (isset($_GET["msg"])) { $msg=urldecode($_GET["msg"]); }
...@@ -411,25 +409,34 @@ if ($_POST["action"] == 'send' || $_POST["action"] == 'relance') ...@@ -411,25 +409,34 @@ if ($_POST["action"] == 'send' || $_POST["action"] == 'relance')
$mimetype[1] = $_FILES['addedfile']['type']; $mimetype[1] = $_FILES['addedfile']['type'];
// Envoi de la facture // Envoi de la facture
$mailfile = new CMailFile($subject,$sendto,$from,$message,$filepath, $mimetype,$filename,$sendtocc); $mailfile = new CMailFile($subject,$sendto,$from,$message,$filepath,$mimetype,$filename,$sendtocc);
if ($mailfile->sendfile()) if ($mailfile->sendfile())
{ {
$msg='<div class="ok">'.$langs->trans("MailSuccessfulySent",$from,$sendto).'.</div>'; $msg='<div class="ok">'.$langs->trans("MailSuccessfulySent",$from,$sendto).'.</div>';
$sendto = htmlentities($sendto); // Insertion action
include_once("../contact.class.php");
$sql = "INSERT INTO ".MAIN_DB_PREFIX."actioncomm"; $actioncomm = new ActionComm($db);
$sql.= "(datea,fk_action,fk_soc,note,fk_facture,fk_contact,fk_user_author,label,percent)"; $actioncomm->type_code = $actioncode;
$sql.= " VALUES (now(), '$actioncode' ,'$fac->socidp' ,'".addslashes($actionmsg)."','$fac->id','$sendtoid','$user->id', '$actionmsg2',100);"; $actioncomm->label = $actionmsg2;
$actioncomm->note = $actionmsg;
if (! $db->query($sql) ) $actioncomm->date = $db->idate(time());
$actioncomm->percent = 100;
$actioncomm->contact = new Contact($db,$sendtoid);
$actioncomm->societe = new Societe($db,$fac->socidp);
$actioncomm->user = $user; // User qui a fait l'action
$actioncomm->facid = $fac->id;
$ret=$actioncomm->add($user); // User qui saisi l'action
if ($ret < 0)
{ {
dolibarr_print_error($db); dolibarr_print_error($db);
} }
else else
{ {
// Renvoie sur la page de la facture // Renvoie sur la fiche
Header("Location: facture.php?facid=".$fac->id."&msg=".urlencode($msg)); Header("Location: facture.php?facid=".$fac->id."&msg=".urlencode($msg));
exit; exit;
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment