diff --git a/htdocs/comm/mailing/cibles.php b/htdocs/comm/mailing/cibles.php index 93e66c0c497..d6599f204f1 100644 --- a/htdocs/comm/mailing/cibles.php +++ b/htdocs/comm/mailing/cibles.php @@ -100,16 +100,18 @@ if ($action == 'add') if ($result > 0) { + setEventMessage($langs->trans("XTargetsAdded",$result),'mesgs'); + header("Location: ".$_SERVER['PHP_SELF']."?id=".$id); exit; } if ($result == 0) { - $mesg='
'.$langs->trans("WarningNoEMailsAdded").'
'; + setEventMessage($langs->trans("WarningNoEMailsAdded"),'warnings'); } if ($result < 0) { - $mesg='
'.$langs->trans("Error").($obj->error?' '.$obj->error:'').'
'; + setEventMessage($langs->trans("Error").($obj->error?' '.$obj->error:''),'errors'); } } diff --git a/htdocs/comm/mailing/fiche.php b/htdocs/comm/mailing/fiche.php index 6a49dd0865b..d803de28357 100644 --- a/htdocs/comm/mailing/fiche.php +++ b/htdocs/comm/mailing/fiche.php @@ -54,7 +54,7 @@ $extralabels=$extrafields->fetch_name_optionals_label($object->table_element); // Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array $hookmanager->initHooks(array('mailingcard')); -// Tableau des substitutions possibles +// Array of possible substitutions (See also file mailing-send.php that should manage same substitutions) $object->substitutionarray=array( '__ID__' => 'IdRecord', '__EMAIL__' => 'EMail', @@ -213,19 +213,20 @@ if ($action == 'sendallconfirmed' && $confirm == 'yes') $tmpfield=explode('=',$other[2],2); $other3=(isset($tmpfield[1])?$tmpfield[1]:$tmpfield[0]); $tmpfield=explode('=',$other[3],2); $other4=(isset($tmpfield[1])?$tmpfield[1]:$tmpfield[0]); $tmpfield=explode('=',$other[4],2); $other5=(isset($tmpfield[1])?$tmpfield[1]:$tmpfield[0]); + // Array of possible substitutions (See also fie mailing-send.php that should manage same substitutions) $substitutionarray=array( '__ID__' => $obj->source_id, '__EMAIL__' => $obj->email, - '__CHECK_READ__' => '', - '__UNSUBSCRIBE__' => ''.$langs->trans("MailUnsubcribe").'', - '__MAILTOEMAIL__' => ''.$obj->email.'', '__LASTNAME__' => $obj->lastname, '__FIRSTNAME__' => $obj->firstname, + '__MAILTOEMAIL__' => ''.$obj->email.'', '__OTHER1__' => $other1, '__OTHER2__' => $other2, '__OTHER3__' => $other3, '__OTHER4__' => $other4, - '__OTHER5__' => $other5 + '__OTHER5__' => $other5, + '__CHECK_READ__' => '', + '__UNSUBSCRIBE__' => ''.$langs->trans("MailUnsubcribe").'' ); if (! empty($conf->paypal->enabled) && ! empty($conf->global->PAYPAL_SECURITY_TOKEN)) { @@ -731,7 +732,7 @@ else // Pour des raisons de securite, on ne permet pas cette fonction via l'IHM, // on affiche donc juste un message $mesgembedded.='
'.$langs->trans("MailingNeedCommand").'
'; - $mesgembedded.='
'; + $mesgembedded.='
'; $mesgembedded.='

'.$langs->trans("MailingNeedCommand2").'
'; $_GET["action"]=''; } @@ -915,7 +916,11 @@ else print '

'; } - if (! empty($mesgembedded)) dol_htmloutput_mesg($mesgembedded,'','warning',1); + if (! empty($mesgembedded)) + { + dol_htmloutput_mesg($mesgembedded,'','warning',1); + print '
'; + } // Affichage formulaire de TEST if ($action == 'test') diff --git a/htdocs/core/modules/mailings/xinputuser.modules.php b/htdocs/core/modules/mailings/xinputuser.modules.php index c412db448a9..0d01aa53912 100644 --- a/htdocs/core/modules/mailings/xinputuser.modules.php +++ b/htdocs/core/modules/mailings/xinputuser.modules.php @@ -104,7 +104,7 @@ class mailing_xinputuser extends MailingTargets global $langs; $s=''; - $s.=''; + $s.=''; return $s; } diff --git a/htdocs/langs/en_US/mails.lang b/htdocs/langs/en_US/mails.lang index 2fd9c09c534..0ad86123313 100644 --- a/htdocs/langs/en_US/mails.lang +++ b/htdocs/langs/en_US/mails.lang @@ -79,6 +79,7 @@ MailtoEMail=Hyper link to email ActivateCheckRead=Allow to use the "Unsubcribe" link ActivateCheckReadKey=Key use to encrypt URL use for "Read Receipt" and "Unsubcribe" feature EMailSentToNRecipients=EMail sent to %s recipients. +XTargetsAdded=%s recipients added into target list EachInvoiceWillBeAttachedToEmail=A document using default invoice document template will be created and attached to each email. MailTopicSendRemindUnpaidInvoices=Reminder of invoice %s (%s) SendRemind=Send reminder by EMails diff --git a/scripts/emailings/mailing-send.php b/scripts/emailings/mailing-send.php index aef1bc7f846..4f341b7a39b 100755 --- a/scripts/emailings/mailing-send.php +++ b/scripts/emailings/mailing-send.php @@ -144,19 +144,21 @@ if ($resql) $other3=$other[2]; $other4=$other[3]; $other5=$other[4]; + // Array of possible substitutions (See also fie mailing-send.php that should manage same substitutions) $substitutionarray=array( '__ID__' => $obj->source_id, '__EMAIL__' => $obj->email, - '__CHECK_READ__' => '', - '__UNSUBSCRIBE__' => ''.$langs->trans("MailUnsubcribe").'', - '__MAILTOEMAIL__' => ''.$obj2->email.'', '__LASTNAME__' => $obj2->lastname, '__FIRSTNAME__' => $obj2->firstname, + '__MAILTOEMAIL__' => ''.$obj2->email.'', '__OTHER1__' => $other1, '__OTHER2__' => $other2, '__OTHER3__' => $other3, '__OTHER4__' => $other4, - '__OTHER5__' => $other5 + '__OTHER5__' => $other5, + '__SIGNATURE__' => '', // Signature is empty when ran from command line (user is a bot) + '__CHECK_READ__' => '', + '__UNSUBSCRIBE__' => ''.$langs->trans("MailUnsubcribe").'' ); if (! empty($conf->paypal->enabled) && ! empty($conf->global->PAYPAL_SECURITY_TOKEN)) { diff --git a/test/phpunit/testemailing.txt b/test/phpunit/testemailing.txt new file mode 100644 index 00000000000..a8b34c83393 --- /dev/null +++ b/test/phpunit/testemailing.txt @@ -0,0 +1 @@ +test@bidon.com;Name of user;Lastname of user;Other \ No newline at end of file