Fix: use a negative value to not allow the sending of email marketing, only the test can
This commit is contained in:
parent
16a5028904
commit
993c8a8bab
@ -101,6 +101,11 @@ if ($_REQUEST["action"] == 'sendallconfirmed' && $_REQUEST['confirm'] == 'yes')
|
|||||||
$message.='<br><br><div class="warning">'.$langs->trans("MailingNeedCommand2").'</div>';
|
$message.='<br><br><div class="warning">'.$langs->trans("MailingNeedCommand2").'</div>';
|
||||||
$_GET["action"]='';
|
$_GET["action"]='';
|
||||||
}
|
}
|
||||||
|
else if ($conf->global->MAILING_LIMIT_SENDBYWEB < 0)
|
||||||
|
{
|
||||||
|
$message='<div class="warning">'.$langs->trans("NotEnoughPermissions").'</div>';
|
||||||
|
$_GET["action"]='';
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$mil=new Mailing($db);
|
$mil=new Mailing($db);
|
||||||
@ -296,15 +301,19 @@ if ($_POST["action"] == 'send' && empty($_POST["cancel"]))
|
|||||||
{
|
{
|
||||||
$mil = new Mailing($db);
|
$mil = new Mailing($db);
|
||||||
$result=$mil->fetch($_POST["mailid"]);
|
$result=$mil->fetch($_POST["mailid"]);
|
||||||
|
|
||||||
|
$error=0;
|
||||||
|
|
||||||
$upload_dir = $conf->mailing->dir_output . "/" . get_exdir($mil->id,2,0,1);
|
$upload_dir = $conf->mailing->dir_output . "/" . get_exdir($mil->id,2,0,1);
|
||||||
|
|
||||||
$mil->sendto = $_POST["sendto"];
|
$mil->sendto = $_POST["sendto"];
|
||||||
if (! $mil->sendto)
|
if (! $mil->sendto)
|
||||||
{
|
{
|
||||||
$message='<div class="error">'.$langs->trans("ErrorFieldRequired",$langs->trans("MailTo")).'</div>';
|
$message='<div class="error">'.$langs->trans("ErrorFieldRequired",$langs->trans("MailTo")).'</div>';
|
||||||
|
$error++;
|
||||||
}
|
}
|
||||||
if ($mil->sendto)
|
|
||||||
|
if (! $error)
|
||||||
{
|
{
|
||||||
// Ajout CSS
|
// Ajout CSS
|
||||||
if (!empty($mil->bgcolor)) $arr_css['bgcolor'] = $mil->bgcolor;
|
if (!empty($mil->bgcolor)) $arr_css['bgcolor'] = $mil->bgcolor;
|
||||||
@ -602,7 +611,7 @@ if ($_GET["action"] == 'create')
|
|||||||
|
|
||||||
print_fiche_titre($langs->trans("NewMailing"));
|
print_fiche_titre($langs->trans("NewMailing"));
|
||||||
|
|
||||||
if ($message) print "$message<br>";
|
if ($message) print $message."<br>";
|
||||||
|
|
||||||
print '<table class="border" width="100%">';
|
print '<table class="border" width="100%">';
|
||||||
print '<tr><td width="25%" class="fieldrequired">'.$langs->trans("MailTitle").'</td><td><input class="flat" name="titre" size="40" value="'.$_POST['titre'].'"></td></tr>';
|
print '<tr><td width="25%" class="fieldrequired">'.$langs->trans("MailTitle").'</td><td><input class="flat" name="titre" size="40" value="'.$_POST['titre'].'"></td></tr>';
|
||||||
@ -644,6 +653,8 @@ else
|
|||||||
$head = emailing_prepare_head($mil);
|
$head = emailing_prepare_head($mil);
|
||||||
|
|
||||||
dol_fiche_head($head, 'card', $langs->trans("Mailing"), 0, 'email');
|
dol_fiche_head($head, 'card', $langs->trans("Mailing"), 0, 'email');
|
||||||
|
|
||||||
|
if ($message) print $message."<br>";
|
||||||
|
|
||||||
// Confirmation de la validation du mailing
|
// Confirmation de la validation du mailing
|
||||||
if ($_GET["action"] == 'valid')
|
if ($_GET["action"] == 'valid')
|
||||||
@ -691,7 +702,7 @@ else
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
$text='';
|
$text='';
|
||||||
if (empty($conf->file->mailing_limit_sendbyweb))
|
if ($conf->file->mailing_limit_sendbyweb == 0)
|
||||||
{
|
{
|
||||||
$text.=$langs->trans("MailingNeedCommand");
|
$text.=$langs->trans("MailingNeedCommand");
|
||||||
$text.='<br><textarea cols="60" rows="'.ROWS_2.'" wrap="soft">php ./scripts/emailings/mailing-send.php '.$_GET["id"].'</textarea>';
|
$text.='<br><textarea cols="60" rows="'.ROWS_2.'" wrap="soft">php ./scripts/emailings/mailing-send.php '.$_GET["id"].'</textarea>';
|
||||||
@ -736,8 +747,17 @@ else
|
|||||||
$nbemail = ($mil->nbemail?$mil->nbemail:'<font class="error">'.$langs->trans("NoTargetYet").'</font>');
|
$nbemail = ($mil->nbemail?$mil->nbemail:'<font class="error">'.$langs->trans("NoTargetYet").'</font>');
|
||||||
if (!empty($conf->global->MAILING_LIMIT_SENDBYWEB) && is_numeric($nbemail) && $conf->global->MAILING_LIMIT_SENDBYWEB < $nbemail)
|
if (!empty($conf->global->MAILING_LIMIT_SENDBYWEB) && is_numeric($nbemail) && $conf->global->MAILING_LIMIT_SENDBYWEB < $nbemail)
|
||||||
{
|
{
|
||||||
$text=$langs->trans('LimitSendingEmailing',$conf->global->MAILING_LIMIT_SENDBYWEB);
|
if ($conf->global->MAILING_LIMIT_SENDBYWEB > 0)
|
||||||
print $html->textwithpicto($nbemail,$text,1,'warning');
|
{
|
||||||
|
$text=$langs->trans('LimitSendingEmailing',$conf->global->MAILING_LIMIT_SENDBYWEB);
|
||||||
|
print $html->textwithpicto($nbemail,$text,1,'warning');
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$text=$langs->trans('NotEnoughPermissions');
|
||||||
|
print $html->textwithpicto($nbemail,$text,1,'warning');
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -804,7 +824,14 @@ else
|
|||||||
|
|
||||||
if (($mil->statut == 1 || $mil->statut == 2) && $mil->nbemail > 0 && $user->rights->mailing->valider)
|
if (($mil->statut == 1 || $mil->statut == 2) && $mil->nbemail > 0 && $user->rights->mailing->valider)
|
||||||
{
|
{
|
||||||
print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?action=sendall&id='.$mil->id.'">'.$langs->trans("SendMailing").'</a>';
|
if ($conf->global->MAILING_LIMIT_SENDBYWEB < 0)
|
||||||
|
{
|
||||||
|
print '<a class="butActionRefused" href="#" title="'.dol_escape_htmltag($langs->trans("NotEnoughPermissions")).'">'.$langs->trans("SendMailing").'</a>';
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?action=sendall&id='.$mil->id.'">'.$langs->trans("SendMailing").'</a>';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($user->rights->mailing->creer)
|
if ($user->rights->mailing->creer)
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user