diff --git a/htdocs/don/admin/donation.php b/htdocs/don/admin/donation.php index 744db6998d4..89f03fde211 100644 --- a/htdocs/don/admin/donation.php +++ b/htdocs/don/admin/donation.php @@ -228,10 +228,10 @@ if (is_resource($handle)) { $module = new $classname($db); // Show modules according to features level - if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) { + if ($module->version == 'development' && getDolGlobalInt('MAIN_FEATURES_LEVEL') < 2) { continue; } - if ($module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) { + if ($module->version == 'experimental' && getDolGlobalInt('MAIN_FEATURES_LEVEL') < 1) { continue; } diff --git a/htdocs/eventorganization/lib/eventorganization_conferenceorbooth.lib.php b/htdocs/eventorganization/lib/eventorganization_conferenceorbooth.lib.php index 3c0cebfb2fd..05ec0178d62 100644 --- a/htdocs/eventorganization/lib/eventorganization_conferenceorbooth.lib.php +++ b/htdocs/eventorganization/lib/eventorganization_conferenceorbooth.lib.php @@ -47,7 +47,7 @@ function conferenceorboothPrepareHead($object, $with_project = 0) $head[$h][2] = 'card'; $h++; - if (getDolGlobalString('MAIN_FEATURES_LEVEL') && $conf->global->MAIN_FEATURES_LEVEL >= 2) { + if (getDolGlobalString('MAIN_FEATURES_LEVEL') && getDolGlobalInt('MAIN_FEATURES_LEVEL') >= 2) { $head[$h][0] = DOL_URL_ROOT.'/eventorganization/conferenceorbooth_contact.php?id='.$object->id.$withProjectUrl; $head[$h][1] = $langs->trans("ContactsAddresses"); $head[$h][2] = 'contact'; diff --git a/htdocs/expensereport/card.php b/htdocs/expensereport/card.php index 303611960df..590aa9163db 100644 --- a/htdocs/expensereport/card.php +++ b/htdocs/expensereport/card.php @@ -125,10 +125,10 @@ $fileRequired = getDolGlobalString('EXPENSEREPORT_FILE_IS_REQUIRED'); if ($object->id > 0) { // Check current user can read this expense report $canread = 0; - if (!empty($user->rights->expensereport->readall)) { + if ($user->hasRight('expensereport', 'readall')) { $canread = 1; } - if (!empty($user->rights->expensereport->lire) && in_array($object->fk_user_author, $childids)) { + if ($user->hasRight('expensereport', 'lire') && in_array($object->fk_user_author, $childids)) { $canread = 1; } if (!$canread) { @@ -137,7 +137,7 @@ if ($object->id > 0) { } $candelete = 0; -if (!empty($user->rights->expensereport->supprimer)) { +if ($user->hasRight('expensereport', 'supprimer')) { $candelete = 1; } if ($object->statut == ExpenseReport::STATUS_DRAFT && $user->hasRight('expensereport', 'write') && in_array($object->fk_user_author, $childids)) { @@ -218,7 +218,7 @@ if (empty($reshook)) { include DOL_DOCUMENT_ROOT.'/core/actions_lineupdown.inc.php'; // Must be include, not include_once // Action clone object - if ($action == 'confirm_clone' && $confirm == 'yes' && $user->rights->expensereport->creer) { + if ($action == 'confirm_clone' && $confirm == 'yes' && $user->hasRight('expensereport', 'creer')) { if (1 == 0 && !GETPOST('clone_content', 'alpha') && !GETPOST('clone_receivers', 'alpha')) { setEventMessages($langs->trans("NoCloneOptionsSpecified"), null, 'errors'); } else { @@ -251,7 +251,7 @@ if (empty($reshook)) { } } - if ($action == 'add' && $user->rights->expensereport->creer) { + if ($action == 'add' && $user->hasRight('expensereport', 'creer')) { $error = 0; $object = new ExpenseReport($db); @@ -265,13 +265,13 @@ if (empty($reshook)) { } // Check that expense report is for a user inside the hierarchy, or that advanced permission for all is set - if ((!getDolGlobalString('MAIN_USE_ADVANCED_PERMS') && empty($user->rights->expensereport->creer)) - || (getDolGlobalString('MAIN_USE_ADVANCED_PERMS') && empty($user->rights->expensereport->creer) && empty($user->rights->expensereport->writeall_advance))) { + if ((!getDolGlobalString('MAIN_USE_ADVANCED_PERMS') && !$user->hasRight('expensereport', 'creer')) + || (getDolGlobalString('MAIN_USE_ADVANCED_PERMS') && !$user->hasRight('expensereport', 'creer') && !$user->hasRight('expensereport', 'writeall_advance'))) { $error++; setEventMessages($langs->trans("NotEnoughPermissions"), null, 'errors'); } if (!$error) { - if (!getDolGlobalString('MAIN_USE_ADVANCED_PERMS') || empty($user->rights->expensereport->writeall_advance)) { + if (!getDolGlobalString('MAIN_USE_ADVANCED_PERMS') || !$user->hasRight('expensereport', 'writeall_advance')) { if (!in_array($object->fk_user_author, $childids)) { $error++; setEventMessages($langs->trans("UserNotInHierachy"), null, 'errors'); @@ -325,7 +325,7 @@ if (empty($reshook)) { } } - if (($action == 'update' || $action == 'updateFromRefuse') && $user->rights->expensereport->creer) { + if (($action == 'update' || $action == 'updateFromRefuse') && $user->hasRight('expensereport', 'creer')) { $object = new ExpenseReport($db); $object->fetch($id); @@ -373,7 +373,7 @@ if (empty($reshook)) { } } - if ($action == "confirm_validate" && GETPOST("confirm", 'alpha') == "yes" && $id > 0 && $user->rights->expensereport->creer) { + if ($action == "confirm_validate" && GETPOST("confirm", 'alpha') == "yes" && $id > 0 && $user->hasRight('expensereport', 'creer')) { $error = 0; $db->begin(); @@ -488,7 +488,7 @@ if (empty($reshook)) { } } - if ($action == "confirm_save_from_refuse" && GETPOST("confirm", 'alpha') == "yes" && $id > 0 && $user->rights->expensereport->creer) { + if ($action == "confirm_save_from_refuse" && GETPOST("confirm", 'alpha') == "yes" && $id > 0 && $user->hasRight('expensereport', 'creer')) { $object = new ExpenseReport($db); $object->fetch($id); $result = $object->set_save_from_refuse($user); @@ -597,7 +597,7 @@ if (empty($reshook)) { } // Approve - if ($action == "confirm_approve" && GETPOST("confirm", 'alpha') == "yes" && $id > 0 && $user->rights->expensereport->approve) { + if ($action == "confirm_approve" && GETPOST("confirm", 'alpha') == "yes" && $id > 0 && $user->hasRight('expensereport', 'approve')) { $object = new ExpenseReport($db); $object->fetch($id); @@ -710,7 +710,7 @@ if (empty($reshook)) { } } - if ($action == "confirm_refuse" && GETPOST('confirm', 'alpha') == "yes" && $id > 0 && $user->rights->expensereport->approve) { + if ($action == "confirm_refuse" && GETPOST('confirm', 'alpha') == "yes" && $id > 0 && $user->hasRight('expensereport', 'approve')) { $object = new ExpenseReport($db); $object->fetch($id); @@ -820,7 +820,7 @@ if (empty($reshook)) { } //var_dump($user->id == $object->fk_user_validator);exit; - if ($action == "confirm_cancel" && GETPOST('confirm', 'alpha') == "yes" && $id > 0 && $user->rights->expensereport->creer) { + if ($action == "confirm_cancel" && GETPOST('confirm', 'alpha') == "yes" && $id > 0 && $user->hasRight('expensereport', 'creer')) { if (!GETPOST('detail_cancel', 'alpha')) { setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Comment")), null, 'errors'); } else { @@ -937,7 +937,7 @@ if (empty($reshook)) { } } - if ($action == "confirm_setdraft" && GETPOST('confirm', 'alpha') == "yes" && $id > 0 && $user->rights->expensereport->creer) { + if ($action == "confirm_setdraft" && GETPOST('confirm', 'alpha') == "yes" && $id > 0 && $user->hasRight('expensereport', 'creer')) { $object = new ExpenseReport($db); $object->fetch($id); if ($user->id == $object->fk_user_author || $user->id == $object->fk_user_valid) { @@ -976,7 +976,7 @@ if (empty($reshook)) { } } - if ($action == 'set_unpaid' && $id > 0 && $user->rights->expensereport->to_paid) { + if ($action == 'set_unpaid' && $id > 0 && $user->hasRight('expensereport', 'to_paid')) { $object = new ExpenseReport($db); $object->fetch($id); @@ -1005,7 +1005,7 @@ if (empty($reshook)) { } } - if ($action == 'set_paid' && $id > 0 && $user->rights->expensereport->to_paid) { + if ($action == 'set_paid' && $id > 0 && $user->hasRight('expensereport', 'to_paid')) { $object = new ExpenseReport($db); $object->fetch($id); @@ -1102,7 +1102,7 @@ if (empty($reshook)) { } } - if ($action == "addline" && $user->rights->expensereport->creer) { + if ($action == "addline" && $user->hasRight('expensereport', 'creer')) { $error = 0; // First save uploaded file @@ -1226,7 +1226,7 @@ if (empty($reshook)) { } } - if ($action == 'confirm_delete_line' && GETPOST("confirm", 'alpha') == "yes" && $user->rights->expensereport->creer) { + if ($action == 'confirm_delete_line' && GETPOST("confirm", 'alpha') == "yes" && $user->hasRight('expensereport', 'creer')) { $object = new ExpenseReport($db); $object->fetch($id); @@ -1266,7 +1266,7 @@ if (empty($reshook)) { } } - if ($action == "updateline" && $user->rights->expensereport->creer) { + if ($action == "updateline" && $user->hasRight('expensereport', 'creer')) { $object = new ExpenseReport($db); $object->fetch($id); @@ -1440,7 +1440,7 @@ if ($action == 'create') { $defaultselectuser = GETPOST('fk_user_author', 'int'); } $include_users = 'hierarchyme'; - if (getDolGlobalString('MAIN_USE_ADVANCED_PERMS') && !empty($user->rights->expensereport->writeall_advance)) { + if (getDolGlobalString('MAIN_USE_ADVANCED_PERMS') && $user->hasRight('expensereport', 'writeall_advance')) { $include_users = array(); } $s = $form->select_dolusers($defaultselectuser, "fk_user_author", 0, "", 0, $include_users, '', '0,'.$conf->entity); @@ -1525,8 +1525,8 @@ if ($action == 'create') { if ($result > 0) { if (!in_array($object->fk_user_author, $user->getAllChildIds(1))) { - if (empty($user->rights->expensereport->readall) && empty($user->rights->expensereport->lire_tous) - && (!getDolGlobalString('MAIN_USE_ADVANCED_PERMS') || empty($user->rights->expensereport->writeall_advance))) { + if (!$user->hasRight('expensereport', 'readall') && !$user->hasRight('expensereport', 'lire_tous') + && (!getDolGlobalString('MAIN_USE_ADVANCED_PERMS') || !$user->hasRight('expensereport', 'writeall_advance'))) { print load_fiche_titre($langs->trans('TripCard'), '', 'trip'); print '