Fix code for cli must be similar to same code for gui version.

This commit is contained in:
Laurent Destailleur 2022-01-11 13:32:32 +01:00
parent b824912473
commit 71cf137da4

View File

@ -168,6 +168,8 @@ if ($resql) {
$error++; $error++;
} }
$thirdpartystatic = new Societe($db);
// Look on each email and sent message // Look on each email and sent message
$i = 0; $i = 0;
while ($i < $num2) { while ($i < $num2) {
@ -200,6 +202,15 @@ if ($resql) {
// Array of possible substitutions (See also file mailing-send.php that should manage same substitutions) // Array of possible substitutions (See also file mailing-send.php that should manage same substitutions)
$substitutionarray['__ID__'] = $obj->source_id; $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['__EMAIL__'] = $obj->email;
$substitutionarray['__LASTNAME__'] = $obj->lastname; $substitutionarray['__LASTNAME__'] = $obj->lastname;
$substitutionarray['__FIRSTNAME__'] = $obj->firstname; $substitutionarray['__FIRSTNAME__'] = $obj->firstname;