Qual: Utilise methode add de classe ActionComm pour insérer actions an base plutot que l'insert spécifique.
This commit is contained in:
parent
0db9887ed7
commit
a6b7b99aa4
@ -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"]); }
|
||||||
|
|
||||||
@ -417,19 +415,28 @@ if ($_POST["action"] == 'send' || $_POST["action"] == 'relance')
|
|||||||
{
|
{
|
||||||
$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");
|
||||||
|
$actioncomm = new ActionComm($db);
|
||||||
|
$actioncomm->type_code = $actioncode;
|
||||||
|
$actioncomm->label = $actionmsg2;
|
||||||
|
$actioncomm->note = $actionmsg;
|
||||||
|
$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;
|
||||||
|
|
||||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."actioncomm";
|
$ret=$actioncomm->add($user); // User qui saisi l'action
|
||||||
$sql.= "(datea,fk_action,fk_soc,note,fk_facture,fk_contact,fk_user_author,label,percent)";
|
|
||||||
$sql.= " VALUES (now(), '$actioncode' ,'$fac->socidp' ,'".addslashes($actionmsg)."','$fac->id','$sendtoid','$user->id', '$actionmsg2',100);";
|
|
||||||
|
|
||||||
if (! $db->query($sql) )
|
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;
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user