2
0
forked from Wavyzz/dolibarr

get conf global function

This commit is contained in:
Frédéric FRANCE
2021-03-19 17:58:01 +01:00
parent 3414511d7f
commit 4c5ddc44dc
2 changed files with 26 additions and 3 deletions

View File

@@ -562,9 +562,9 @@ if ($action == 'edit') {
if (empty($conf->global->MAIN_DISABLE_ALL_MAILS)) { if (empty($conf->global->MAIN_DISABLE_ALL_MAILS)) {
// Force e-mail recipient // Force e-mail recipient
print '<tr class="oddeven"><td>'.$langs->trans("MAIN_MAIL_FORCE_SENDTO").'</td><td>'.$conf->global->MAIN_MAIL_FORCE_SENDTO; print '<tr class="oddeven"><td>'.$langs->trans("MAIN_MAIL_FORCE_SENDTO").'</td><td>'.getDolGlobalString('MAIN_MAIL_FORCE_SENDTO');
if (!empty($conf->global->MAIN_MAIL_FORCE_SENDTO)) { if (!empty(getDolGlobalString('MAIN_MAIL_FORCE_SENDTO'))) {
if (!isValidEmail($conf->global->MAIN_MAIL_FORCE_SENDTO)) { if (!isValidEmail(getDolGlobalString('MAIN_MAIL_FORCE_SENDTO'))) {
print img_warning($langs->trans("ErrorBadEMail")); print img_warning($langs->trans("ErrorBadEMail"));
} else { } else {
print img_warning($langs->trans("RecipientEmailsWillBeReplacedWithThisValue")); print img_warning($langs->trans("RecipientEmailsWillBeReplacedWithThisValue"));

View File

@@ -41,6 +41,29 @@
include_once DOL_DOCUMENT_ROOT.'/core/lib/json.lib.php'; include_once DOL_DOCUMENT_ROOT.'/core/lib/json.lib.php';
/**
* Return dolibarr global constant string value
* @param string $key key to return value, return '' if not set
* @return string
*/
function getDolGlobalString($key)
{
global $conf;
// return $conf->global->$key ?? '';
return (string) (empty($conf->global->$key) ? '' : $conf->global->$key);
}
/**
* Return dolibarr global constant int value
* @param string $key key to return value, return 0 if not set
* @return int
*/
function getDolGlobalInt($key)
{
global $conf;
// return $conf->global->$key ?? 0;
return (int) (empty($conf->global->$key) ? 0 : $conf->global->$key);
}
/** /**
* Return a DoliDB instance (database handler). * Return a DoliDB instance (database handler).