diff --git a/htdocs/core/class/utils.class.php b/htdocs/core/class/utils.class.php
index f67702ca7c9..3f1fe9ff888 100644
--- a/htdocs/core/class/utils.class.php
+++ b/htdocs/core/class/utils.class.php
@@ -186,7 +186,7 @@ class Utils
}
// Recreate temp dir that are not automatically recreated by core code for performance purpose, we need them
- if (!empty($conf->api->enabled)) {
+ if (isModEnabled('api')) {
dol_mkdir($conf->api->dir_temp);
}
dol_mkdir($conf->user->dir_temp);
diff --git a/htdocs/user/card.php b/htdocs/user/card.php
index 8c74efaa62f..6f9a615b08a 100644
--- a/htdocs/user/card.php
+++ b/htdocs/user/card.php
@@ -1092,7 +1092,7 @@ if ($action == 'create' || $action == 'adduserldap') {
print $valuetoshow;
print '';
- if (!empty($conf->api->enabled)) {
+ if (isModEnabled('api')) {
// API key
//$generated_password = getRandomPassword(false);
print '
| '.$langs->trans("ApiKey").' | ';
print '';
if (!empty($object->api_key)) {
diff --git a/htdocs/user/list.php b/htdocs/user/list.php
index 8c7cd49d6e4..68d8c642220 100644
--- a/htdocs/user/list.php
+++ b/htdocs/user/list.php
@@ -112,7 +112,7 @@ $fieldstosearchall = array(
'u.note_public'=>"NotePublic",
'u.note_private'=>"NotePrivate"
);
-if (!empty($conf->api->enabled)) {
+if (isModEnabled('api')) {
$fieldstosearchall['u.api_key'] = "ApiKey";
}
@@ -132,7 +132,7 @@ $arrayfields = array(
'u.office_phone'=>array('label'=>"PhonePro", 'checked'=>1, 'position'=>31),
'u.user_mobile'=>array('label'=>"PhoneMobile", 'checked'=>1, 'position'=>32),
'u.email'=>array('label'=>"EMail", 'checked'=>1, 'position'=>35),
- 'u.api_key'=>array('label'=>"ApiKey", 'checked'=>0, 'position'=>40, "enabled"=>(!empty($conf->api->enabled) && $user->admin)),
+ 'u.api_key'=>array('label'=>"ApiKey", 'checked'=>0, 'position'=>40, "enabled"=>(isModEnabled('api') && $user->admin)),
'u.fk_soc'=>array('label'=>"Company", 'checked'=>($contextpage == 'employeelist' ? 0 : 1), 'position'=>45),
'u.ref_employee'=>array('label'=>"RefEmployee", 'checked'=>-1, 'position'=>60, 'enabled'=>(isModEnabled('hrm') && $permissiontoreadhr)),
'u.national_registration_number'=>array('label'=>"NationalRegistrationNumber", 'checked'=>-1, 'position'=>61, 'enabled'=>(isModEnabled('hrm') && $permissiontoreadhr)),
|