Merge branch 'develop' of git@github.com:Dolibarr/dolibarr.git into develop

This commit is contained in:
Laurent Destailleur 2022-01-11 13:32:43 +01:00
commit e628b0eeba
2 changed files with 11 additions and 0 deletions

View File

@ -171,6 +171,7 @@ if (empty($reshook)) {
dol_print_error($db);
}
$thirdpartystatic = new Societe($db);
// Loop on each email and send it
$i = 0;
@ -200,6 +201,15 @@ if (empty($reshook)) {
// Array of possible substitutions (See also file mailing-send.php that should manage same substitutions)
$substitutionarray['__ID__'] = $obj->source_id;
if ($obj->source_type == "thirdparty") {
$result = $thirdpartystatic->fetch($obj->source_id);
if ($result > 0) {
$substitutionarray['__THIRDPARTY_CUSTOMER_CODE__'] = $thirdpartystatic->code_client;
} else {
$substitutionarray['__THIRDPARTY_CUSTOMER_CODE__'] = '';
}
}
$substitutionarray['__EMAIL__'] = $obj->email;
$substitutionarray['__LASTNAME__'] = $obj->lastname;
$substitutionarray['__FIRSTNAME__'] = $obj->firstname;

View File

@ -1569,6 +1569,7 @@ class FormMail extends Form
// For mass emailing, we have different keys
$tmparray['__ID__'] = 'IdRecord';
$tmparray['__THIRDPARTY_CUSTOMER_CODE__'] = 'CustomerCode';
$tmparray['__EMAIL__'] = 'EMailRecipient';
$tmparray['__LASTNAME__'] = 'Lastname';
$tmparray['__FIRSTNAME__'] = 'Firstname';