FIX retreiving user specific constant

This commit is contained in:
Laurent Destailleur
2024-09-19 14:12:07 +02:00
parent 27e2b15d1f
commit cf931a8a90
2 changed files with 5 additions and 5 deletions

View File

@@ -524,13 +524,13 @@ class FormOther
if (!empty($user->socid)) { if (!empty($user->socid)) {
$sql_usr .= " AND u.fk_soc = ".((int) $user->socid); $sql_usr .= " AND u.fk_soc = ".((int) $user->socid);
} }
if (getDolGlobalString('USER_HIDE_NONEMPLOYEE_IN_COMBOBOX')) { if (getDolUserString('USER_HIDE_NONEMPLOYEE_IN_COMBOBOX', getDolGlobalString('USER_HIDE_NONEMPLOYEE_IN_COMBOBOX'))) {
$sql_usr .= " AND u.employee <> 0"; $sql_usr .= " AND u.employee <> 0";
} }
if (getDolGlobalString('USER_HIDE_EXTERNAL_IN_COMBOBOX')) { if (getDolUserString('USER_HIDE_EXTERNAL_IN_COMBOBOX', getDolGlobalString('USER_HIDE_EXTERNAL_IN_COMBOBOX'))) {
$sql_usr .= " AND u.fk_soc IS NULL"; $sql_usr .= " AND u.fk_soc IS NULL";
} }
if (getDolGlobalString('USER_HIDE_INACTIVE_IN_COMBOBOX')) { if (getDolUserString('USER_HIDE_INACTIVE_IN_COMBOBOX', getDolGlobalString('USER_HIDE_INACTIVE_IN_COMBOBOX'))) { // Can be set in setup of module User.
$sql_usr .= " AND u.statut <> 0"; $sql_usr .= " AND u.statut <> 0";
} }

View File

@@ -249,7 +249,7 @@ function getDolUserString($key, $default = '', $tmpuser = null)
$tmpuser = $user; $tmpuser = $user;
} }
return (string) (empty($tmpuser->conf->$key) ? $default : $tmpuser->conf->$key); return (string) (isset($tmpuser->conf->$key) ? $tmpuser->conf->$key : $default);
} }
/** /**
@@ -267,7 +267,7 @@ function getDolUserInt($key, $default = 0, $tmpuser = null)
$tmpuser = $user; $tmpuser = $user;
} }
return (int) (empty($tmpuser->conf->$key) ? $default : $tmpuser->conf->$key); return (int) (isset($tmpuser->conf->$key) ? $tmpuser->conf->$key: $default);
} }