Skip to content

Commit

Permalink
Fix display option email per participient
Browse files Browse the repository at this point in the history
  • Loading branch information
atm-john committed Jun 20, 2019
1 parent 9305403 commit 6a68c8c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
3 changes: 3 additions & 0 deletions htdocs/core/actions_massactions.inc.php
Expand Up @@ -377,9 +377,11 @@
$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){
Expand All @@ -394,6 +396,7 @@
}
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];
}

Expand Down
4 changes: 3 additions & 1 deletion htdocs/core/tpl/massactions_pre.tpl.php
Expand Up @@ -107,7 +107,8 @@
$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;
Expand All @@ -126,6 +127,7 @@

// 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
Expand Down

0 comments on commit 6a68c8c

Please sign in to comment.