From 318e285ba2fa81f0298d83f11957de80dddfbc55 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 16 Sep 2017 16:00:58 +0200 Subject: [PATCH] NEW Add protection to avoid to send to much emails using builk actions --- htdocs/core/tpl/massactions_form.tpl.php | 13 +++++++++++-- htdocs/langs/en_US/errors.lang | 3 ++- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/htdocs/core/tpl/massactions_form.tpl.php b/htdocs/core/tpl/massactions_form.tpl.php index c8e329eaf4b..280a153acc7 100644 --- a/htdocs/core/tpl/massactions_form.tpl.php +++ b/htdocs/core/tpl/massactions_form.tpl.php @@ -132,7 +132,16 @@ $langs->load("mails"); $formmail->param['models_id']=GETPOST('modelmailselected','int'); $formmail->param['id']=join(',',$arrayofselected); //$formmail->param['returnurl']=$_SERVER["PHP_SELF"].'?id='.$object->id; - - print $formmail->get_form(); + if (! empty($conf->global->MAILING_LIMIT_SENDBYWEB) && count($listofselectedthirdparties) > $conf->global->MAILING_LIMIT_SENDBYWEB) + { + $langs->load("errors"); + print img_warning().' '.$langs->trans('WarningNumberOfRecipientIsRestrictedInMassAction', $conf->global->MAILING_LIMIT_SENDBYWEB); + print ' - '.$langs->trans("GoBack").''; + $arrayofmassactions=array(); + } + else + { + print $formmail->get_form(); + } dol_fiche_end(); diff --git a/htdocs/langs/en_US/errors.lang b/htdocs/langs/en_US/errors.lang index 003eedeac8a..7ace47fb781 100644 --- a/htdocs/langs/en_US/errors.lang +++ b/htdocs/langs/en_US/errors.lang @@ -220,4 +220,5 @@ WarningPaymentDateLowerThanInvoiceDate=Payment date (%s) is earlier than invoice WarningTooManyDataPleaseUseMoreFilters=Too many data (more than %s lines). Please use more filters or set the constant %s to a higher limit. WarningSomeLinesWithNullHourlyRate=Some times were recorded by some users while their hourly rate was not defined. A value of 0 %s per hour was used but this may result in wrong valuation of time spent. WarningYourLoginWasModifiedPleaseLogin=Your login was modified. For security purpose you will have to login with your new login before next action. -WarningAnEntryAlreadyExistForTransKey=An entry already exists for the translation key for this language \ No newline at end of file +WarningAnEntryAlreadyExistForTransKey=An entry already exists for the translation key for this language +WarningNumberOfRecipientIsRestrictedInMassAction=Warning, number of different recipient is limited to %s when using the bulk actions on lists \ No newline at end of file