diff --git a/htdocs/adherents/agenda.php b/htdocs/adherents/agenda.php index 867f4f47025..90f36033f71 100644 --- a/htdocs/adherents/agenda.php +++ b/htdocs/adherents/agenda.php @@ -173,7 +173,7 @@ if ($object->id > 0) { $newcardbutton .= dolGetButtonTitle($langs->trans('AddAction'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/comm/action/card.php?action=create&backtopage='.urlencode($_SERVER['PHP_SELF']).($object->id > 0 ? '?id='.$object->id : '').'&origin=member&originid='.$id); } - if (isModEnabled('agenda') && (!empty($user->rights->agenda->myactions->read) || !empty($user->rights->agenda->allactions->read))) { + if (isModEnabled('agenda') && ($user->hasRight('agenda', 'myactions', 'read') || $user->hasRight('agenda', 'allactions', 'read'))) { print '
'; $param = '&id='.$id; diff --git a/htdocs/asset/agenda.php b/htdocs/asset/agenda.php index ef9afa10458..11c956d8d59 100644 --- a/htdocs/asset/agenda.php +++ b/htdocs/asset/agenda.php @@ -182,7 +182,7 @@ if ($object->id > 0) { print '
'; if (isModEnabled('agenda')) { - if (!empty($user->rights->agenda->myactions->create) || $user->hasRight('agenda', 'allactions', 'create')) { + if ($user->hasRight('agenda', 'myactions', 'create') || $user->hasRight('agenda', 'allactions', 'create')) { print '' . $langs->trans("AddAction") . ''; } else { print '' . $langs->trans("AddAction") . ''; @@ -191,7 +191,7 @@ if ($object->id > 0) { print '
'; - if (isModEnabled('agenda') && (!empty($user->rights->agenda->myactions->read) || !empty($user->rights->agenda->allactions->read))) { + if (isModEnabled('agenda') && ($user->hasRight('agenda', 'myactions', 'read') || $user->hasRight('agenda', 'allactions', 'read'))) { $param = '&id=' . $object->id . '&socid=' . $socid; if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) { $param .= '&contextpage=' . urlencode($contextpage); diff --git a/htdocs/asset/model/agenda.php b/htdocs/asset/model/agenda.php index 31c49d5e40f..42296c51914 100644 --- a/htdocs/asset/model/agenda.php +++ b/htdocs/asset/model/agenda.php @@ -184,7 +184,7 @@ if ($object->id > 0) { print '
'; // if (isModEnabled('agenda')) { - // if (!empty($user->rights->agenda->myactions->create) || $user->hasRight('agenda', 'allactions', 'create')) { + // if ($user->hasRight('agenda', 'myactions', 'create') || $user->hasRight('agenda', 'allactions', 'create')) { // print '' . $langs->trans("AddAction") . ''; // } else { // print '' . $langs->trans("AddAction") . ''; @@ -193,7 +193,7 @@ if ($object->id > 0) { print '
'; - // if (isModEnabled('agenda') && (!empty($user->rights->agenda->myactions->read) || !empty($user->rights->agenda->allactions->read))) { + // if (isModEnabled('agenda') && ($user->hasRight('agenda', 'myactions', 'read') || $user->hasRight('agenda', 'allactions', 'read'))) { // $param = '&id=' . $object->id . '&socid=' . $socid; // if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) { // $param .= '&contextpage=' . urlencode($contextpage); diff --git a/htdocs/bom/bom_agenda.php b/htdocs/bom/bom_agenda.php index 5e25d788ac7..a03c391ff06 100644 --- a/htdocs/bom/bom_agenda.php +++ b/htdocs/bom/bom_agenda.php @@ -226,7 +226,7 @@ if ($object->id > 0) { print '
'; if (isModEnabled('agenda')) { - if (!empty($user->rights->agenda->myactions->create) || $user->hasRight('agenda', 'allactions', 'create')) { + if ($user->hasRight('agenda', 'myactions', 'create') || $user->hasRight('agenda', 'allactions', 'create')) { print ''.$langs->trans("AddAction").''; } else { print ''.$langs->trans("AddAction").''; @@ -235,7 +235,7 @@ if ($object->id > 0) { print '
'; - if (isModEnabled('agenda') && (!empty($user->rights->agenda->myactions->read) || !empty($user->rights->agenda->allactions->read))) { + if (isModEnabled('agenda') && ($user->hasRight('agenda', 'myactions', 'read') || $user->hasRight('agenda', 'allactions', 'read'))) { $param = '&id='.$object->id.'&socid='.$socid; if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) { $param .= '&contextpage='.urlencode($contextpage); diff --git a/htdocs/bookcal/availabilities_agenda.php b/htdocs/bookcal/availabilities_agenda.php index f21d88fa02a..d3e7aa1a3a8 100644 --- a/htdocs/bookcal/availabilities_agenda.php +++ b/htdocs/bookcal/availabilities_agenda.php @@ -232,7 +232,7 @@ if ($object->id > 0) { print '
'; if (isModEnabled('agenda')) { - if (!empty($user->rights->agenda->myactions->create) || $user->hasRight('agenda', 'allactions', 'create')) { + if ($user->hasRight('agenda', 'myactions', 'create') || $user->hasRight('agenda', 'allactions', 'create')) { print ''.$langs->trans("AddAction").''; } else { print ''.$langs->trans("AddAction").''; @@ -241,7 +241,7 @@ if ($object->id > 0) { print '
'; - if (isModEnabled('agenda') && (!empty($user->rights->agenda->myactions->read) || !empty($user->rights->agenda->allactions->read))) { + if (isModEnabled('agenda') && ($user->hasRight('agenda', 'myactions', 'read') || $user->hasRight('agenda', 'allactions', 'read'))) { $param = '&id='.$object->id.(!empty($socid) ? '&socid='.$socid : ''); if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) { $param .= '&contextpage='.urlencode($contextpage); diff --git a/htdocs/bookcal/booking_agenda.php b/htdocs/bookcal/booking_agenda.php index da4c9936860..7fc3c68e105 100644 --- a/htdocs/bookcal/booking_agenda.php +++ b/htdocs/bookcal/booking_agenda.php @@ -232,7 +232,7 @@ if ($object->id > 0) { print '
'; if (isModEnabled('agenda')) { - if (!empty($user->rights->agenda->myactions->create) || $user->hasRight('agenda', 'allactions', 'create')) { + if ($user->hasRight('agenda', 'myactions', 'create') || $user->hasRight('agenda', 'allactions', 'create')) { print ''.$langs->trans("AddAction").''; } else { print ''.$langs->trans("AddAction").''; @@ -241,7 +241,7 @@ if ($object->id > 0) { print '
'; - if (isModEnabled('agenda') && (!empty($user->rights->agenda->myactions->read) || !empty($user->rights->agenda->allactions->read))) { + if (isModEnabled('agenda') && ($user->hasRight('agenda', 'myactions', 'read') || $user->hasRight('agenda', 'allactions', 'read'))) { $param = '&id='.$object->id.(!empty($socid) ? '&socid='.$socid : ''); if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) { $param .= '&contextpage='.urlencode($contextpage); diff --git a/htdocs/comm/action/class/actioncomm.class.php b/htdocs/comm/action/class/actioncomm.class.php index ab26ed88105..1fb0054b05c 100644 --- a/htdocs/comm/action/class/actioncomm.class.php +++ b/htdocs/comm/action/class/actioncomm.class.php @@ -1669,10 +1669,10 @@ class ActionComm extends CommonObject if ($user->hasRight('agenda', 'myactions', 'read') && ($this->authorid == $user->id || $this->userownerid == $user->id)) { $canread = 1; // Can read my event } - if (!empty($user->rights->agenda->myactions->read) && array_key_exists($user->id, $this->userassigned)) { + if ($user->hasRight('agenda', 'myactions', 'read') && array_key_exists($user->id, $this->userassigned)) { $canread = 1; // Can read my event i am assigned } - if (!empty($user->rights->agenda->allactions->read)) { + if ($user->hasRight('agenda', 'allactions', 'read')) { $canread = 1; // Can read all event of other } if (!$canread) { diff --git a/htdocs/comm/propal/agenda.php b/htdocs/comm/propal/agenda.php index c679fd267da..97cb9584aaf 100644 --- a/htdocs/comm/propal/agenda.php +++ b/htdocs/comm/propal/agenda.php @@ -222,7 +222,7 @@ if ($object->id > 0) { } - if (isModEnabled('agenda') && (!empty($user->rights->agenda->myactions->read) || !empty($user->rights->agenda->allactions->read))) { + if (isModEnabled('agenda') && ($user->hasRight('agenda', 'myactions', 'read') || $user->hasRight('agenda', 'allactions', 'read'))) { print '
'; $param = '&id='.$object->id.(!empty($socid) ? '&socid='.$socid : ''); diff --git a/htdocs/commande/agenda.php b/htdocs/commande/agenda.php index 0cb944afa63..54f03545675 100644 --- a/htdocs/commande/agenda.php +++ b/htdocs/commande/agenda.php @@ -222,7 +222,7 @@ if ($object->id > 0) { } - if (isModEnabled('agenda') && (!empty($user->rights->agenda->myactions->read) || !empty($user->rights->agenda->allactions->read))) { + if (isModEnabled('agenda') && ($user->hasRight('agenda', 'myactions', 'read') || $user->hasRight('agenda', 'allactions', 'read'))) { print '
'; $param = '&id='.$object->id.(!empty($socid) ? '&socid='.$socid : ''); diff --git a/htdocs/compta/facture/agenda.php b/htdocs/compta/facture/agenda.php index 2442f9ce662..2f6075fbd52 100644 --- a/htdocs/compta/facture/agenda.php +++ b/htdocs/compta/facture/agenda.php @@ -222,7 +222,7 @@ if ($object->id > 0) { } - if (isModEnabled('agenda') && (!empty($user->rights->agenda->myactions->read) || !empty($user->rights->agenda->allactions->read))) { + if (isModEnabled('agenda') && ($user->hasRight('agenda', 'myactions', 'read') || $user->hasRight('agenda', 'allactions', 'read'))) { print '
'; $param = '&id='.$object->id.(!empty($socid) ? '&socid='.$socid : ''); diff --git a/htdocs/contact/agenda.php b/htdocs/contact/agenda.php index f4cfeaa38cd..8dd16a3f3e2 100644 --- a/htdocs/contact/agenda.php +++ b/htdocs/contact/agenda.php @@ -266,12 +266,12 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { $out .= '&datep='.urlencode(dol_print_date(dol_now(), 'dayhourlog')); } - if (!empty($user->rights->agenda->myactions->create) || $user->hasRight('agenda', 'allactions', 'create')) { + if ($user->hasRight('agenda', 'myactions', 'create') || $user->hasRight('agenda', 'allactions', 'create')) { $newcardbutton .= dolGetButtonTitle($langs->trans('AddAction'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/comm/action/card.php?action=create'.$out); } } - if (isModEnabled('agenda') && (!empty($user->rights->agenda->myactions->read) || !empty($user->rights->agenda->allactions->read))) { + if (isModEnabled('agenda') && ($user->hasRight('agenda', 'myactions', 'read') || $user->hasRight('agenda', 'allactions', 'read'))) { print '
'; $param = '&id='.$id; diff --git a/htdocs/contrat/agenda.php b/htdocs/contrat/agenda.php index 4984e940bad..8d99e953d8f 100644 --- a/htdocs/contrat/agenda.php +++ b/htdocs/contrat/agenda.php @@ -244,14 +244,14 @@ if ($object->id > 0) { $newcardbutton = ''; if (isModEnabled('agenda')) { - if (!empty($user->rights->agenda->myactions->create) || $user->hasRight('agenda', 'allactions', 'create')) { + if ($user->hasRight('agenda', 'myactions', 'create') || $user->hasRight('agenda', 'allactions', 'create')) { $backtopage = $_SERVER['PHP_SELF'].'?id='.$object->id; $out = '&origin='.$object->element.'&originid='.$object->id.'&backtopage='.urlencode($backtopage); $newcardbutton .= dolGetButtonTitle($langs->trans('AddAction'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/comm/action/card.php?action=create'.$out); } } - if (isModEnabled('agenda') && (!empty($user->rights->agenda->myactions->read) || !empty($user->rights->agenda->allactions->read))) { + if (isModEnabled('agenda') && ($user->hasRight('agenda', 'myactions', 'read') || $user->hasRight('agenda', 'allactions', 'read'))) { print '
'; $param = '&id='.$object->id; diff --git a/htdocs/core/lib/company.lib.php b/htdocs/core/lib/company.lib.php index 46f4bdf4b2f..6a29b0e7afe 100644 --- a/htdocs/core/lib/company.lib.php +++ b/htdocs/core/lib/company.lib.php @@ -375,7 +375,7 @@ function societe_prepare_head(Societe $object) $head[$h][0] = DOL_URL_ROOT.'/societe/agenda.php?socid='.$object->id; $head[$h][1] = $langs->trans("Events"); - if (isModEnabled('agenda')&& (!empty($user->rights->agenda->myactions->read) || !empty($user->rights->agenda->allactions->read))) { + if (isModEnabled('agenda')&& ($user->hasRight('agenda', 'myactions', 'read') || $user->hasRight('agenda', 'allactions', 'read'))) { $nbEvent = 0; // Enable caching of thirdparty count actioncomm require_once DOL_DOCUMENT_ROOT.'/core/lib/memory.lib.php'; diff --git a/htdocs/core/lib/contact.lib.php b/htdocs/core/lib/contact.lib.php index e864060bc25..088504fbde4 100644 --- a/htdocs/core/lib/contact.lib.php +++ b/htdocs/core/lib/contact.lib.php @@ -134,7 +134,7 @@ function contact_prepare_head(Contact $object) // Agenda / Events $head[$tab][0] = DOL_URL_ROOT.'/contact/agenda.php?id='.$object->id; $head[$tab][1] = $langs->trans("Events"); - if (isModEnabled('agenda') && (!empty($user->rights->agenda->myactions->read) || !empty($user->rights->agenda->allactions->read))) { + if (isModEnabled('agenda') && ($user->hasRight('agenda', 'myactions', 'read') || $user->hasRight('agenda', 'allactions', 'read'))) { $head[$tab][1] .= '/'; $head[$tab][1] .= $langs->trans("Agenda"); } diff --git a/htdocs/core/lib/contract.lib.php b/htdocs/core/lib/contract.lib.php index 152c18b59d2..75ffdbf9a7c 100644 --- a/htdocs/core/lib/contract.lib.php +++ b/htdocs/core/lib/contract.lib.php @@ -90,7 +90,7 @@ function contract_prepare_head(Contrat $object) $head[$h][0] = DOL_URL_ROOT.'/contrat/agenda.php?id='.$object->id; $head[$h][1] = $langs->trans("Events"); - if (isModEnabled('agenda')&& (!empty($user->rights->agenda->myactions->read) || !empty($user->rights->agenda->allactions->read))) { + if (isModEnabled('agenda')&& ($user->hasRight('agenda', 'myactions', 'read') || $user->hasRight('agenda', 'allactions', 'read'))) { $nbEvent = 0; // Enable caching of thirdparty count actioncomm require_once DOL_DOCUMENT_ROOT.'/core/lib/memory.lib.php'; diff --git a/htdocs/core/lib/fichinter.lib.php b/htdocs/core/lib/fichinter.lib.php index 0384704a7f2..00d71f32f91 100644 --- a/htdocs/core/lib/fichinter.lib.php +++ b/htdocs/core/lib/fichinter.lib.php @@ -122,7 +122,7 @@ function fichinter_prepare_head($object) $head[$h][0] = DOL_URL_ROOT.'/fichinter/agenda.php?id='.$object->id; $head[$h][1] = $langs->trans('Events'); - if (isModEnabled('agenda')&& (!empty($user->rights->agenda->myactions->read) || !empty($user->rights->agenda->allactions->read))) { + if (isModEnabled('agenda')&& ($user->hasRight('agenda', 'myactions', 'read') || $user->hasRight('agenda', 'allactions', 'read'))) { $nbEvent = 0; // Enable caching of thirdparty count actioncomm require_once DOL_DOCUMENT_ROOT.'/core/lib/memory.lib.php'; diff --git a/htdocs/core/lib/fourn.lib.php b/htdocs/core/lib/fourn.lib.php index 7093493dad9..85479230d3e 100644 --- a/htdocs/core/lib/fourn.lib.php +++ b/htdocs/core/lib/fourn.lib.php @@ -229,7 +229,7 @@ function ordersupplier_prepare_head(CommandeFournisseur $object) $head[$h][0] = DOL_URL_ROOT.'/fourn/commande/info.php?id='.$object->id; $head[$h][1] = $langs->trans("Events"); - if (isModEnabled('agenda') && (!empty($user->rights->agenda->myactions->read) || !empty($user->rights->agenda->allactions->read))) { + if (isModEnabled('agenda') && ($user->hasRight('agenda', 'myactions', 'read') || $user->hasRight('agenda', 'allactions', 'read'))) { $head[$h][1] .= '/'; $head[$h][1] .= $langs->trans("Agenda"); } diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 6b2cbaf2938..864e20dce36 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -12594,7 +12594,7 @@ function show_actions_messaging($conf, $langs, $db, $filterobj, $objcon = '', $n } if ($user->hasRight('agenda', 'allactions', 'create') || - (($actionstatic->authorid == $user->id || $actionstatic->userownerid == $user->id) && !empty($user->rights->agenda->myactions->create))) { + (($actionstatic->authorid == $user->id || $actionstatic->userownerid == $user->id) && $user->hasRight('agenda', 'myactions', 'create'))) { $out .= ''; } diff --git a/htdocs/core/lib/invoice.lib.php b/htdocs/core/lib/invoice.lib.php index cba7b3aa10d..2093622e0b7 100644 --- a/htdocs/core/lib/invoice.lib.php +++ b/htdocs/core/lib/invoice.lib.php @@ -120,7 +120,7 @@ function facture_prepare_head($object) $head[$h][0] = DOL_URL_ROOT.'/compta/facture/agenda.php?id='.$object->id; $head[$h][1] = $langs->trans("Events"); - if (isModEnabled('agenda')&& (!empty($user->rights->agenda->myactions->read) || !empty($user->rights->agenda->allactions->read))) { + if (isModEnabled('agenda')&& ($user->hasRight('agenda', 'myactions', 'read') || $user->hasRight('agenda', 'allactions', 'read'))) { $nbEvent = 0; // Enable caching of thirdparty count actioncomm require_once DOL_DOCUMENT_ROOT.'/core/lib/memory.lib.php'; diff --git a/htdocs/core/lib/member.lib.php b/htdocs/core/lib/member.lib.php index 83b936a9b0b..a4761276203 100644 --- a/htdocs/core/lib/member.lib.php +++ b/htdocs/core/lib/member.lib.php @@ -128,7 +128,7 @@ function member_prepare_head(Adherent $object) // Show agenda tab $head[$h][0] = DOL_URL_ROOT.'/adherents/agenda.php?id='.$object->id; $head[$h][1] = $langs->trans("Events"); - if (isModEnabled('agenda')&& (!empty($user->rights->agenda->myactions->read) || !empty($user->rights->agenda->allactions->read))) { + if (isModEnabled('agenda')&& ($user->hasRight('agenda', 'myactions', 'read') || $user->hasRight('agenda', 'allactions', 'read'))) { $nbEvent = 0; // Enable caching of thirdparty count actioncomm require_once DOL_DOCUMENT_ROOT.'/core/lib/memory.lib.php'; diff --git a/htdocs/core/lib/order.lib.php b/htdocs/core/lib/order.lib.php index 8368df4496e..7606abcb05c 100644 --- a/htdocs/core/lib/order.lib.php +++ b/htdocs/core/lib/order.lib.php @@ -131,7 +131,7 @@ function commande_prepare_head(Commande $object) $head[$h][0] = DOL_URL_ROOT.'/commande/agenda.php?id='.$object->id; $head[$h][1] = $langs->trans("Events"); - if (isModEnabled('agenda')&& (!empty($user->rights->agenda->myactions->read) || !empty($user->rights->agenda->allactions->read))) { + if (isModEnabled('agenda')&& ($user->hasRight('agenda', 'myactions', 'read') || $user->hasRight('agenda', 'allactions', 'read'))) { $nbEvent = 0; // Enable caching of thirdparty count actioncomm require_once DOL_DOCUMENT_ROOT.'/core/lib/memory.lib.php'; diff --git a/htdocs/core/lib/product.lib.php b/htdocs/core/lib/product.lib.php index aedd01805dc..f6c4bdcdb5f 100644 --- a/htdocs/core/lib/product.lib.php +++ b/htdocs/core/lib/product.lib.php @@ -219,7 +219,7 @@ function product_prepare_head($object) // Log $head[$h][0] = DOL_URL_ROOT.'/product/agenda.php?id='.$object->id; $head[$h][1] = $langs->trans("Events"); - if (isModEnabled('agenda') && (!empty($user->rights->agenda->myactions->read) || !empty($user->rights->agenda->allactions->read))) { + if (isModEnabled('agenda') && ($user->hasRight('agenda', 'myactions', 'read') || $user->hasRight('agenda', 'allactions', 'read'))) { $head[$h][1] .= '/'; $head[$h][1] .= $langs->trans("Agenda"); } diff --git a/htdocs/core/lib/project.lib.php b/htdocs/core/lib/project.lib.php index 8e956e006cb..64e24555897 100644 --- a/htdocs/core/lib/project.lib.php +++ b/htdocs/core/lib/project.lib.php @@ -350,7 +350,7 @@ function project_prepare_head(Project $project, $moreparam = '') $head[$h][0] = DOL_URL_ROOT.'/projet/messaging.php?id='.$project->id; $head[$h][1] = $langs->trans("Events"); - if (isModEnabled('agenda') && (!empty($user->rights->agenda->myactions->read) || !empty($user->rights->agenda->allactions->read))) { + if (isModEnabled('agenda') && ($user->hasRight('agenda', 'myactions', 'read') || $user->hasRight('agenda', 'allactions', 'read'))) { $head[$h][1] .= '/'; $head[$h][1] .= $langs->trans("Agenda"); } diff --git a/htdocs/core/lib/propal.lib.php b/htdocs/core/lib/propal.lib.php index b24fec85a9c..626a89a9bea 100644 --- a/htdocs/core/lib/propal.lib.php +++ b/htdocs/core/lib/propal.lib.php @@ -111,7 +111,7 @@ function propal_prepare_head($object) $head[$h][0] = DOL_URL_ROOT.'/comm/propal/agenda.php?id='.$object->id; $head[$h][1] = $langs->trans("Events"); - if (isModEnabled('agenda')&& (!empty($user->rights->agenda->myactions->read) || !empty($user->rights->agenda->allactions->read))) { + if (isModEnabled('agenda')&& ($user->hasRight('agenda', 'myactions', 'read') || $user->hasRight('agenda', 'allactions', 'read'))) { $nbEvent = 0; // Enable caching of thirdparty count actioncomm require_once DOL_DOCUMENT_ROOT.'/core/lib/memory.lib.php'; diff --git a/htdocs/core/lib/resource.lib.php b/htdocs/core/lib/resource.lib.php index 1fa2aa2f2e1..2a1e09b96c3 100644 --- a/htdocs/core/lib/resource.lib.php +++ b/htdocs/core/lib/resource.lib.php @@ -88,7 +88,7 @@ function resource_prepare_head($object) $head[$h][0] = DOL_URL_ROOT.'/resource/agenda.php?id='.$object->id; $head[$h][1] = $langs->trans("Events"); - if (isModEnabled('agenda') && (!empty($user->rights->agenda->myactions->read) || !empty($user->rights->agenda->allactions->read))) { + if (isModEnabled('agenda') && ($user->hasRight('agenda', 'myactions', 'read') || $user->hasRight('agenda', 'allactions', 'read'))) { $head[$h][1] .= '/'; $head[$h][1] .= $langs->trans("Agenda"); } diff --git a/htdocs/core/lib/ticket.lib.php b/htdocs/core/lib/ticket.lib.php index d31da45f968..0e6ddfba0b5 100644 --- a/htdocs/core/lib/ticket.lib.php +++ b/htdocs/core/lib/ticket.lib.php @@ -133,7 +133,7 @@ function ticket_prepare_head($object) $head[$h][0] = DOL_URL_ROOT.'/ticket/agenda.php?track_id='.$object->track_id; } $head[$h][1] = $langs->trans('Events'); - if (isModEnabled('agenda') && (!empty($user->rights->agenda->myactions->read) || !empty($user->rights->agenda->allactions->read))) { + if (isModEnabled('agenda') && ($user->hasRight('agenda', 'myactions', 'read') || $user->hasRight('agenda', 'allactions', 'read'))) { $head[$h][1] .= '/'; $head[$h][1] .= $langs->trans("Agenda"); } diff --git a/htdocs/fichinter/agenda.php b/htdocs/fichinter/agenda.php index c06ccbc254e..dda47feda1f 100644 --- a/htdocs/fichinter/agenda.php +++ b/htdocs/fichinter/agenda.php @@ -223,7 +223,7 @@ if ($object->id > 0) { } - if (isModEnabled('agenda') && (!empty($user->rights->agenda->myactions->read) || !empty($user->rights->agenda->allactions->read))) { + if (isModEnabled('agenda') && ($user->hasRight('agenda', 'myactions', 'read') || $user->hasRight('agenda', 'allactions', 'read'))) { print '
'; $param = '&id='.$object->id.(!empty($socid) ? '&socid='.$socid : ''); diff --git a/htdocs/fourn/commande/info.php b/htdocs/fourn/commande/info.php index 9fdbf383d50..9e21852b54c 100644 --- a/htdocs/fourn/commande/info.php +++ b/htdocs/fourn/commande/info.php @@ -197,7 +197,7 @@ if ($permok) { print '
'; if (isModEnabled('agenda')) { - if (!empty($user->rights->agenda->myactions->create) || $user->hasRight('agenda', 'allactions', 'create')) { + if ($user->hasRight('agenda', 'myactions', 'create') || $user->hasRight('agenda', 'allactions', 'create')) { print ''.$langs->trans("AddAction").''; } else { print ''.$langs->trans("AddAction").''; diff --git a/htdocs/hrm/evaluation_agenda.php b/htdocs/hrm/evaluation_agenda.php index 1032287da61..753a29cdac2 100644 --- a/htdocs/hrm/evaluation_agenda.php +++ b/htdocs/hrm/evaluation_agenda.php @@ -214,7 +214,7 @@ if ($object->id > 0) { } } - if (isModEnabled('agenda') && (!empty($user->rights->agenda->myactions->read) || !empty($user->rights->agenda->allactions->read))) { + if (isModEnabled('agenda') && ($user->hasRight('agenda', 'myactions', 'read') || $user->hasRight('agenda', 'allactions', 'read'))) { print '
'; $param = '&id='.$object->id.(!empty($socid) ? '&socid='.$socid : ''); diff --git a/htdocs/hrm/job_agenda.php b/htdocs/hrm/job_agenda.php index eee0f80c507..3c02ef91693 100644 --- a/htdocs/hrm/job_agenda.php +++ b/htdocs/hrm/job_agenda.php @@ -191,13 +191,13 @@ if ($object->id > 0) { if (isModEnabled('agenda')) { - if (!empty($user->rights->agenda->myactions->create) || $user->hasRight('agenda', 'allactions', 'create')) { + if ($user->hasRight('agenda', 'myactions', 'create') || $user->hasRight('agenda', 'allactions', 'create')) { $newcardbutton = ''; $newcardbutton .= dolGetButtonTitle($langs->trans('AddAction'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/comm/action/card.php?action=create'.$out); } } - if (isModEnabled('agenda') && (!empty($user->rights->agenda->myactions->read) || !empty($user->rights->agenda->allactions->read))) { + if (isModEnabled('agenda') && ($user->hasRight('agenda', 'myactions', 'read') || $user->hasRight('agenda', 'allactions', 'read'))) { $param = '&id='.$object->id.'&socid='.(!empty($socid) ? '&socid='.$socid : ''); if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) { $param .= '&contextpage='.urlencode($contextpage); diff --git a/htdocs/hrm/position_agenda.php b/htdocs/hrm/position_agenda.php index c1d2f2e57f1..2f5d57533ce 100644 --- a/htdocs/hrm/position_agenda.php +++ b/htdocs/hrm/position_agenda.php @@ -201,7 +201,7 @@ if ($object->id > 0) { print '
'; if (isModEnabled('agenda')) { - if (!empty($user->rights->agenda->myactions->create) || $user->hasRight('agenda', 'allactions', 'create')) { + if ($user->hasRight('agenda', 'myactions', 'create') || $user->hasRight('agenda', 'allactions', 'create')) { print ''.$langs->trans("AddAction").''; } else { print ''.$langs->trans("AddAction").''; @@ -210,7 +210,7 @@ if ($object->id > 0) { print '
'; - if (isModEnabled('agenda') && (!empty($user->rights->agenda->myactions->read) || !empty($user->rights->agenda->allactions->read))) { + if (isModEnabled('agenda') && ($user->hasRight('agenda', 'myactions', 'read') || $user->hasRight('agenda', 'allactions', 'read'))) { $param = '&id='.$object->id.'&socid='.(!empty($socid) ? '&socid='.$socid : ''); if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) { $param .= '&contextpage='.urlencode($contextpage); diff --git a/htdocs/hrm/skill_agenda.php b/htdocs/hrm/skill_agenda.php index db742a95434..03fb9c215e7 100644 --- a/htdocs/hrm/skill_agenda.php +++ b/htdocs/hrm/skill_agenda.php @@ -195,7 +195,7 @@ if ($object->id > 0) { print '
'; if (isModEnabled('agenda')) { - if (!empty($user->rights->agenda->myactions->create) || $user->hasRight('agenda', 'allactions', 'create')) { + if ($user->hasRight('agenda', 'myactions', 'create') || $user->hasRight('agenda', 'allactions', 'create')) { print ''.$langs->trans("AddAction").''; } else { print ''.$langs->trans("AddAction").''; @@ -204,7 +204,7 @@ if ($object->id > 0) { print '
'; - if (isModEnabled('agenda') && (!empty($user->rights->agenda->myactions->read) || !empty($user->rights->agenda->allactions->read))) { + if (isModEnabled('agenda') && ($user->hasRight('agenda', 'myactions', 'read') || $user->hasRight('agenda', 'allactions', 'read'))) { $param = '&id='.$object->id.'&socid='.(!empty($socid) ? '&socid='.$socid : ''); if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) { $param .= '&contextpage='.urlencode($contextpage); diff --git a/htdocs/knowledgemanagement/knowledgerecord_agenda.php b/htdocs/knowledgemanagement/knowledgerecord_agenda.php index cd4580c4d29..dc2556490e8 100644 --- a/htdocs/knowledgemanagement/knowledgerecord_agenda.php +++ b/htdocs/knowledgemanagement/knowledgerecord_agenda.php @@ -222,7 +222,7 @@ if ($object->id > 0) { print '
'; if (isModEnabled('agenda')) { - if (!empty($user->rights->agenda->myactions->create) || $user->hasRight('agenda', 'allactions', 'create')) { + if ($user->hasRight('agenda', 'myactions', 'create') || $user->hasRight('agenda', 'allactions', 'create')) { print ''.$langs->trans("AddAction").''; } else { print ''.$langs->trans("AddAction").''; @@ -231,7 +231,7 @@ if ($object->id > 0) { print '
'; - if (isModEnabled('agenda') && (!empty($user->rights->agenda->myactions->read) || !empty($user->rights->agenda->allactions->read))) { + if (isModEnabled('agenda') && ($user->hasRight('agenda', 'myactions', 'read') || $user->hasRight('agenda', 'allactions', 'read'))) { $param = '&id='.$object->id.'&socid='.$socid; if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) { $param .= '&contextpage='.urlencode($contextpage); diff --git a/htdocs/modulebuilder/template/myobject_agenda.php b/htdocs/modulebuilder/template/myobject_agenda.php index d9e6c7705df..c56cf212ef9 100644 --- a/htdocs/modulebuilder/template/myobject_agenda.php +++ b/htdocs/modulebuilder/template/myobject_agenda.php @@ -293,7 +293,7 @@ if ($object->id > 0) { } - if (isModEnabled('agenda') && (!empty($user->rights->agenda->myactions->read) || !empty($user->rights->agenda->allactions->read))) { + if (isModEnabled('agenda') && ($user->hasRight('agenda', 'myactions', 'read') || $user->hasRight('agenda', 'allactions', 'read'))) { print '
'; $param = '&id='.$object->id.(!empty($socid) ? '&socid='.$socid : ''); diff --git a/htdocs/mrp/mo_agenda.php b/htdocs/mrp/mo_agenda.php index 1ec339ee333..7ccedd90c45 100644 --- a/htdocs/mrp/mo_agenda.php +++ b/htdocs/mrp/mo_agenda.php @@ -219,7 +219,7 @@ if ($object->id > 0) { print '
'; if (isModEnabled('agenda')) { - if (!empty($user->rights->agenda->myactions->create) || $user->hasRight('agenda', 'allactions', 'create')) { + if ($user->hasRight('agenda', 'myactions', 'create') || $user->hasRight('agenda', 'allactions', 'create')) { print ''.$langs->trans("AddAction").''; } else { print ''.$langs->trans("AddAction").''; @@ -228,7 +228,7 @@ if ($object->id > 0) { print '
'; - if (isModEnabled('agenda') && (!empty($user->rights->agenda->myactions->read) || !empty($user->rights->agenda->allactions->read))) { + if (isModEnabled('agenda') && ($user->hasRight('agenda', 'myactions', 'read') || $user->hasRight('agenda', 'allactions', 'read'))) { $param = '&id='.$object->id.'&socid='.$socid; if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) { $param .= '&contextpage='.urlencode($contextpage); diff --git a/htdocs/partnership/partnership_agenda.php b/htdocs/partnership/partnership_agenda.php index 64a5c0ea5c2..a04f8926f49 100644 --- a/htdocs/partnership/partnership_agenda.php +++ b/htdocs/partnership/partnership_agenda.php @@ -228,7 +228,7 @@ if ($object->id > 0) { print '
'; if (isModEnabled('agenda')) { - if (!empty($user->rights->agenda->myactions->create) || $user->hasRight('agenda', 'allactions', 'create')) { + if ($user->hasRight('agenda', 'myactions', 'create') || $user->hasRight('agenda', 'allactions', 'create')) { print ''.$langs->trans("AddAction").''; } else { print ''.$langs->trans("AddAction").''; @@ -237,7 +237,7 @@ if ($object->id > 0) { print '
'; - if (isModEnabled('agenda') && (!empty($user->rights->agenda->myactions->read) || !empty($user->rights->agenda->allactions->read))) { + if (isModEnabled('agenda') && ($user->hasRight('agenda', 'myactions', 'read') || $user->hasRight('agenda', 'allactions', 'read'))) { $param = '&id='.$object->id.'&socid='.$socid; if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) { $param .= '&contextpage='.urlencode($contextpage); diff --git a/htdocs/product/agenda.php b/htdocs/product/agenda.php index 671b74a2714..e77aacc195d 100644 --- a/htdocs/product/agenda.php +++ b/htdocs/product/agenda.php @@ -199,11 +199,11 @@ if ($id > 0 || $ref) { $out .= (!empty($objcon->id) ? '&contactid='.$objcon->id : '').'&backtopage='.$_SERVER["PHP_SELF"].'?id='.$object->id; } - $linktocreatetimeBtnStatus = !empty($user->rights->agenda->myactions->create) || $user->hasRight('agenda', 'allactions', 'create'); + $linktocreatetimeBtnStatus = $user->hasRight('agenda', 'myactions', 'create') || $user->hasRight('agenda', 'allactions', 'create'); $morehtmlcenter = dolGetButtonTitle($langs->trans('AddAction'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/comm/action/card.php?action=create'.$out, '', $linktocreatetimeBtnStatus); } - if (isModEnabled('agenda') && (!empty($user->rights->agenda->myactions->read) || !empty($user->rights->agenda->allactions->read))) { + if (isModEnabled('agenda') && ($user->hasRight('agenda', 'myactions', 'read') || $user->hasRight('agenda', 'allactions', 'read'))) { print '
'; $param = '&id='.$id; diff --git a/htdocs/product/stock/stocktransfer/stocktransfer_agenda.php b/htdocs/product/stock/stocktransfer/stocktransfer_agenda.php index 1f416982b66..dcf2e90b288 100644 --- a/htdocs/product/stock/stocktransfer/stocktransfer_agenda.php +++ b/htdocs/product/stock/stocktransfer/stocktransfer_agenda.php @@ -202,7 +202,7 @@ if ($object->id > 0) { print '
'; if (isModEnabled('agenda')) { - if (!empty($user->rights->agenda->myactions->create) || $user->hasRight('agenda', 'allactions', 'create')) { + if ($user->hasRight('agenda', 'myactions', 'create') || $user->hasRight('agenda', 'allactions', 'create')) { print ''.$langs->trans("AddAction").''; } else { print ''.$langs->trans("AddAction").''; @@ -211,7 +211,7 @@ if ($object->id > 0) { print '
'; - if (isModEnabled('agenda') && (!empty($user->rights->agenda->myactions->read) || !empty($user->rights->agenda->allactions->read))) { + if (isModEnabled('agenda') && ($user->hasRight('agenda', 'myactions', 'read') || $user->hasRight('agenda', 'allactions', 'read'))) { $param = '&id='.$object->id.'&socid='.$socid; if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param .= '&contextpage='.urlencode($contextpage); if ($limit > 0 && $limit != $conf->liste_limit) $param .= '&limit='.((int) $limit); diff --git a/htdocs/projet/agenda.php b/htdocs/projet/agenda.php index df078354315..fa84d0706b5 100644 --- a/htdocs/projet/agenda.php +++ b/htdocs/projet/agenda.php @@ -112,7 +112,7 @@ if ($id > 0 || !empty($ref)) { } $object->info($object->id); } -$agenda = (isModEnabled('agenda') && (!empty($user->rights->agenda->myactions->read) || !empty($user->rights->agenda->allactions->read))) ? '/'.$langs->trans("Agenda") : ''; +$agenda = (isModEnabled('agenda') && ($user->hasRight('agenda', 'myactions', 'read') || $user->hasRight('agenda', 'allactions', 'read'))) ? '/'.$langs->trans("Agenda") : ''; $title = $langs->trans('Events').$agenda.' - '.$object->ref.' '.$object->name; if (!empty($conf->global->MAIN_HTML_TITLE) && preg_match('/projectnameonly/', $conf->global->MAIN_HTML_TITLE) && $object->name) { $title = $object->ref.' '.$object->name.' - '.$langs->trans("Info"); @@ -198,7 +198,7 @@ if (!empty($object->id)) { // Show link to add event if (isModEnabled('agenda')) { - $addActionBtnRight = !empty($user->rights->agenda->myactions->create) || $user->hasRight('agenda', 'allactions', 'create'); + $addActionBtnRight = $user->hasRight('agenda', 'myactions', 'create') || $user->hasRight('agenda', 'allactions', 'create'); $morehtmlright .= dolGetButtonTitle($langs->trans('AddAction'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/comm/action/card.php?action=create'.$out.'&socid='.$object->socid.'&backtopage='.urlencode($_SERVER["PHP_SELF"].'?id='.$object->id), '', $addActionBtnRight); } diff --git a/htdocs/projet/messaging.php b/htdocs/projet/messaging.php index 807008c78c5..e0290d984a4 100644 --- a/htdocs/projet/messaging.php +++ b/htdocs/projet/messaging.php @@ -111,7 +111,7 @@ if ($id > 0 || !empty($ref)) { } $object->info($object->id); } -$agenda = (isModEnabled('agenda') && (!empty($user->rights->agenda->myactions->read) || !empty($user->rights->agenda->allactions->read))) ? '/'.$langs->trans("Agenda") : ''; +$agenda = (isModEnabled('agenda') && ($user->hasRight('agenda', 'myactions', 'read') || $user->hasRight('agenda', 'allactions', 'read'))) ? '/'.$langs->trans("Agenda") : ''; $title = $langs->trans('Events').$agenda.' - '.$object->ref.' '.$object->name; if (!empty($conf->global->MAIN_HTML_TITLE) && preg_match('/projectnameonly/', $conf->global->MAIN_HTML_TITLE) && $object->name) { $title = $object->ref.' '.$object->name.' - '.$langs->trans("Info"); @@ -197,7 +197,7 @@ if (!empty($object->id)) { // Show link to add event if (isModEnabled('agenda')) { - $addActionBtnRight = !empty($user->rights->agenda->myactions->create) || $user->hasRight('agenda', 'allactions', 'create'); + $addActionBtnRight = $user->hasRight('agenda', 'myactions', 'create') || $user->hasRight('agenda', 'allactions', 'create'); $morehtmlcenter .= dolGetButtonTitle($langs->trans('AddAction'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/comm/action/card.php?action=create'.$out.'&socid='.$object->socid.'&backtopage='.urlencode($_SERVER["PHP_SELF"].'?id='.$object->id), '', $addActionBtnRight); } diff --git a/htdocs/recruitment/recruitmentcandidature_agenda.php b/htdocs/recruitment/recruitmentcandidature_agenda.php index 4c047eae251..2011bf006a8 100644 --- a/htdocs/recruitment/recruitmentcandidature_agenda.php +++ b/htdocs/recruitment/recruitmentcandidature_agenda.php @@ -224,7 +224,7 @@ if ($object->id > 0) { print '
'; if (isModEnabled('agenda')) { - if (!empty($user->rights->agenda->myactions->create) || $user->hasRight('agenda', 'allactions', 'create')) { + if ($user->hasRight('agenda', 'myactions', 'create') || $user->hasRight('agenda', 'allactions', 'create')) { print ''.$langs->trans("AddAction").''; } else { print ''.$langs->trans("AddAction").''; @@ -233,7 +233,7 @@ if ($object->id > 0) { print '
'; - if (isModEnabled('agenda') && (!empty($user->rights->agenda->myactions->read) || !empty($user->rights->agenda->allactions->read))) { + if (isModEnabled('agenda') && ($user->hasRight('agenda', 'myactions', 'read') || $user->hasRight('agenda', 'allactions', 'read'))) { $param = '&id='.$object->id.'&socid='.$socid; if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) { $param .= '&contextpage='.urlencode($contextpage); diff --git a/htdocs/recruitment/recruitmentjobposition_agenda.php b/htdocs/recruitment/recruitmentjobposition_agenda.php index 30aa43ad6cd..9df96918f5c 100644 --- a/htdocs/recruitment/recruitmentjobposition_agenda.php +++ b/htdocs/recruitment/recruitmentjobposition_agenda.php @@ -220,7 +220,7 @@ if ($object->id > 0) { print '
'; if (isModEnabled('agenda')) { - if (!empty($user->rights->agenda->myactions->create) || $user->hasRight('agenda', 'allactions', 'create')) { + if ($user->hasRight('agenda', 'myactions', 'create') || $user->hasRight('agenda', 'allactions', 'create')) { print ''.$langs->trans("AddAction").''; } else { print ''.$langs->trans("AddAction").''; @@ -229,7 +229,7 @@ if ($object->id > 0) { print '
'; - if (isModEnabled('agenda') && (!empty($user->rights->agenda->myactions->read) || !empty($user->rights->agenda->allactions->read))) { + if (isModEnabled('agenda') && ($user->hasRight('agenda', 'myactions', 'read') || $user->hasRight('agenda', 'allactions', 'read'))) { $param = '&id='.$object->id; if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) { $param .= '&contextpage='.urlencode($contextpage); diff --git a/htdocs/resource/agenda.php b/htdocs/resource/agenda.php index 78f449cb850..e9ef1902407 100644 --- a/htdocs/resource/agenda.php +++ b/htdocs/resource/agenda.php @@ -167,7 +167,7 @@ if ($object->id > 0) { print dol_get_fiche_end(); - if (isModEnabled('agenda') && (!empty($user->rights->agenda->myactions->read) || !empty($user->rights->agenda->allactions->read))) { + if (isModEnabled('agenda') && ($user->hasRight('agenda', 'myactions', 'read') || $user->hasRight('agenda', 'allactions', 'read'))) { $param = '&id='.$object->id; if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) { $param .= '&contextpage='.urlencode($contextpage); diff --git a/htdocs/societe/agenda.php b/htdocs/societe/agenda.php index 5451a990dbc..e2887ebf284 100644 --- a/htdocs/societe/agenda.php +++ b/htdocs/societe/agenda.php @@ -194,7 +194,7 @@ if (isModEnabled('agenda')) { } } -if (isModEnabled('agenda') && (!empty($user->rights->agenda->myactions->read) || !empty($user->rights->agenda->allactions->read))) { +if (isModEnabled('agenda') && ($user->hasRight('agenda', 'myactions', 'read') || $user->hasRight('agenda', 'allactions', 'read'))) { print '
'; $param = '&socid='.urlencode($socid); diff --git a/htdocs/societe/messaging.php b/htdocs/societe/messaging.php index 483839e0a9e..de8c7396c3a 100644 --- a/htdocs/societe/messaging.php +++ b/htdocs/societe/messaging.php @@ -179,12 +179,12 @@ if ($socid > 0) { // $morehtmlright .= dolGetButtonTitle($langs->trans('TicketAddMessage'), '', 'fa fa-comment-dots', $url, 'add-new-ticket-title-button', $btnstatus); if (isModEnabled('agenda')) { - if (!empty($user->rights->agenda->myactions->create) || $user->hasRight('agenda', 'allactions', 'create')) { + if ($user->hasRight('agenda', 'myactions', 'create') || $user->hasRight('agenda', 'allactions', 'create')) { $morehtmlright .= dolGetButtonTitle($langs->trans('AddAction'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/comm/action/card.php?action=create'.$out); } } - if (isModEnabled('agenda') && (!empty($user->rights->agenda->myactions->read) || !empty($user->rights->agenda->allactions->read))) { + if (isModEnabled('agenda') && ($user->hasRight('agenda', 'myactions', 'read') || $user->hasRight('agenda', 'allactions', 'read'))) { print '
'; $param = '&socid='.urlencode($socid); diff --git a/htdocs/workstation/workstation_agenda.php b/htdocs/workstation/workstation_agenda.php index d665f1efcc4..76bbec57bbe 100644 --- a/htdocs/workstation/workstation_agenda.php +++ b/htdocs/workstation/workstation_agenda.php @@ -223,7 +223,7 @@ if ($object->id > 0) { print '
'; if (isModEnabled('agenda')) { - if (!empty($user->rights->agenda->myactions->create) || $user->hasRight('agenda', 'allactions', 'create')) { + if ($user->hasRight('agenda', 'myactions', 'create') || $user->hasRight('agenda', 'allactions', 'create')) { print ''.$langs->trans("AddAction").''; } else { print ''.$langs->trans("AddAction").''; @@ -232,7 +232,7 @@ if ($object->id > 0) { print '
'; - if (isModEnabled('agenda') && (!empty($user->rights->agenda->myactions->read) || !empty($user->rights->agenda->allactions->read))) { + if (isModEnabled('agenda') && ($user->hasRight('agenda', 'myactions', 'read') || $user->hasRight('agenda', 'allactions', 'read'))) { $param = '&id='.$object->id.'&socid='.$socid; if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) { $param .= '&contextpage='.urlencode($contextpage);