diff --git a/htdocs/adherents/card.php b/htdocs/adherents/card.php index c47321dbf7c..66a75b0b804 100644 --- a/htdocs/adherents/card.php +++ b/htdocs/adherents/card.php @@ -98,14 +98,14 @@ if ($id > 0 || !empty($ref)) { $result = $object->fetch($id, $ref); // Define variables to know what current user can do on users - $canadduser = ($user->admin || $user->rights->user->user->creer); + $canadduser = ($user->admin || $user->hasRight('user', 'user', 'creer')); // Define variables to know what current user can do on properties of user linked to edited member if ($object->user_id) { // $User is the user who edits, $object->user_id is the id of the related user in the edited member - $caneditfielduser = ((($user->id == $object->user_id) && $user->rights->user->self->creer) - || (($user->id != $object->user_id) && $user->rights->user->user->creer)); - $caneditpassworduser = ((($user->id == $object->user_id) && $user->rights->user->self->password) - || (($user->id != $object->user_id) && $user->rights->user->user->password)); + $caneditfielduser = ((($user->id == $object->user_id) && $user->hasRight('user', 'self', 'creer')) + || (($user->id != $object->user_id) && $user->hasRight('user', 'user', 'creer'))); + $caneditpassworduser = ((($user->id == $object->user_id) && $user->hasRight('user', 'self', 'password')) + || (($user->id != $object->user_id) && $user->hasRight('user', 'user', 'password'))); } } @@ -154,9 +154,9 @@ if (empty($reshook)) { $action = ''; } - if ($action == 'setuserid' && ($user->rights->user->self->creer || $user->rights->user->user->creer)) { + if ($action == 'setuserid' && ($user->hasRight('user', 'self', 'creer') || $user->hasRight('user', 'user', 'creer'))) { $error = 0; - if (empty($user->rights->user->user->creer)) { // If can edit only itself user, we can link to itself only + if (empty($user->hasRight('user', 'user', 'creer'))) { // If can edit only itself user, we can link to itself only if ($userid != $user->id && $userid != $object->user_id) { $error++; setEventMessages($langs->trans("ErrorUserPermissionAllowsToLinksToItselfOnly"), null, 'errors'); @@ -206,7 +206,7 @@ if (empty($reshook)) { } // Create user from a member - if ($action == 'confirm_create_user' && $confirm == 'yes' && $user->rights->user->user->creer) { + if ($action == 'confirm_create_user' && $confirm == 'yes' && $user->hasRight('user', 'user', 'creer')) { if ($result > 0) { // Creation user $nuser = new User($db); @@ -230,7 +230,7 @@ if (empty($reshook)) { } // Create third party from a member - if ($action == 'confirm_create_thirdparty' && $confirm == 'yes' && $user->rights->societe->creer) { + if ($action == 'confirm_create_thirdparty' && $confirm == 'yes' && $user->hasRight('societe', 'creer')) { if ($result > 0) { // User creation $company = new Societe($db); @@ -617,7 +617,7 @@ if (empty($reshook)) { } } - if ($user->rights->adherent->supprimer && $action == 'confirm_delete' && $confirm == 'yes') { + if ($user->hasRight('adherent', 'supprimer') && $action == 'confirm_delete' && $confirm == 'yes') { $result = $object->delete($id, $user); if ($result > 0) { if (!empty($backtopage)) { @@ -706,7 +706,7 @@ if (empty($reshook)) { $action = ''; } - if ($user->rights->adherent->supprimer && $action == 'confirm_resiliate') { + if ($user->hasRight('adherent', 'supprimer') && $action == 'confirm_resiliate') { $error = 0; if ($confirm == 'yes') { @@ -777,7 +777,7 @@ if (empty($reshook)) { } } - if ($user->rights->adherent->supprimer && $action == 'confirm_exclude') { + if ($user->hasRight('adherent', 'supprimer') && $action == 'confirm_exclude') { $error = 0; if ($confirm == 'yes') { @@ -849,7 +849,7 @@ if (empty($reshook)) { } // SPIP Management - if ($user->rights->adherent->supprimer && $action == 'confirm_del_spip' && $confirm == 'yes') { + if ($user->hasRight('adherent', 'supprimer') && $action == 'confirm_del_spip' && $confirm == 'yes') { if (!count($object->errors)) { if (!$mailmanspip->del_to_spip($object)) { setEventMessages($langs->trans('DeleteIntoSpipError').': '.$mailmanspip->error, null, 'errors'); @@ -1118,7 +1118,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { print "\n"; // Categories - if (isModEnabled('categorie') && !empty($user->rights->categorie->lire)) { + if (isModEnabled('categorie') && $user->hasRight('categorie', 'lire')) { print ''.$form->editfieldkey("Categories", 'memcats', '', $object, 0).''; $cate_arbo = $form->select_all_categories(Categorie::TYPE_MEMBER, null, 'parent', null, null, 1); print img_picto('', 'category').$form->multiselectarray('memcats', $cate_arbo, GETPOST('memcats', 'array'), null, null, 'quatrevingtpercent widthcentpercentminusx', 0, 0); @@ -1367,7 +1367,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { print "\n"; // Categories - if (isModEnabled('categorie') && !empty($user->rights->categorie->lire)) { + if (isModEnabled('categorie') && $user->hasRight('categorie', 'lire')) { print ''.$form->editfieldkey("Categories", 'memcats', '', $object, 0).''; print ''; $cate_arbo = $form->select_all_categories(Categorie::TYPE_MEMBER, null, null, null, null, 1); @@ -1793,7 +1793,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { print ''; // Tags / Categories - if (isModEnabled('categorie') && !empty($user->rights->categorie->lire)) { + if (isModEnabled('categorie') && $user->hasRight('categorie', 'lire')) { print ''; print '"; diff --git a/htdocs/adherents/type_translation.php b/htdocs/adherents/type_translation.php index 33c93704b80..9539250cb44 100644 --- a/htdocs/adherents/type_translation.php +++ b/htdocs/adherents/type_translation.php @@ -190,7 +190,7 @@ print dol_get_fiche_end(); print "\n
\n"; if ($action == '') { - if ($user->rights->produit->creer || $user->rights->service->creer) { + if ($user->hasRight('produit', 'creer') || $user->hasRight('service', 'creer')) { print ''.$langs->trans("Add").''; if ($cnt_trans > 0) { print ''.$langs->trans("Update").''; @@ -271,7 +271,7 @@ if ($action == 'edit') { * Form to add a new translation */ -if ($action == 'create' && $user->rights->adherent->configurer) { +if ($action == 'create' && $user->hasRight('adherent', 'configurer')) { //WYSIWYG Editor require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; diff --git a/htdocs/admin/mails_templates.php b/htdocs/admin/mails_templates.php index 5a4eac7bcca..999bfecf562 100644 --- a/htdocs/admin/mails_templates.php +++ b/htdocs/admin/mails_templates.php @@ -366,7 +366,7 @@ if (empty($reshook)) { // List of values $i = 0; foreach ($listfieldinsert as $f => $value) { - $keycode = $listfieldvalue[$i]; + $keycode = isset($listfieldvalue[$i]) ? $listfieldvalue[$i] : ""; if ($value == 'lang') { $keycode = 'langcode'; } diff --git a/htdocs/core/boxes/box_birthdays_members.php b/htdocs/core/boxes/box_birthdays_members.php index df8e51f348f..fc8dc4c6745 100644 --- a/htdocs/core/boxes/box_birthdays_members.php +++ b/htdocs/core/boxes/box_birthdays_members.php @@ -60,7 +60,7 @@ class box_birthdays_members extends ModeleBoxes $this->db = $db; - $this->hidden = !($user->rights->adherent->lire && empty($user->socid)); + $this->hidden = !($user->hasRight("adherent", "lire") && empty($user->socid)); } /** diff --git a/htdocs/core/boxes/box_dolibarr_state_board.php b/htdocs/core/boxes/box_dolibarr_state_board.php index 0f63582370c..9a2e94b8a1d 100644 --- a/htdocs/core/boxes/box_dolibarr_state_board.php +++ b/htdocs/core/boxes/box_dolibarr_state_board.php @@ -113,12 +113,12 @@ class box_dolibarr_state_board extends ModeleBoxes ); $conditions = array( 'users' => $user->hasRight('user', 'user', 'lire'), - 'members' => isModEnabled('adherent') && $user->rights->adherent->lire, + 'members' => isModEnabled('adherent') && $user->hasRight('adherent', 'lire'), 'customers' => isModEnabled('societe') && $user->hasRight('societe', 'lire') && empty($conf->global->SOCIETE_DISABLE_CUSTOMERS) && empty($conf->global->SOCIETE_DISABLE_CUSTOMERS_STATS), 'prospects' => isModEnabled('societe') && $user->hasRight('societe', 'lire') && empty($conf->global->SOCIETE_DISABLE_PROSPECTS) && empty($conf->global->SOCIETE_DISABLE_PROSPECTS_STATS), - 'suppliers' => ((isModEnabled("fournisseur") && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) && $user->rights->fournisseur->lire) - || (isModEnabled("supplier_order") && $user->rights->supplier_order->lire) - || (isModEnabled("supplier_invoice") && $user->rights->supplier_invoice->lire) + 'suppliers' => ((isModEnabled("fournisseur") && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) && $user->hasRight('fournisseur', 'lire')) + || (isModEnabled("supplier_order") && $user->hasRight('supplier_order', 'lire')) + || (isModEnabled("supplier_invoice") && $user->hasRight('supplier_invoice', 'lire')) ) && empty($conf->global->SOCIETE_DISABLE_SUPPLIERS_STATS), 'contacts' => isModEnabled('societe') && $user->hasRight('societe', 'contact', 'lire'), @@ -130,9 +130,9 @@ class box_dolibarr_state_board extends ModeleBoxes 'donations' => isModEnabled('don') && $user->hasRight('don', 'lire'), 'contracts' => isModEnabled('contrat') && $user->hasRight('contrat', 'lire'), 'interventions' => isModEnabled('ficheinter') && $user->hasRight('ficheinter', 'lire'), - 'supplier_orders' => isModEnabled('supplier_order') && $user->rights->fournisseur->commande->lire && empty($conf->global->SOCIETE_DISABLE_SUPPLIERS_ORDERS_STATS), - 'supplier_invoices' => isModEnabled('supplier_invoice') && $user->rights->fournisseur->facture->lire && empty($conf->global->SOCIETE_DISABLE_SUPPLIERS_INVOICES_STATS), - 'supplier_proposals' => isModEnabled('supplier_proposal') && $user->rights->supplier_proposal->lire && empty($conf->global->SOCIETE_DISABLE_SUPPLIERS_PROPOSAL_STATS), + 'supplier_orders' => isModEnabled('supplier_order') && $user->hasRight('fournisseur', 'commande', 'lire') && empty($conf->global->SOCIETE_DISABLE_SUPPLIERS_ORDERS_STATS), + 'supplier_invoices' => isModEnabled('supplier_invoice') && $user->hasRight('fournisseur', 'facture', 'lire') && empty($conf->global->SOCIETE_DISABLE_SUPPLIERS_INVOICES_STATS), + 'supplier_proposals' => isModEnabled('supplier_proposal') && $user->hasRight('supplier_proposal', 'lire') && empty($conf->global->SOCIETE_DISABLE_SUPPLIERS_PROPOSAL_STATS), 'projects' => isModEnabled('project') && $user->hasRight('projet', 'lire'), 'expensereports' => isModEnabled('expensereport') && $user->hasRight('expensereport', 'lire'), 'holidays' => isModEnabled('holiday') && $user->hasRight('holiday', 'read'), diff --git a/htdocs/core/boxes/box_graph_new_vs_close_ticket.php b/htdocs/core/boxes/box_graph_new_vs_close_ticket.php index 435cc76451e..e07fc4d3ba0 100644 --- a/htdocs/core/boxes/box_graph_new_vs_close_ticket.php +++ b/htdocs/core/boxes/box_graph_new_vs_close_ticket.php @@ -85,7 +85,7 @@ class box_graph_new_vs_close_ticket extends ModeleBoxes 'limit' => dol_strlen($text) ); - if ($user->rights->ticket->read) { + if ($user->hasRight('ticket', 'read')) { $data = array(); $totalnb = 0; $sql = "SELECT COUNT(t.datec) as nb"; diff --git a/htdocs/core/boxes/box_graph_ticket_by_severity.php b/htdocs/core/boxes/box_graph_ticket_by_severity.php index c668894d991..b20a72e528c 100644 --- a/htdocs/core/boxes/box_graph_ticket_by_severity.php +++ b/htdocs/core/boxes/box_graph_ticket_by_severity.php @@ -99,7 +99,7 @@ class box_graph_ticket_by_severity extends ModeleBoxes $listofopplabel = array(); $listofoppcode = array(); $colorseriesstat = array(); - if ($user->rights->ticket->read) { + if ($user->hasRight('ticket', 'read')) { $sql = "SELECT cts.rowid, cts.label, cts.code"; $sql .= " FROM " . MAIN_DB_PREFIX . "c_ticket_severity as cts"; $sql .= " WHERE cts.active = 1"; diff --git a/htdocs/core/boxes/box_last_modified_ticket.php b/htdocs/core/boxes/box_last_modified_ticket.php index 311f76e5011..2813a7c3d5b 100644 --- a/htdocs/core/boxes/box_last_modified_ticket.php +++ b/htdocs/core/boxes/box_last_modified_ticket.php @@ -84,7 +84,7 @@ class box_last_modified_ticket extends ModeleBoxes 'text' => $langs->trans("BoxLastModifiedTicketContent"), ); - if ($user->rights->ticket->read) { + if ($user->hasRight('ticket', 'read')) { $sql = "SELECT t.rowid as id, t.ref, t.track_id, t.fk_soc, t.fk_user_create, t.fk_user_assign, t.subject, t.message, t.fk_statut, t.type_code, t.category_code, t.severity_code, t.datec, t.tms as datem, t.date_read, t.date_close, t.origin_email "; $sql .= ", type.label as type_label, category.label as category_label, severity.label as severity_label"; $sql .= ", s.nom as company_name, s.email as socemail, s.client, s.fournisseur"; diff --git a/htdocs/cron/class/cronjob.class.php b/htdocs/cron/class/cronjob.class.php index 8f4b32ae502..d26c83f4772 100644 --- a/htdocs/cron/class/cronjob.class.php +++ b/htdocs/cron/class/cronjob.class.php @@ -1262,13 +1262,13 @@ class Cronjob extends CommonObject dol_syslog(get_class($this)."::run_jobs END result=".$result." error=".$errmsg, LOG_ERR); $this->error = $errmsg; - $this->lastoutput = ($object->output ? $object->output."\n" : "").$errmsg; + $this->lastoutput = (!empty($object->output) ? $object->output."\n" : "").$errmsg; $this->lastresult = is_numeric($result) ? $result : -1; $retval = $this->lastresult; $error++; } else { dol_syslog(get_class($this)."::run_jobs END"); - $this->lastoutput = $object->output; + $this->lastoutput = (!empty($object->output) ? $object->output : ""); $this->lastresult = var_export($result, true); $retval = $this->lastresult; } diff --git a/htdocs/hrm/index.php b/htdocs/hrm/index.php index 05967606a8e..d81044d4a23 100644 --- a/htdocs/hrm/index.php +++ b/htdocs/hrm/index.php @@ -187,7 +187,7 @@ print '
'; // Latest leave requests -if (isModEnabled('holiday') && $user->rights->holiday->read) { +if (isModEnabled('holiday') && $user->hasRight('holiday', 'read')) { $sql = "SELECT u.rowid as uid, u.lastname, u.firstname, u.login, u.email, u.photo, u.statut as user_status,"; $sql .= " x.rowid, x.ref, x.fk_type, x.date_debut as date_start, x.date_fin as date_end, x.halfday, x.tms as dm, x.statut as status"; $sql .= " FROM ".MAIN_DB_PREFIX."holiday as x, ".MAIN_DB_PREFIX."user as u"; diff --git a/htdocs/hrm/skill_tab.php b/htdocs/hrm/skill_tab.php index d479a843776..1682d304fbb 100644 --- a/htdocs/hrm/skill_tab.php +++ b/htdocs/hrm/skill_tab.php @@ -74,8 +74,8 @@ $hookmanager->initHooks(array('skilltab', 'globalcard')); // Note that conf->hoo include DOL_DOCUMENT_ROOT . '/core/actions_fetchobject.inc.php'; // Must be include, not include_once. // Permissions -$permissiontoread = $user->rights->hrm->all->read; -$permissiontoadd = $user->rights->hrm->all->write; // Used by the include of actions_addupdatedelete.inc.php and actions_lineupdown.inc.php +$permissiontoread = $user->hasRight('hrm', 'all', 'read'); +$permissiontoadd = $user->hasRight('hrm', 'all', 'write'); // Used by the include of actions_addupdatedelete.inc.php and actions_lineupdown.inc.php // Security check (enable the most restrictive one) if ($user->socid > 0) accessforbidden(); diff --git a/htdocs/public/partnership/new.php b/htdocs/public/partnership/new.php index 68e9034a761..5064ec68695 100644 --- a/htdocs/public/partnership/new.php +++ b/htdocs/public/partnership/new.php @@ -502,7 +502,7 @@ if (empty($reshook) && $action == 'added') { $form = new Form($db); $formcompany = new FormCompany($db); -$extrafields->fetch_name_optionals_label($partnership->table_element); // fetch optionals attributes and labels +$extrafields->fetch_name_optionals_label($object->table_element); // fetch optionals attributes and labels llxHeaderVierge($langs->trans("NewPartnershipRequest")); @@ -518,7 +518,7 @@ print '
'; if (!empty($conf->global->PARTNERSHIP_NEWFORM_TEXT)) { print $langs->trans($conf->global->PARTNERSHIP_NEWFORM_TEXT)."
\n"; } else { - print $langs->trans("NewPartnershipRequestDesc", $conf->global->MAIN_INFO_SOCIETE_MAIL)."
\n"; + print $langs->trans("NewPartnershipRequestDesc", getDolGlobalString("MAIN_INFO_SOCIETE_MAIL"))."
\n"; } print '
'; diff --git a/htdocs/public/recruitment/index.php b/htdocs/public/recruitment/index.php index bb135d54d50..23a180b9a7b 100644 --- a/htdocs/public/recruitment/index.php +++ b/htdocs/public/recruitment/index.php @@ -171,6 +171,7 @@ if (!empty($conf->global->RECRUITMENT_IMAGE_PUBLIC_INTERFACE)) { $results = $object->fetchAll($sortfield, $sortorder, 0, 0, array('status' => 1)); +$now = dol_now(); if (is_array($results)) { if (empty($results)) {
'.$langs->trans("Categories").''; print $form->showCategories($object->id, Categorie::TYPE_MEMBER, 1); @@ -1862,7 +1862,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { // Login Dolibarr - Link to user print '
'; - $editenable = $user->hasRight('adherent', 'creer') && $user->rights->user->user->creer; + $editenable = $user->hasRight('adherent', 'creer') && $user->hasRight('user', 'user', 'creer'); print $form->editfieldkey('LinkedToDolibarrUser', 'login', '', $object, $editenable); print ''; if ($action == 'editlogin') { @@ -1944,7 +1944,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { // Resiliate if (Adherent::STATUS_VALIDATED == $object->statut) { - if ($user->rights->adherent->supprimer) { + if ($user->hasRight('adherent', 'supprimer')) { print ''.$langs->trans("Resiliate")."\n"; } else { print ''.$langs->trans("Resiliate").''."\n"; @@ -1953,7 +1953,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { // Exclude if (Adherent::STATUS_VALIDATED == $object->statut) { - if ($user->rights->adherent->supprimer) { + if ($user->hasRight('adherent', 'supprimer')) { print ''.$langs->trans("Exclude")."\n"; } else { print ''.$langs->trans("Exclude").''."\n"; @@ -1962,7 +1962,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { // Create third party if (isModEnabled('societe') && !$object->socid) { - if ($user->rights->societe->creer) { + if ($user->hasRight('societe', 'creer')) { if (Adherent::STATUS_DRAFT != $object->statut) { print ''.$langs->trans("CreateDolibarrThirdParty").''."\n"; } else { @@ -1975,7 +1975,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { // Create user if (!$user->socid && !$object->user_id) { - if ($user->rights->user->user->creer) { + if ($user->hasRight('user', 'user', 'creer')) { if (Adherent::STATUS_DRAFT != $object->statut) { print ''.$langs->trans("CreateDolibarrLogin").''."\n"; } else { @@ -1999,7 +1999,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { } // Delete - if ($user->rights->adherent->supprimer) { + if ($user->hasRight('adherent', 'supprimer')) { print ''.$langs->trans("Delete").''."\n"; } else { print ''.$langs->trans("Delete").''."\n"; @@ -2026,7 +2026,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { $filename = dol_sanitizeFileName($object->ref); $filedir = $conf->adherent->dir_output.'/'.get_exdir(0, 0, 0, 1, $object, 'member'); $urlsource = $_SERVER['PHP_SELF'].'?id='.$object->id; - $genallowed = $user->rights->adherent->lire; + $genallowed = $user->hasRight('adherent', 'lire'); $delallowed = $user->hasRight('adherent', 'creer'); print $formfile->showdocuments('member', $filename, $filedir, $urlsource, $genallowed, $delallowed, $object->model_pdf, 1, 0, 0, 28, 0, '', '', '', (empty($object->default_lang) ? '' : $object->default_lang), '', $object); diff --git a/htdocs/adherents/document.php b/htdocs/adherents/document.php index 37d6e72a97e..4517bee15c6 100644 --- a/htdocs/adherents/document.php +++ b/htdocs/adherents/document.php @@ -76,14 +76,14 @@ if ($id > 0 || !empty($ref)) { $result = $object->fetch($id, $ref); // Define variables to know what current user can do on users - $canadduser = ($user->admin || $user->rights->user->user->creer); + $canadduser = ($user->admin || $user->hasRight('user', 'user', 'creer')); // Define variables to know what current user can do on properties of user linked to edited member if ($object->user_id) { // $User is the user who edits, $object->user_id is the id of the related user in the edited member - $caneditfielduser = ((($user->id == $object->user_id) && $user->rights->user->self->creer) - || (($user->id != $object->user_id) && $user->rights->user->user->creer)); - $caneditpassworduser = ((($user->id == $object->user_id) && $user->rights->user->self->password) - || (($user->id != $object->user_id) && $user->rights->user->user->password)); + $caneditfielduser = ((($user->id == $object->user_id) && $$user->hasRight('user', 'self', 'creer')) + || (($user->id != $object->user_id) && $user->hasRight('user', 'user', 'creer'))); + $caneditpassworduser = ((($user->id == $object->user_id) && $user->hasRight('user', 'self', 'password')) + || (($user->id != $object->user_id) && $user->hasRight('user', 'user', 'password'))); } } diff --git a/htdocs/adherents/list.php b/htdocs/adherents/list.php index 394a650d7ee..2e54ed03db8 100644 --- a/htdocs/adherents/list.php +++ b/htdocs/adherents/list.php @@ -300,8 +300,8 @@ if (empty($reshook)) { // Mass actions $objectclass = 'Adherent'; $objectlabel = 'Members'; - $permissiontoread = $user->rights->adherent->lire; - $permissiontodelete = $user->rights->adherent->supprimer; + $permissiontoread = $user->hasRight('adherent', 'lire'); + $permissiontodelete = $user->hasRight('adherent', 'supprimer'); $permissiontoadd = $user->hasRight('adherent', 'creer'); $uploaddir = $conf->adherent->dir_output; include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php'; @@ -614,13 +614,13 @@ $arrayofmassactions = array( if ($user->hasRight('adherent', 'creer')) { $arrayofmassactions['close'] = img_picto('', 'close_title', 'class="pictofixedwidth"').$langs->trans("Resiliate"); } -if ($user->rights->adherent->supprimer) { +if ($user->hasRight('adherent', 'supprimer')) { $arrayofmassactions['predelete'] = img_picto('', 'delete', 'class="pictofixedwidth"').$langs->trans("Delete"); } -if (isModEnabled('category') && $user->rights->adherent->creer) { +if (isModEnabled('category') && $user->hasRight('adherent', 'creer')) { $arrayofmassactions['preaffecttag'] = img_picto('', 'category', 'class="pictofixedwidth"').$langs->trans("AffectTag"); } -if ($user->hasRight('adherent', 'creer') && $user->rights->user->user->creer) { +if ($user->hasRight('adherent', 'creer') && $user->hasRight('user', 'user', 'creer')) { $arrayofmassactions['createexternaluser'] = img_picto('', 'user', 'class="pictofixedwidth"').$langs->trans("CreateExternalUser"); } if (GETPOST('nomassaction', 'int') || in_array($massaction, array('presend', 'predelete', 'preaffecttag'))) { @@ -661,7 +661,7 @@ if ($sall) { // Filter on categories $moreforfilter = ''; -if (isModEnabled('categorie') && $user->rights->categorie->lire) { +if (isModEnabled('categorie') && $user->hasRight('categorie', 'lire')) { require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; $moreforfilter .= '
'; $moreforfilter .= img_picto($langs->trans('Categories'), 'category', 'class="pictofixedlength"').$formother->select_categories(Categorie::TYPE_MEMBER, $search_categ, 'search_categ', 1, $langs->trans("MembersCategoriesShort")); diff --git a/htdocs/adherents/note.php b/htdocs/adherents/note.php index 938ab368ae1..4d3bc4dd638 100644 --- a/htdocs/adherents/note.php +++ b/htdocs/adherents/note.php @@ -59,14 +59,14 @@ if ($id > 0 || !empty($ref)) { $result = $object->fetch($id, $ref); // Define variables to know what current user can do on users - $canadduser = ($user->admin || $user->rights->user->user->creer); + $canadduser = ($user->admin || $user->hasRight('user', 'user', 'creer')); // Define variables to know what current user can do on properties of user linked to edited member if ($object->user_id) { // $User is the user who edits, $object->user_id is the id of the related user in the edited member - $caneditfielduser = ((($user->id == $object->user_id) && $user->rights->user->self->creer) - || (($user->id != $object->user_id) && $user->rights->user->user->creer)); - $caneditpassworduser = ((($user->id == $object->user_id) && $user->rights->user->self->password) - || (($user->id != $object->user_id) && $user->rights->user->user->password)); + $caneditfielduser = ((($user->id == $object->user_id) && $user->hasRight('user', 'self', 'creer')) + || (($user->id != $object->user_id) && $user->hasRight('user', 'user', 'creer'))); + $caneditpassworduser = ((($user->id == $object->user_id) && $user->hasRight('user', 'self', 'password')) + || (($user->id != $object->user_id) && $user->hasRight('user', 'user', 'password'))); } } diff --git a/htdocs/adherents/type.php b/htdocs/adherents/type.php index fcdb643a006..257e7266e5a 100644 --- a/htdocs/adherents/type.php +++ b/htdocs/adherents/type.php @@ -118,7 +118,7 @@ if ($cancel) { } } -if ($action == 'add' && $user->rights->adherent->configurer) { +if ($action == 'add' && $user->hasRight('adherent', 'configurer')) { $object->label = trim($label); $object->morphy = trim($morphy); $object->status = (int) $status; @@ -505,19 +505,19 @@ if ($rowid > 0) { print '
'; // Edit - if ($user->rights->adherent->configurer) { + if ($user->hasRight('adherent', 'configurer')) { print ''; } // Add - if ($user->rights->adherent->configurer && !empty($object->status)) { + if ($user->hasRight('adherent', 'configurer')&& !empty($object->status)) { print ''; } else { print ''; } // Delete - if ($user->rights->adherent->configurer) { + if ($user->hasRight('adherent', 'configurer')) { print ''; } @@ -758,7 +758,7 @@ if ($rowid > 0) { if ($user->hasRight('adherent', 'creer')) { print ''.img_edit().''; } - if ($user->rights->adherent->supprimer) { + if ($user->hasRight('adherent', 'supprimer')) { print ''.img_picto($langs->trans("Resiliate"), 'disable.png').''; } print "