FIX update of recruitment should not fill email_msgid in actioncomm

This commit is contained in:
Laurent Destailleur 2022-05-16 14:49:06 +02:00
parent a92974c818
commit 7926945477
4 changed files with 21 additions and 11 deletions

View File

@ -121,7 +121,7 @@ if ($action == 'add' && !empty($permissiontoadd)) {
// Fill array 'array_options' with data from add form
if (!$error) {
$ret = $extrafields->setOptionalsFromPost(null, $object);
$ret = $extrafields->setOptionalsFromPost(null, $object, '', 1);
if ($ret < 0) {
$error++;
}

View File

@ -924,7 +924,8 @@ class InterfaceActionsAuto extends DolibarrTriggers
}
}
// If trackid is not defined, we set it
// If trackid is not defined, we set it.
// Note that it should be set by caller. This is for compatibility purpose only.
if (empty($object->trackid)) {
// See also similar list into emailcollector.class.php
if (preg_match('/^COMPANY_/', $action)) {
@ -1039,15 +1040,17 @@ class InterfaceActionsAuto extends DolibarrTriggers
$actioncomm->contact_id = $contactforaction->id; // deprecated, use ->socpeopleassigned instead
$actioncomm->authorid = $user->id; // User saving action
$actioncomm->userownerid = $user->id; // Owner of action
// Fields defined when action is an email (content should be into object->actionmsg to be added into note, subject into object->actionms2 to be added into label)
$actioncomm->email_msgid = empty($object->email_msgid) ? null : $object->email_msgid;
$actioncomm->email_from = empty($object->email_from) ? null : $object->email_from;
$actioncomm->email_sender = empty($object->email_sender) ? null : $object->email_sender;
$actioncomm->email_to = empty($object->email_to) ? null : $object->email_to;
$actioncomm->email_tocc = empty($object->email_tocc) ? null : $object->email_tocc;
$actioncomm->email_tobcc = empty($object->email_tobcc) ? null : $object->email_tobcc;
$actioncomm->email_subject = empty($object->email_subject) ? null : $object->email_subject;
$actioncomm->errors_to = empty($object->errors_to) ? null : $object->errors_to;
// Fields defined when action is an email (content should be into object->actionmsg to be added into event note, subject should be into object->actionms2 to be added into event label)
if (!property_exists($object, 'email_fields_no_propagate_in_actioncomm') || empty($object->email_fields_no_propagate_in_actioncomm)) {
$actioncomm->email_msgid = empty($object->email_msgid) ? null : $object->email_msgid;
$actioncomm->email_from = empty($object->email_from) ? null : $object->email_from;
$actioncomm->email_sender = empty($object->email_sender) ? null : $object->email_sender;
$actioncomm->email_to = empty($object->email_to) ? null : $object->email_to;
$actioncomm->email_tocc = empty($object->email_tocc) ? null : $object->email_tocc;
$actioncomm->email_tobcc = empty($object->email_tobcc) ? null : $object->email_tobcc;
$actioncomm->email_subject = empty($object->email_subject) ? null : $object->email_subject;
$actioncomm->errors_to = empty($object->errors_to) ? null : $object->errors_to;
}
// Object linked (if link is for thirdparty, contact, project it is a recording error. We should not have links in link table
// for such objects because there is already a dedicated field into table llx_actioncomm or llx_actioncomm_resources.

View File

@ -62,6 +62,11 @@ class RecruitmentCandidature extends CommonObject
*/
public $picto = 'recruitmentcandidature';
/**
* @var int Do not exploit fields email_xxx into triggers.
*/
public $email_fields_no_propagate_in_actioncomm;
const STATUS_DRAFT = 0;
const STATUS_VALIDATED = 1;

View File

@ -134,7 +134,9 @@ if (empty($reshook)) {
$triggermodname = 'RECRUITMENTCANDIDATURE_MODIFY'; // Name of trigger action code to execute when we modify record
// Actions cancel, add, update, update_extras, confirm_validate, confirm_delete, confirm_deleteline, confirm_clone, confirm_close, confirm_setdraft, confirm_reopen
$object->email_fields_no_propagate_in_actioncomm = 1;
include DOL_DOCUMENT_ROOT.'/core/actions_addupdatedelete.inc.php';
$object->email_fields_no_propagate_in_actioncomm = 0;
// Actions when linking object each other
include DOL_DOCUMENT_ROOT.'/core/actions_dellink.inc.php';