Fix: fields added into 3.8 to store email event was not enough. To late

to use them. Will be done into 4.0
This commit is contained in:
Laurent Destailleur 2016-01-08 13:05:56 +01:00
parent 3c5eaf87d5
commit cbe65fbc79
5 changed files with 41 additions and 9 deletions

View File

@ -157,6 +157,16 @@ class ActionComm extends CommonObject
var $actions=array(); var $actions=array();
// Fields for emails
var $email_msgid;
var $email_from;
var $email_sender;
var $email_to;
var $email_tocc;
var $email_tobcc;
var $email_subject;
var $errors_to;
/** /**
* Constructor * Constructor

View File

@ -698,9 +698,9 @@ class InterfaceActionsAuto extends DolibarrTriggers
require_once DOL_DOCUMENT_ROOT.'/comm/action/class/actioncomm.class.php'; require_once DOL_DOCUMENT_ROOT.'/comm/action/class/actioncomm.class.php';
$actioncomm = new ActionComm($this->db); $actioncomm = new ActionComm($this->db);
$actioncomm->type_code = $object->actiontypecode; // code of parent table llx_c_actioncomm (will be deprecated) $actioncomm->type_code = $object->actiontypecode; // code of parent table llx_c_actioncomm (will be deprecated)
$actioncomm->code='AC_'.$action; $actioncomm->code = 'AC_'.$action;
$actioncomm->label = $object->actionmsg2; $actioncomm->label = $object->actionmsg2;
$actioncomm->note = $object->actionmsg; $actioncomm->note = $object->actionmsg; // TODO Replace with $actioncomm->email_msgid ? $object->email_content : $object->actionmsg
$actioncomm->datep = $now; $actioncomm->datep = $now;
$actioncomm->datef = $now; $actioncomm->datef = $now;
$actioncomm->durationp = 0; $actioncomm->durationp = 0;
@ -712,15 +712,22 @@ class InterfaceActionsAuto extends DolibarrTriggers
$actioncomm->contactid = $contactforaction->id; $actioncomm->contactid = $contactforaction->id;
$actioncomm->authorid = $user->id; // User saving action $actioncomm->authorid = $user->id; // User saving action
$actioncomm->userownerid = $user->id; // Owner of action $actioncomm->userownerid = $user->id; // Owner of action
//$actioncomm->userdone = $user; // User doing action (not used anymore) // Fields when action is en email (coentent should be into note)
//$actioncomm->userdoneid = $user->id; // User doing action (not used anymore) $actioncomm->email_msgid = $object->email_msgid;
$actioncomm->email_from = $object->email_from;
$actioncomm->email_sender= $object->email_sender;
$actioncomm->email_to = $object->email_to;
$actioncomm->email_tocc = $object->email_tocc;
$actioncomm->email_tobcc = $object->email_tobcc;
$actioncomm->email_subject = $object->email_subject;
$actioncomm->errors_to = $object->errors_to;
$actioncomm->fk_element = $object->id; $actioncomm->fk_element = $object->id;
$actioncomm->elementtype = $object->element; $actioncomm->elementtype = $object->element;
$ret=$actioncomm->add($user); // User qui saisit l'action $ret=$actioncomm->add($user); // User creating action
unset($object->actionmsg); unset($object->actionmsg2); unset($object->actiontypecode); // When several action are called on same object, we must be sure to not reuse vallue of first action. unset($object->actionmsg); unset($object->actionmsg2); unset($object->actiontypecode); // When several action are called on same object, we must be sure to not reuse value of first action.
if ($ret > 0) if ($ret > 0)
{ {

View File

@ -1007,7 +1007,7 @@ if (empty($reshook))
$error=0; $error=0;
// Initialisation donnees // Init data for trigger
$object->sendtoid = $sendtoid; $object->sendtoid = $sendtoid;
$object->actiontypecode = $actiontypecode; $object->actiontypecode = $actiontypecode;
$object->actionmsg = $actionmsg; $object->actionmsg = $actionmsg;
@ -1015,14 +1015,21 @@ if (empty($reshook))
$object->fk_element = $object->id; $object->fk_element = $object->id;
$object->elementtype = $object->element; $object->elementtype = $object->element;
// Appel des triggers $object->email_subject = $subject;
$object->email_to = $sendto;
$object->email_tocc = $sendtocc;
$object->email_tobcc = $sendtobcc;
$object->email_from = $from;
$object->email_content = $_POST['message'];
// Call triggers
include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php'; include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
$interface=new Interfaces($db); $interface=new Interfaces($db);
$result=$interface->run_triggers('BILL_SUPPLIER_SENTBYMAIL',$object,$user,$langs,$conf); $result=$interface->run_triggers('BILL_SUPPLIER_SENTBYMAIL',$object,$user,$langs,$conf);
if ($result < 0) { if ($result < 0) {
$error++; $object->errors=$interface->errors; $error++; $object->errors=$interface->errors;
} }
// Fin appel triggers // End call triggers
if ($error) if ($error)
{ {

View File

@ -29,6 +29,11 @@ ALTER TABLE llx_don ADD COLUMN fk_country integer NOT NULL DEFAULT 0 after count
UPDATE llx_user set api_key = null where api_key = ''; UPDATE llx_user set api_key = null where api_key = '';
ALTER TABLE llx_actioncomm ADD COLUMN email_subject varchar(256) after email_msgid;
ALTER TABLE llx_actioncomm ADD COLUMN email_tocc varchar(256) after email_to;
ALTER TABLE llx_actioncomm ADD COLUMN email_tobcc varchar(256) after email_tocc;
UPDATE llx_commande_fourn set billed=1 where statut = 8; UPDATE llx_commande_fourn set billed=1 where statut = 8;
UPDATE llx_commande_fourn set statut=5 where statut = 8 and billed=1; UPDATE llx_commande_fourn set statut=5 where statut = 8 and billed=1;

View File

@ -55,10 +55,13 @@ create table llx_actioncomm
label varchar(256) NOT NULL, -- label/title of event or topic of email label varchar(256) NOT NULL, -- label/title of event or topic of email
note text, -- note of event or content of email note text, -- note of event or content of email
email_subject varchar(256), -- when event was an email, we store here the subject. content is stored into note.
email_msgid varchar(256), -- when event was an email, we store here the msgid email_msgid varchar(256), -- when event was an email, we store here the msgid
email_from varchar(256), -- when event was an email, we store here the from email_from varchar(256), -- when event was an email, we store here the from
email_sender varchar(256), -- when event was an email, we store here the sender email_sender varchar(256), -- when event was an email, we store here the sender
email_to varchar(256), -- when event was an email, we store here the email_to email_to varchar(256), -- when event was an email, we store here the email_to
email_tocc varchar(256), -- when event was an email, we store here the email_tocc
email_tobcc varchar(256), -- when event was an email, we store here the email_tobcc
errors_to varchar(256), -- when event was an email, we store here the erros_to errors_to varchar(256), -- when event was an email, we store here the erros_to
recurid varchar(128), -- used to store event id to link all recurring event records each other recurid varchar(128), -- used to store event id to link all recurring event records each other