diff --git a/htdocs/admin/system/constall.php b/htdocs/admin/system/constall.php
index 96cb98809ef..9a27feb3d7a 100644
--- a/htdocs/admin/system/constall.php
+++ b/htdocs/admin/system/constall.php
@@ -89,6 +89,7 @@ $configfileparameters = array(
'separator',
'?dolibarr_mailing_limit_sendbyweb',
'?dolibarr_mailing_limit_sendbycli',
+ '?dolibarr_mailing_limit_sendbyday',
'?dolibarr_strict_mode'
);
$configfilelib = array(
diff --git a/htdocs/admin/system/dolibarr.php b/htdocs/admin/system/dolibarr.php
index e58cf45dd7e..8a982f6e0bd 100644
--- a/htdocs/admin/system/dolibarr.php
+++ b/htdocs/admin/system/dolibarr.php
@@ -360,6 +360,7 @@ $configfileparameters = array(
'dolibarr_main_restrict_ip' => 'Restrict access to some IPs only',
'?dolibarr_mailing_limit_sendbyweb' => 'Limit nb of email sent by page',
'?dolibarr_mailing_limit_sendbycli' => 'Limit nb of email sent by cli',
+ '?dolibarr_mailing_limit_sendbyday' => 'Limit nb of email sent per day',
'?dolibarr_strict_mode' => 'Strict mode is on/off',
'?dolibarr_nocsrfcheck' => 'Disable CSRF security checks'
);
diff --git a/htdocs/comm/mailing/card.php b/htdocs/comm/mailing/card.php
index d46a02132a1..290a29c02ee 100644
--- a/htdocs/comm/mailing/card.php
+++ b/htdocs/comm/mailing/card.php
@@ -801,6 +801,7 @@ if ($action == 'create') {
// MAILING_NO_USING_PHPMAIL may be defined or not.
// MAILING_LIMIT_SENDBYWEB is always defined to something != 0 (-1=forbidden).
// MAILING_LIMIT_SENDBYCLI may be defined ot not (-1=forbidden, 0 or undefined=no limit).
+ // MAILING_LIMIT_SENDBYDAY may be defined ot not (0 or undefined=no limit).
if (!empty($conf->global->MAILING_NO_USING_PHPMAIL) && $sendingmode == 'mail') {
// EMailing feature may be a spam problem, so when you host several users/instance, having this option may force each user to use their own SMTP agent.
// You ensure that every user is using its own SMTP server when using the mass emailing module.
@@ -836,14 +837,21 @@ if ($action == 'create') {
}
$text = '';
- if (!isset($conf->global->MAILING_LIMIT_SENDBYCLI) || $conf->global->MAILING_LIMIT_SENDBYCLI >= 0) {
- $text .= $langs->trans("MailingNeedCommand");
- $text .= '
';
+
+ if (isset($conf->global->MAILING_LIMIT_SENDBYDAY) && $conf->global->MAILING_LIMIT_SENDBYDAY >= 0) {
+ $text .= $langs->trans('WarningLimitSendByDay', $conf->global->MAILING_LIMIT_SENDBYDAY);
$text .= '
';
}
$text .= $langs->trans('ConfirmSendingEmailing').'
';
$text .= $langs->trans('LimitSendingEmailing', $conf->global->MAILING_LIMIT_SENDBYWEB);
- print $form->formconfirm($_SERVER['PHP_SELF'].'?id='.$object->id, $langs->trans('SendMailing'), $text, 'sendallconfirmed', '', '', 1, 330, 600);
+
+ if (!isset($conf->global->MAILING_LIMIT_SENDBYCLI) || $conf->global->MAILING_LIMIT_SENDBYCLI >= 0) {
+ $text .= '
';
+ $text .= $langs->trans("MailingNeedCommand");
+ $text .= '
';
+ }
+
+ print $form->formconfirm($_SERVER['PHP_SELF'].'?id='.$object->id, $langs->trans('SendMailing'), $text, 'sendallconfirmed', '', '', 1, 330, 600, 0, $langs->trans("Confirm"), $langs->trans("Cancel"));
}
}
diff --git a/htdocs/core/class/conf.class.php b/htdocs/core/class/conf.class.php
index 1345d2116f6..1ab3ac6ec9a 100644
--- a/htdocs/core/class/conf.class.php
+++ b/htdocs/core/class/conf.class.php
@@ -1033,12 +1033,15 @@ class Conf
if (!empty($this->file->mailing_limit_sendbyweb)) {
$this->global->MAILING_LIMIT_SENDBYWEB = $this->file->mailing_limit_sendbyweb;
}
- if (empty($this->global->MAILING_LIMIT_SENDBYWEB)) {
+ if (empty($this->global->MAILING_LIMIT_SENDBYWEB)) { // Limit by web can't be 0
$this->global->MAILING_LIMIT_SENDBYWEB = 25;
}
if (!empty($this->file->mailing_limit_sendbycli)) {
$this->global->MAILING_LIMIT_SENDBYCLI = $this->file->mailing_limit_sendbycli;
}
+ if (!empty($this->file->mailing_limit_sendbyday)) {
+ $this->global->MAILING_LIMIT_SENDBYDAY = $this->file->mailing_limit_sendbyday;
+ }
return 0;
}
diff --git a/htdocs/debugbar/class/DataCollector/DolibarrCollector.php b/htdocs/debugbar/class/DataCollector/DolibarrCollector.php
index c69ebb9a121..3193fe26176 100644
--- a/htdocs/debugbar/class/DataCollector/DolibarrCollector.php
+++ b/htdocs/debugbar/class/DataCollector/DolibarrCollector.php
@@ -84,7 +84,7 @@ class DolibarrCollector extends DataCollector implements Renderable, AssetProvid
protected function getMailInfo()
{
global $conf, $langs;
- global $dolibarr_mailing_limit_sendbyweb;
+ global $dolibarr_mailing_limit_sendbyweb, $dolibarr_mailing_limit_sendbycli, $dolibarr_mailing_limit_sendbyday;
$info = $langs->trans('Method').': '.getDolGlobalString("MAIN_MAIL_SENDMODE").'
';
$info .= $langs->trans('Server').': '.getDolGlobalString("MAIN_MAIL_SMTP_SERVER").'
';
@@ -94,6 +94,8 @@ class DolibarrCollector extends DataCollector implements Renderable, AssetProvid
$info .= $langs->trans('TLS/STARTTLS').': '.getDolGlobalString("MAIN_MAIL_EMAIL_TLS").' / '.getDolGlobalString("MAIN_MAIL_EMAIL_STARTTLS").'
';
$info .= $langs->trans('MAIN_DISABLE_ALL_MAILS').': '.(empty($conf->global->MAIN_DISABLE_ALL_MAILS) ? $langs->trans('No') : $langs->trans('Yes')).'
';
$info .= 'dolibarr_mailing_limit_sendbyweb = '.$dolibarr_mailing_limit_sendbyweb.'
';
+ $info .= 'dolibarr_mailing_limit_sendbycli = '.$dolibarr_mailing_limit_sendbycli.'
';
+ $info .= 'dolibarr_mailing_limit_sendbyday = '.$dolibarr_mailing_limit_sendbyday.'
';
return $info;
}
diff --git a/htdocs/filefunc.inc.php b/htdocs/filefunc.inc.php
index c30e2aba532..3e4b6187fb4 100644
--- a/htdocs/filefunc.inc.php
+++ b/htdocs/filefunc.inc.php
@@ -179,6 +179,9 @@ if (empty($dolibarr_mailing_limit_sendbyweb)) {
if (empty($dolibarr_mailing_limit_sendbycli)) {
$dolibarr_mailing_limit_sendbycli = 0;
}
+if (empty($dolibarr_mailing_limit_sendbyday)) {
+ $dolibarr_mailing_limit_sendbyday = 0;
+}
if (empty($dolibarr_strict_mode)) {
$dolibarr_strict_mode = 0; // For debug in php strict mode
}
diff --git a/htdocs/install/step1.php b/htdocs/install/step1.php
index 9613e1a86b5..7235e564275 100644
--- a/htdocs/install/step1.php
+++ b/htdocs/install/step1.php
@@ -911,6 +911,8 @@ function write_conf_file($conffile)
fputs($fp, '$dolibarr_mailing_limit_sendbyweb=\'0\';');
fputs($fp, "\n");
+ fputs($fp, '$dolibarr_mailing_limit_sendbycli=\'0\';');
+ fputs($fp, "\n");
// Write params to overwrites default lib path
fputs($fp, "\n");
diff --git a/htdocs/langs/en_US/mails.lang b/htdocs/langs/en_US/mails.lang
index 22fe0696363..b86ec3ebbd8 100644
--- a/htdocs/langs/en_US/mails.lang
+++ b/htdocs/langs/en_US/mails.lang
@@ -178,3 +178,4 @@ IsAnAnswer=Is an answer of an initial email
RecordCreatedByEmailCollector=Record created by the Email Collector %s from email %s
DefaultBlacklistMailingStatus=Default value for field '%s' when creating a new contact
DefaultStatusEmptyMandatory=Empty but mandatory
+WarningLimitSendByDay=WARNING: The setup or contract of your instance limits your number of emails per day to %s. Trying to send more may result in having your instance slow down or suspended. Please contact your support if you need a higher quota.
diff --git a/htdocs/master.inc.php b/htdocs/master.inc.php
index aa836842e71..fe4bdf42d79 100644
--- a/htdocs/master.inc.php
+++ b/htdocs/master.inc.php
@@ -75,8 +75,9 @@ if (defined('TEST_DB_FORCE_TYPE')) {
// Set properties specific to conf file
$conf->file->main_limit_users = $dolibarr_main_limit_users;
-$conf->file->mailing_limit_sendbyweb = $dolibarr_mailing_limit_sendbyweb;
-$conf->file->mailing_limit_sendbycli = $dolibarr_mailing_limit_sendbycli;
+$conf->file->mailing_limit_sendbyweb = empty($dolibarr_mailing_limit_sendbyweb) ? 0 : $dolibarr_mailing_limit_sendbyweb;
+$conf->file->mailing_limit_sendbycli = empty($dolibarr_mailing_limit_sendbycli) ? 0 : $dolibarr_mailing_limit_sendbycli;
+$conf->file->mailing_limit_sendbyday = empty($dolibarr_mailing_limit_sendbyday) ? 0 : $dolibarr_mailing_limit_sendbyday;
$conf->file->main_authentication = empty($dolibarr_main_authentication) ? '' : $dolibarr_main_authentication; // Identification mode
$conf->file->main_force_https = empty($dolibarr_main_force_https) ? '' : $dolibarr_main_force_https; // Force https
$conf->file->strict_mode = empty($dolibarr_strict_mode) ? '' : $dolibarr_strict_mode; // Force php strict mode (for debug)
diff --git a/htdocs/product/list.php b/htdocs/product/list.php
index 70c5b4f3799..1464456cd6d 100644
--- a/htdocs/product/list.php
+++ b/htdocs/product/list.php
@@ -1915,6 +1915,17 @@ if ($resql) {
$db->free($resql);
+ // If no record found
+ if ($num == 0) {
+ $colspan = 1;
+ foreach ($arrayfields as $key => $val) {
+ if (!empty($val['checked'])) {
+ $colspan++;
+ }
+ }
+ print '