From 5d34c94158c9fcfe68eb27145f1324336d51684b Mon Sep 17 00:00:00 2001 From: Regis Houssin <regis@dolibarr.fr> Date: Mon, 27 Dec 2010 14:54:27 +0000 Subject: [PATCH] New: add possibility to overwrite mailing limit sendbyweb in conf.php --- htdocs/comm/mailing/fiche.php | 10 +++++++--- htdocs/conf/conf.php.example | 6 ++++++ htdocs/master.inc.php | 8 ++++++++ 3 files changed, 21 insertions(+), 3 deletions(-) diff --git a/htdocs/comm/mailing/fiche.php b/htdocs/comm/mailing/fiche.php index ae5e85eca46..3ec1528c4a3 100644 --- a/htdocs/comm/mailing/fiche.php +++ b/htdocs/comm/mailing/fiche.php @@ -690,9 +690,13 @@ else } else { - $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><br>'; + $text=''; + if (empty($conf->file->mailing_limit_sendbyweb)) + { + $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><br>'; + } $text.=$langs->trans('ConfirmSendingEmailing').'<br>'; $text.=$langs->trans('LimitSendingEmailing',$conf->global->MAILING_LIMIT_SENDBYWEB); $ret=$html->form_confirm($_SERVER['PHP_SELF'].'?id='.$_REQUEST['id'],$langs->trans('SendMailing'),$text,'sendallconfirmed',$formquestion,'',1,260); diff --git a/htdocs/conf/conf.php.example b/htdocs/conf/conf.php.example index bdf2ca4fdf5..ed76ec41c90 100644 --- a/htdocs/conf/conf.php.example +++ b/htdocs/conf/conf.php.example @@ -237,6 +237,12 @@ $dolibarr_main_prod='0'; # Examples: # $dolibarr_main_limit_users='0'; +# dolibarr_mailing_limit_sendbyweb +# Can set a limit for mailing send by web, can be used for a restricted mode. +# Default value: 0 (use database value if exist) +# Examples: +# $dolibarr_mailing_limit_sendbyweb='0'; + # This is an development feature to allow external components to overwrite # some Dolibarr kernel files to be overwritten by versions provided by # third parties modules. diff --git a/htdocs/master.inc.php b/htdocs/master.inc.php index 66a205927e2..405e60515e9 100644 --- a/htdocs/master.inc.php +++ b/htdocs/master.inc.php @@ -176,6 +176,8 @@ if (empty($dolibarr_main_db_cryptkey)) $dolibarr_main_db_cryptkey=''; $conf->db->dolibarr_main_db_cryptkey = $dolibarr_main_db_cryptkey; if (empty($dolibarr_main_limit_users)) $dolibarr_main_limit_users=0; $conf->file->main_limit_users = $dolibarr_main_limit_users; +if (empty($dolibarr_mailing_limit_sendbyweb)) $dolibarr_mailing_limit_sendbyweb=0; +$conf->file->mailing_limit_sendbyweb = $dolibarr_mailing_limit_sendbyweb; if (defined('TEST_DB_FORCE_TYPE')) $conf->db->type=constant('TEST_DB_FORCE_TYPE'); // For test purpose // Identifiant autres $conf->file->main_authentication = empty($dolibarr_main_authentication)?'':$dolibarr_main_authentication; @@ -312,6 +314,12 @@ if (! defined('NOREQUIREDB')) $conf->setValues($db); } +// Overwrite database value +if (! empty($conf->file->mailing_limit_sendbyweb)) +{ + $conf->global->MAILING_LIMIT_SENDBYWEB = $conf->file->mailing_limit_sendbyweb; +} + // If software has been locked. Only login $conf->global->MAIN_ONLY_LOGIN_ALLOWED is allowed. if (! empty($conf->global->MAIN_ONLY_LOGIN_ALLOWED)) { -- GitLab