From 8578a1b825f76a864d0847220b6d1b10a0092f94 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 22 Sep 2017 17:04:26 +0200 Subject: [PATCH] NEW Option "one email per recipient" when using bulk actions emails. --- htdocs/core/class/html.formmail.class.php | 1 + htdocs/core/tpl/massactions_form.tpl.php | 4 ++-- htdocs/langs/en_US/mails.lang | 5 ++++- htdocs/langs/en_US/main.lang | 3 --- 4 files changed, 7 insertions(+), 6 deletions(-) diff --git a/htdocs/core/class/html.formmail.class.php b/htdocs/core/class/html.formmail.class.php index 5d9a963f7a0..8e61eb46012 100644 --- a/htdocs/core/class/html.formmail.class.php +++ b/htdocs/core/class/html.formmail.class.php @@ -515,6 +515,7 @@ class FormMail extends Form } else { + // Note withto may be a text like 'AllRecipientSelected' $out.= (! is_array($this->withto) && ! is_numeric($this->withto))?$this->withto:""; } } diff --git a/htdocs/core/tpl/massactions_form.tpl.php b/htdocs/core/tpl/massactions_form.tpl.php index ded6f170d95..4087d988c3b 100644 --- a/htdocs/core/tpl/massactions_form.tpl.php +++ b/htdocs/core/tpl/massactions_form.tpl.php @@ -74,7 +74,7 @@ if (! empty($conf->global->MAIN_EMAIL_ADD_TRACK_ID) && ($conf->global->MAIN_EMAI $formmail->frommail = dolAddEmailTrackId($formmail->frommail, $trackid); } $formmail->withfrom = 1; -$liste = $langs->trans("AllRecipientSelected", count($listofselectedthirdparties)); +$liste = $langs->trans("AllRecipientSelected", count($arrayofselected)); if (count($listofselectedthirdparties) == 1) // Only 1 different recipient selected, we can suggest contacts { $liste = array(); @@ -98,7 +98,7 @@ if (count($listofselectedthirdparties) == 1) // Only 1 different recipient selec $formmail->withtoreadonly = 1; } -$formmail->withoptiononeemailperrecipient = (GETPOST('oneemailperrecipient')=='on')?1:-1; +$formmail->withoptiononeemailperrecipient = 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; diff --git a/htdocs/langs/en_US/mails.lang b/htdocs/langs/en_US/mails.lang index 7661f46ce3c..0caae25c1d5 100644 --- a/htdocs/langs/en_US/mails.lang +++ b/htdocs/langs/en_US/mails.lang @@ -70,7 +70,10 @@ EMailSentToNRecipients=EMail sent to %s recipients. EMailSentForNElements=EMail sent for %s elements. XTargetsAdded=%s recipients added into target list OnlyPDFattachmentSupported=If the PDF documents were already generated for the objects to send, they will be attached to email. If not, no email will be sent (also, note that only pdf documents are supported as attachment in mass sending in this version). -AllRecipientSelected=The %s unique recipients selected (1 email per recipient), and if an email is set. +AllRecipientSelected=The recipients of the %s record selected (if their email is known). +GroupEmails=Group emails +OneEmailPerRecipient=One email per recipient (by default, one email per record selected) +WarningIfYouCheckOneRecipientPerEmail=Warning, if you check this box, it means only one email will be sent for several different record selected, so, if your message contains substitution variables that refers to data of a record, it becomes not possible to replace them. ResultOfMailSending=Result of mass EMail sending NbSelected=Nb selected NbIgnored=Nb ignored diff --git a/htdocs/langs/en_US/main.lang b/htdocs/langs/en_US/main.lang index 8560b75357f..7475d1194eb 100644 --- a/htdocs/langs/en_US/main.lang +++ b/htdocs/langs/en_US/main.lang @@ -811,9 +811,6 @@ Websites=Web sites Events=Events EMailTemplates=Emails templates FileNotShared=File not shared to exernal public -GroupEmails=Group emails -OneEmailPerRecipient=One email per recipient (by default, one email per record selected) -WarningIfYouCheckOneRecipientPerEmail=Warning, if you check this box, it means only one email may be sent for several different record selected. If your email text contains substitution variables that refers to data of a record, it becomes not possible to replace them. # Week day Monday=Monday Tuesday=Tuesday