FIX thirdparty property of object not loaded when only one record

This commit is contained in:
Laurent Destailleur 2018-10-29 02:02:43 +01:00
parent f8a49edf78
commit dbb2168b83

View File

@ -333,12 +333,16 @@ if (! $error && $massaction == 'confirm_presend')
if ($objectclass == 'CommandeFournisseur') $sendtobcc .= (empty($conf->global->MAIN_MAIL_AUTOCOPY_SUPPLIER_ORDER_TO) ? '' : (($sendtobcc?", ":"").$conf->global->MAIN_MAIL_AUTOCOPY_SUPPLIER_ORDER_TO));
if ($objectclass == 'FactureFournisseur') $sendtobcc .= (empty($conf->global->MAIN_MAIL_AUTOCOPY_SUPPLIER_INVOICE_TO) ? '' : (($sendtobcc?", ":"").$conf->global->MAIN_MAIL_AUTOCOPY_SUPPLIER_INVOICE_TO));
// $listofqualifiedobj is array with key = object id of qualified objects for the current thirdparty
// $listofqualifiedobj is array with key = object id and value is instance of qualified objects, for the current thirdparty (but thirdparty property is not loaded yet)
$oneemailperrecipient=(GETPOST('oneemailperrecipient')=='on'?1:0);
$looparray=array();
if (! $oneemailperrecipient)
{
$looparray = $listofqualifiedobj;
foreach ($looparray as $key => $objecttmp)
{
$looparray[$key]->thirdparty = $thirdparty;
}
}
else
{
@ -348,7 +352,7 @@ if (! $error && $massaction == 'confirm_presend')
}
//var_dump($looparray);exit;
foreach ($looparray as $objecttmp) // $objecttmp is a real object or an empty if we choose to send one email per thirdparty instead of per record
foreach ($looparray as $objecttmp) // $objecttmp is a real object or an empty object if we choose to send one email per thirdparty instead of one per record
{
// Make substitution in email content
$substitutionarray=getCommonSubstitutionArray($langs, 0, null, $objecttmp);