Fix display option email per participient

This commit is contained in:
John Botella 2019-06-20 11:09:37 +02:00
parent 9305403bea
commit 6a68c8cd99
2 changed files with 6 additions and 1 deletions

View File

@ -377,9 +377,11 @@ if (! $error && $massaction == 'confirm_presend')
$subjectreplaced=make_substitutions($subject, $substitutionarray);
$messagereplaced=make_substitutions($message, $substitutionarray);
$attachedfiles=array('paths'=>array(), 'names'=>array(), 'mimes'=>array());
if($oneemailperrecipient)
{
// if "one email per recipient" isn't check we must collate $attachedfiles by thirdparty
if(is_array($attachedfilesThirdpartyObj[$thirdparty->id]) && count($attachedfilesThirdpartyObj[$thirdparty->id]))
{
foreach ($attachedfilesThirdpartyObj[$thirdparty->id] as $keyObjId => $objAttachedFiles){
@ -394,6 +396,7 @@ if (! $error && $massaction == 'confirm_presend')
}
elseif(!empty($attachedfilesThirdpartyObj[$thirdparty->id][$objectid])){
// Create form object
// if "one email per recipient" isn't check we must separate $attachedfiles by object
$attachedfiles=$attachedfilesThirdpartyObj[$thirdparty->id][$objectid];
}

View File

@ -107,7 +107,8 @@ if ($massaction == 'presend')
$formmail->withtoreadonly = 1;
}
$formmail->withoptiononeemailperrecipient = (count($listofselectedref) == 1 || empty($liste))? 0 : ((GETPOST('oneemailperrecipient')=='on')?1:-1);
$formmail->withoptiononeemailperrecipient = ((count($listofselectedref) == 1 && count(reset($listofselectedref)) == 1) || empty($liste)) ? 0 : ((GETPOST('oneemailperrecipient')=='on')?1:-1);
$formmail->withto = empty($liste)?(GETPOST('sendto','alpha')?GETPOST('sendto','alpha'):array()):$liste;
$formmail->withtofree = empty($liste)?1:0;
$formmail->withtocc = 1;
@ -126,6 +127,7 @@ if ($massaction == 'presend')
// Make substitution in email content
$substitutionarray = getCommonSubstitutionArray($langs, 0, null, $object);
$substitutionarray['__EMAIL__'] = $sendto;
$substitutionarray['__CHECK_READ__'] = (is_object($object) && is_object($object->thirdparty)) ? '<img src="' . DOL_MAIN_URL_ROOT . '/public/emailing/mailing-read.php?tag=' . $object->thirdparty->tag . '&securitykey=' . urlencode($conf->global->MAILING_EMAIL_UNSUBSCRIBE_KEY) . '" width="1" height="1" style="width:1px;height:1px" border="0"/>' : '';
$substitutionarray['__PERSONALIZED__'] = ''; // deprecated