diff --git a/htdocs/comm/action/class/actioncomm.class.php b/htdocs/comm/action/class/actioncomm.class.php index 9f051b902ccdf51b88f43deb86b1ee351b49e2a2..68eb6994e5a40f1b840c3a2195a7198e2a1a20ac 100644 --- a/htdocs/comm/action/class/actioncomm.class.php +++ b/htdocs/comm/action/class/actioncomm.class.php @@ -157,7 +157,17 @@ class ActionComm extends CommonObject 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 * diff --git a/htdocs/core/triggers/interface_50_modAgenda_ActionsAuto.class.php b/htdocs/core/triggers/interface_50_modAgenda_ActionsAuto.class.php index 0912e7aee10df9eb99617d95bf4da0f01268b5ce..40a06f11648bd62354c7af4633f41f46e81ae0bd 100644 --- a/htdocs/core/triggers/interface_50_modAgenda_ActionsAuto.class.php +++ b/htdocs/core/triggers/interface_50_modAgenda_ActionsAuto.class.php @@ -698,9 +698,9 @@ class InterfaceActionsAuto extends DolibarrTriggers require_once DOL_DOCUMENT_ROOT.'/comm/action/class/actioncomm.class.php'; $actioncomm = new ActionComm($this->db); $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->note = $object->actionmsg; + $actioncomm->note = $object->actionmsg; // TODO Replace with $actioncomm->email_msgid ? $object->email_content : $object->actionmsg $actioncomm->datep = $now; $actioncomm->datef = $now; $actioncomm->durationp = 0; @@ -712,15 +712,22 @@ class InterfaceActionsAuto extends DolibarrTriggers $actioncomm->contactid = $contactforaction->id; $actioncomm->authorid = $user->id; // User saving action $actioncomm->userownerid = $user->id; // Owner of action - //$actioncomm->userdone = $user; // User doing action (not used anymore) - //$actioncomm->userdoneid = $user->id; // User doing action (not used anymore) + // Fields when action is en email (coentent should be into note) + $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->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) { diff --git a/htdocs/fourn/facture/card.php b/htdocs/fourn/facture/card.php index edda6ea421e7e45aa70757d7008f110e66b54725..a72a6f61aa31c7118f06166be0485fdc3b5d8a55 100644 --- a/htdocs/fourn/facture/card.php +++ b/htdocs/fourn/facture/card.php @@ -1007,22 +1007,29 @@ if (empty($reshook)) $error=0; - // Initialisation donnees + // Init data for trigger $object->sendtoid = $sendtoid; $object->actiontypecode = $actiontypecode; $object->actionmsg = $actionmsg; $object->actionmsg2 = $actionmsg2; $object->fk_element = $object->id; $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'; $interface=new Interfaces($db); $result=$interface->run_triggers('BILL_SUPPLIER_SENTBYMAIL',$object,$user,$langs,$conf); if ($result < 0) { $error++; $object->errors=$interface->errors; } - // Fin appel triggers + // End call triggers if ($error) { diff --git a/htdocs/install/mysql/migration/3.8.0-3.9.0.sql b/htdocs/install/mysql/migration/3.8.0-3.9.0.sql index e6e92a65fc7a9e2f5c100aead72477bcd1af721a..7c372a5c39450533023c0ba80a0d54c144da2d2c 100755 --- a/htdocs/install/mysql/migration/3.8.0-3.9.0.sql +++ b/htdocs/install/mysql/migration/3.8.0-3.9.0.sql @@ -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 = ''; +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 statut=5 where statut = 8 and billed=1; diff --git a/htdocs/install/mysql/tables/llx_actioncomm.sql b/htdocs/install/mysql/tables/llx_actioncomm.sql index 62eaae22e6f133778c8af8b489705b16fb3e5583..b2f0ecc6920b094bb98e15f6efb5d1d634629ff1 100644 --- a/htdocs/install/mysql/tables/llx_actioncomm.sql +++ b/htdocs/install/mysql/tables/llx_actioncomm.sql @@ -55,10 +55,13 @@ create table llx_actioncomm label varchar(256) NOT NULL, -- label/title of event or topic 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_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_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 recurid varchar(128), -- used to store event id to link all recurring event records each other