2
0
forked from Wavyzz/dolibarr
This commit is contained in:
Laurent Destailleur
2022-12-09 15:57:18 +01:00
parent 91f5fe1320
commit a07193ef4b
3 changed files with 46 additions and 15 deletions

View File

@@ -73,8 +73,9 @@ if (!function_exists('utf8_decode')) {
/**
* Return dolibarr global constant string value
* @param string $key key to return value, return '' if not set
* @param string $default value to return
*
* @param string $key key to return value, return '' if not set
* @param string $default value to return
* @return string
*/
function getDolGlobalString($key, $default = '')
@@ -86,8 +87,9 @@ function getDolGlobalString($key, $default = '')
/**
* Return dolibarr global constant int value
* @param string $key key to return value, return 0 if not set
* @param int $default value to return
*
* @param string $key key to return value, return 0 if not set
* @param int $default value to return
* @return int
*/
function getDolGlobalInt($key, $default = 0)
@@ -97,8 +99,37 @@ function getDolGlobalInt($key, $default = 0)
return (int) (empty($conf->global->$key) ? $default : $conf->global->$key);
}
/**
* Return dolibarr user constant string value
*
* @param string $key key to return value, return '' if not set
* @param string $default value to return
* @return string
*/
function getDolUserString($key, $default = '')
{
global $user;
// return $conf->global->$key ?? $default;
return (string) (empty($user->conf->$key) ? $default : $user->conf->$key);
}
/**
* Return dolibarr user constant int value
*
* @param string $key key to return value, return 0 if not set
* @param int $default value to return
* @return int
*/
function getDolUserInt($key, $default = 0)
{
global $user;
// return $conf->global->$key ?? $default;
return (int) (empty($user->conf->$key) ? $default : $user->conf->$key);
}
/**
* Is Dolibarr module enabled
*
* @param string $module module name to check
* @return int
*/