From 71cf137da414f14d51a8c81201607fb93fd44b1a Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 11 Jan 2022 13:32:32 +0100 Subject: [PATCH] Fix code for cli must be similar to same code for gui version. --- scripts/emailings/mailing-send.php | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/scripts/emailings/mailing-send.php b/scripts/emailings/mailing-send.php index 876895d7c87..f427e42d8cb 100755 --- a/scripts/emailings/mailing-send.php +++ b/scripts/emailings/mailing-send.php @@ -168,6 +168,8 @@ if ($resql) { $error++; } + $thirdpartystatic = new Societe($db); + // Look on each email and sent message $i = 0; while ($i < $num2) { @@ -200,6 +202,15 @@ if ($resql) { // 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;