Pārlūkot izejas kodu

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

Laurent Destailleur 3 gadi atpakaļ
vecāks
revīzija
71cf137da4
1 mainītis faili ar 11 papildinājumiem un 0 dzēšanām
  1. 11 0
      scripts/emailings/mailing-send.php

+ 11 - 0
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;