From 993c8a8babe2f7ae796a960b3cf665b38d4548a9 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Fri, 21 Jan 2011 11:00:04 +0000 Subject: [PATCH] Fix: use a negative value to not allow the sending of email marketing, only the test can --- htdocs/comm/mailing/fiche.php | 41 +++++++++++++++++++++++++++++------ 1 file changed, 34 insertions(+), 7 deletions(-) diff --git a/htdocs/comm/mailing/fiche.php b/htdocs/comm/mailing/fiche.php index 3ec1528c4a3..5d5a6c57e32 100644 --- a/htdocs/comm/mailing/fiche.php +++ b/htdocs/comm/mailing/fiche.php @@ -101,6 +101,11 @@ if ($_REQUEST["action"] == 'sendallconfirmed' && $_REQUEST['confirm'] == 'yes') $message.='

'.$langs->trans("MailingNeedCommand2").'
'; $_GET["action"]=''; } + else if ($conf->global->MAILING_LIMIT_SENDBYWEB < 0) + { + $message='
'.$langs->trans("NotEnoughPermissions").'
'; + $_GET["action"]=''; + } else { $mil=new Mailing($db); @@ -296,15 +301,19 @@ if ($_POST["action"] == 'send' && empty($_POST["cancel"])) { $mil = new Mailing($db); $result=$mil->fetch($_POST["mailid"]); + + $error=0; $upload_dir = $conf->mailing->dir_output . "/" . get_exdir($mil->id,2,0,1); - $mil->sendto = $_POST["sendto"]; + $mil->sendto = $_POST["sendto"]; if (! $mil->sendto) { $message='
'.$langs->trans("ErrorFieldRequired",$langs->trans("MailTo")).'
'; + $error++; } - if ($mil->sendto) + + if (! $error) { // Ajout CSS if (!empty($mil->bgcolor)) $arr_css['bgcolor'] = $mil->bgcolor; @@ -602,7 +611,7 @@ if ($_GET["action"] == 'create') print_fiche_titre($langs->trans("NewMailing")); - if ($message) print "$message
"; + if ($message) print $message."
"; print ''; print ''; @@ -644,6 +653,8 @@ else $head = emailing_prepare_head($mil); dol_fiche_head($head, 'card', $langs->trans("Mailing"), 0, 'email'); + + if ($message) print $message."
"; // Confirmation de la validation du mailing if ($_GET["action"] == 'valid') @@ -691,7 +702,7 @@ else else { $text=''; - if (empty($conf->file->mailing_limit_sendbyweb)) + if ($conf->file->mailing_limit_sendbyweb == 0) { $text.=$langs->trans("MailingNeedCommand"); $text.='
'; @@ -736,8 +747,17 @@ else $nbemail = ($mil->nbemail?$mil->nbemail:''.$langs->trans("NoTargetYet").''); 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); - print $html->textwithpicto($nbemail,$text,1,'warning'); + if ($conf->global->MAILING_LIMIT_SENDBYWEB > 0) + { + $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 { @@ -804,7 +824,14 @@ else if (($mil->statut == 1 || $mil->statut == 2) && $mil->nbemail > 0 && $user->rights->mailing->valider) { - print ''.$langs->trans("SendMailing").''; + if ($conf->global->MAILING_LIMIT_SENDBYWEB < 0) + { + print ''.$langs->trans("SendMailing").''; + } + else + { + print ''.$langs->trans("SendMailing").''; + } } if ($user->rights->mailing->creer)
'.$langs->trans("MailTitle").'