Fix: Error management of mass email feature
This commit is contained in:
parent
fd271d7c92
commit
eec5d6d313
@ -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='<div class="warning">'.$langs->trans("WarningNoEMailsAdded").'</div>';
|
||||
setEventMessage($langs->trans("WarningNoEMailsAdded"),'warnings');
|
||||
}
|
||||
if ($result < 0)
|
||||
{
|
||||
$mesg='<div class="error">'.$langs->trans("Error").($obj->error?' '.$obj->error:'').'</div>';
|
||||
setEventMessage($langs->trans("Error").($obj->error?' '.$obj->error:''),'errors');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -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__' => '<img src="'.DOL_MAIN_URL_ROOT.'/public/emailing/mailing-read.php?tag='.$obj->tag.'&securitykey='.urlencode($conf->global->MAILING_EMAIL_UNSUBSCRIBE_KEY).'" width="1" height="1" style="width:1px;height:1px" border="0"/>',
|
||||
'__UNSUBSCRIBE__' => '<a href="'.DOL_MAIN_URL_ROOT.'/public/emailing/mailing-unsubscribe.php?tag='.$obj->tag.'&unsuscrib=1&securitykey='.urlencode($conf->global->MAILING_EMAIL_UNSUBSCRIBE_KEY).'" target="_blank">'.$langs->trans("MailUnsubcribe").'</a>',
|
||||
'__MAILTOEMAIL__' => '<a href="mailto:'.$obj->email.'">'.$obj->email.'</a>',
|
||||
'__LASTNAME__' => $obj->lastname,
|
||||
'__FIRSTNAME__' => $obj->firstname,
|
||||
'__MAILTOEMAIL__' => '<a href="mailto:'.$obj->email.'">'.$obj->email.'</a>',
|
||||
'__OTHER1__' => $other1,
|
||||
'__OTHER2__' => $other2,
|
||||
'__OTHER3__' => $other3,
|
||||
'__OTHER4__' => $other4,
|
||||
'__OTHER5__' => $other5
|
||||
'__OTHER5__' => $other5,
|
||||
'__CHECK_READ__' => '<img src="'.DOL_MAIN_URL_ROOT.'/public/emailing/mailing-read.php?tag='.$obj->tag.'&securitykey='.urlencode($conf->global->MAILING_EMAIL_UNSUBSCRIBE_KEY).'" width="1" height="1" style="width:1px;height:1px" border="0"/>',
|
||||
'__UNSUBSCRIBE__' => '<a href="'.DOL_MAIN_URL_ROOT.'/public/emailing/mailing-unsubscribe.php?tag='.$obj->tag.'&unsuscrib=1&securitykey='.urlencode($conf->global->MAILING_EMAIL_UNSUBSCRIBE_KEY).'" target="_blank">'.$langs->trans("MailUnsubcribe").'</a>'
|
||||
);
|
||||
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.='<div class="warning">'.$langs->trans("MailingNeedCommand").'</div>';
|
||||
$mesgembedded.='<br><textarea cols="60" rows="'.ROWS_2.'" wrap="soft">php ./scripts/emailings/mailing-send.php '.$object->id.'</textarea>';
|
||||
$mesgembedded.='<br><textarea cols="60" rows="'.ROWS_1.'" wrap="soft">php ./scripts/emailings/mailing-send.php '.$object->id.'</textarea>';
|
||||
$mesgembedded.='<br><br><div class="warning">'.$langs->trans("MailingNeedCommand2").'</div>';
|
||||
$_GET["action"]='';
|
||||
}
|
||||
@ -915,7 +916,11 @@ else
|
||||
print '<br><br></div>';
|
||||
}
|
||||
|
||||
if (! empty($mesgembedded)) dol_htmloutput_mesg($mesgembedded,'','warning',1);
|
||||
if (! empty($mesgembedded))
|
||||
{
|
||||
dol_htmloutput_mesg($mesgembedded,'','warning',1);
|
||||
print '<br>';
|
||||
}
|
||||
|
||||
// Affichage formulaire de TEST
|
||||
if ($action == 'test')
|
||||
|
||||
@ -104,7 +104,7 @@ class mailing_xinputuser extends MailingTargets
|
||||
global $langs;
|
||||
|
||||
$s='';
|
||||
$s.='<input type="text" name="xinputuser" class="flat" size="40">';
|
||||
$s.='<input type="text" name="xinputuser" class="flat" size="40" value="'.GETPOST("xinputuser").'">';
|
||||
return $s;
|
||||
}
|
||||
|
||||
|
||||
@ -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=<b>%s</b> 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
|
||||
|
||||
@ -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__' => '<img src="'.DOL_MAIN_URL_ROOT.'/public/emailing/mailing-read.php?tag='.$obj2->tag.'&securitykey='.urlencode($conf->global->MAILING_EMAIL_UNSUBSCRIBE_KEY).'" width="1" height="1" style="width:1px;height:1px" border="0"/>',
|
||||
'__UNSUBSCRIBE__' => '<a href="'.DOL_MAIN_URL_ROOT.'/public/emailing/mailing-unsubscribe.php?tag='.$obj2->tag.'&unsuscrib=1&securitykey='.urlencode($conf->global->MAILING_EMAIL_UNSUBSCRIBE_KEY).'" target="_blank">'.$langs->trans("MailUnsubcribe").'</a>',
|
||||
'__MAILTOEMAIL__' => '<a href="mailto:'.$obj2->email.'">'.$obj2->email.'</a>',
|
||||
'__LASTNAME__' => $obj2->lastname,
|
||||
'__FIRSTNAME__' => $obj2->firstname,
|
||||
'__MAILTOEMAIL__' => '<a href="mailto:'.$obj2->email.'">'.$obj2->email.'</a>',
|
||||
'__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__' => '<img src="'.DOL_MAIN_URL_ROOT.'/public/emailing/mailing-read.php?tag='.$obj2->tag.'&securitykey='.urlencode($conf->global->MAILING_EMAIL_UNSUBSCRIBE_KEY).'" width="1" height="1" style="width:1px;height:1px" border="0"/>',
|
||||
'__UNSUBSCRIBE__' => '<a href="'.DOL_MAIN_URL_ROOT.'/public/emailing/mailing-unsubscribe.php?tag='.$obj2->tag.'&unsuscrib=1&securitykey='.urlencode($conf->global->MAILING_EMAIL_UNSUBSCRIBE_KEY).'" target="_blank">'.$langs->trans("MailUnsubcribe").'</a>'
|
||||
);
|
||||
if (! empty($conf->paypal->enabled) && ! empty($conf->global->PAYPAL_SECURITY_TOKEN))
|
||||
{
|
||||
|
||||
1
test/phpunit/testemailing.txt
Normal file
1
test/phpunit/testemailing.txt
Normal file
@ -0,0 +1 @@
|
||||
test@bidon.com;Name of user;Lastname of user;Other
|
||||
Loading…
Reference in New Issue
Block a user