Merge pull request #25102 from frederic34/20230614

use user hasRight
This commit is contained in:
Laurent Destailleur 2023-06-16 00:30:34 +02:00 committed by GitHub
commit 814da787b0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
46 changed files with 51 additions and 51 deletions

View file

@ -1297,7 +1297,7 @@ print "</table>";
print '</div>';
// TODO Replace this with mass delete action
//if ($user->rights->accounting->mouvements->supprimer_tous) {
//if ($user->hasRight('accounting', 'mouvements, 'supprimer_tous')) {
// print '<div class="tabsAction tabsActionNoBottom">'."\n";
// print '<a class="butActionDelete" name="button_delmvt" href="'.$_SERVER["PHP_SELF"].'?action=delbookkeepingyear&token='.newToken().($param ? '&'.$param : '').'">'.$langs->trans("DeleteMvt").'</a>';
// print '</div>';

View file

@ -166,7 +166,7 @@ if ($object->id > 0) {
$out = '&origin=' . urlencode($object->element . '@' . $object->module) . '&originid=' . urlencode($object->id);
$urlbacktopage = $_SERVER['PHP_SELF'] . '?id=' . $object->id;
$out .= '&backtopage=' . urlencode($urlbacktopage);
$permok = $user->rights->agenda->myactions->create;
$permok = $user->hasRight('agenda', 'myactions', 'create');
if ((!empty($objthirdparty->id) || !empty($objcon->id)) && $permok) {
//$out.='<a href="'.DOL_URL_ROOT.'/comm/action/card.php?action=create';
if (get_class($objthirdparty) == 'Societe') {

View file

@ -168,7 +168,7 @@ if ($object->id > 0) {
$out = '&origin=' . urlencode($object->element . '@' . $object->module) . '&originid=' . urlencode($object->id);
$urlbacktopage = $_SERVER['PHP_SELF'] . '?id=' . $object->id;
$out .= '&backtopage=' . urlencode($urlbacktopage);
$permok = $user->rights->agenda->myactions->create;
$permok = $user->hasRight('agenda', 'myactions', 'create');
if ((!empty($objthirdparty->id) || !empty($objcon->id)) && $permok) {
//$out.='<a href="'.DOL_URL_ROOT.'/comm/action/card.php?action=create';
if (get_class($objthirdparty) == 'Societe') {

View file

@ -210,7 +210,7 @@ if ($object->id > 0) {
$objcon = new stdClass();
$out = '&origin='.$object->element.'&originid='.$object->id;
$permok = $user->rights->agenda->myactions->create;
$permok = $user->hasRight('agenda', 'myactions', 'create');
if ((!empty($objthirdparty->id) || !empty($objcon->id)) && $permok) {
//$out.='<a href="'.DOL_URL_ROOT.'/comm/action/card.php?action=create';
if (get_class($objthirdparty) == 'Societe') {

View file

@ -216,7 +216,7 @@ if ($object->id > 0) {
$out = '&origin='.urlencode($object->element.'@'.$object->module).'&originid='.urlencode($object->id);
$urlbacktopage = $_SERVER['PHP_SELF'].'?id='.$object->id;
$out .= '&backtopage='.urlencode($urlbacktopage);
$permok = $user->rights->agenda->myactions->create;
$permok = $user->hasRight('agenda', 'myactions', 'create');
if ((!empty($objthirdparty->id) || !empty($objcon->id)) && $permok) {
//$out.='<a href="'.DOL_URL_ROOT.'/comm/action/card.php?action=create';
if (get_class($objthirdparty) == 'Societe') {

View file

@ -216,7 +216,7 @@ if ($object->id > 0) {
$out = '&origin='.urlencode($object->element.'@'.$object->module).'&originid='.urlencode($object->id);
$urlbacktopage = $_SERVER['PHP_SELF'].'?id='.$object->id;
$out .= '&backtopage='.urlencode($urlbacktopage);
$permok = $user->rights->agenda->myactions->create;
$permok = $user->hasRight('agenda', 'myactions', 'create');
if ((!empty($objthirdparty->id) || !empty($objcon->id)) && $permok) {
//$out.='<a href="'.DOL_URL_ROOT.'/comm/action/card.php?action=create';
if (get_class($objthirdparty) == 'Societe') {

View file

@ -38,7 +38,7 @@ $langs->load("categories");
// Security check
$socid = (int) GETPOST('socid', 'int');
if (!$user->rights->categorie->lire) {
if (!$user->hasRight('categorie', 'lire')) {
accessforbidden();
}

View file

@ -49,7 +49,7 @@ if (is_numeric($type)) {
// Initialize technical object to manage hooks. Note that conf->hooks_modules contains array array
$hookmanager->initHooks(array('categoryindex'));
if (!$user->rights->categorie->lire) {
if (!$user->hasRight('categorie', 'lire')) {
accessforbidden();
}

View file

@ -29,7 +29,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/categories.lib.php';
if (!$user->rights->categorie->lire) {
if (!$user->hasRight('categorie', 'lire')) {
accessforbidden();
}

View file

@ -2514,8 +2514,8 @@ if ($id > 0) {
$filedir = $conf->agenda->multidir_output[$conf->entity].'/'.$object->id;
$urlsource = $_SERVER["PHP_SELF"]."?id=".$object->id;
$genallowed = $user->rights->agenda->myactions->read;
$delallowed = $user->rights->agenda->myactions->create;
$genallowed = $user->hasRight('agenda', 'myactions', 'read');
$delallowed = $user->hasRight('agenda', 'myactions', 'create');
print $formfile->showdocuments('actions', $object->id, $filedir, $urlsource, $genallowed, $delallowed, '', 0, 0, 0, 0, 0, '', '', '', $langs->getDefaultLang());

View file

@ -305,7 +305,7 @@ if ($object->id > 0) {
$modulepart = 'actions';
$permissiontoadd = $user->rights->agenda->myactions->create || $user->hasRight('agenda', 'allactions', 'create');
$permissiontoadd = $user->hasRight('agenda', 'myactions', 'create') || $user->hasRight('agenda', 'allactions', 'create');
$param = '&id='.$object->id;
include DOL_DOCUMENT_ROOT.'/core/tpl/document_actions_post_headers.tpl.php';
} else {

View file

@ -267,7 +267,7 @@ if (empty($reshook)) {
$uploaddir = true;
// Only users that can delete any event can remove records.
$permissiontodelete = $user->rights->agenda->allactions->delete;
$permissiontoadd = $user->rights->agenda->myactions->create;
$permissiontoadd = $user->hasRight('agenda', 'myactions', 'create');
include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php';
}

View file

@ -799,7 +799,7 @@ if ((isModEnabled("supplier_order") || isModEnabled("supplier_invoice")) && $use
/*
* Last actions
*/
/*if ($user->rights->agenda->myactions->read) {
/*if ($user->hasRight('agenda', 'myactions', 'read')) {
show_array_last_actions_done($max);
}*/
@ -807,7 +807,7 @@ if ((isModEnabled("supplier_order") || isModEnabled("supplier_invoice")) && $use
/*
* Actions to do
*/
/*if ($user->rights->agenda->myactions->read) {
/*if ($user->hasRight('agenda', 'myactions', 'read')) {
show_array_actions_to_do($max);
}*/

View file

@ -194,7 +194,7 @@ if ($object->id > 0) {
$out = '&origin='.urlencode($object->element.(property_exists($object, 'module') ? '@'.$object->module : '')).'&originid='.urlencode($object->id);
$urlbacktopage = $_SERVER['PHP_SELF'].'?id='.$object->id;
$out .= '&backtopage='.urlencode($urlbacktopage);
$permok = $user->rights->agenda->myactions->create;
$permok = $user->hasRight('agenda', 'myactions', 'create');
if ((!empty($objthirdparty->id) || !empty($objcon->id)) && $permok) {
//$out.='<a href="'.DOL_URL_ROOT.'/comm/action/card.php?action=create';
if (get_class($objthirdparty) == 'Societe') {

View file

@ -194,7 +194,7 @@ if ($object->id > 0) {
$out = '&origin='.urlencode($object->element.(property_exists($object, 'module') ? '@'.$object->module : '')).'&originid='.urlencode($object->id);
$urlbacktopage = $_SERVER['PHP_SELF'].'?id='.$object->id;
$out .= '&backtopage='.urlencode($urlbacktopage);
$permok = $user->rights->agenda->myactions->create;
$permok = $user->hasRight('agenda', 'myactions', 'create');
if ((!empty($objthirdparty->id) || !empty($objcon->id)) && $permok) {
//$out.='<a href="'.DOL_URL_ROOT.'/comm/action/card.php?action=create';
if (get_class($objthirdparty) == 'Societe') {

View file

@ -257,7 +257,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
$out = '';
$newcardbutton = '';
if (isModEnabled('agenda')) {
$permok = $user->rights->agenda->myactions->create;
$permok = $user->hasRight('agenda', 'myactions', 'create');
if ((!empty($objthirdparty->id) || !empty($objcon->id)) && $permok) {
if (is_object($objthirdparty) && get_class($objthirdparty) == 'Societe') {
$out .= '&amp;originid='.$objthirdparty->id.($objthirdparty->id > 0 ? '&amp;socid='.$objthirdparty->id : '');

View file

@ -79,7 +79,7 @@ class box_accountancy_last_manual_entries extends ModeleBoxes
$this->info_box_head = array('text' => $langs->trans("BoxTitleLastManualEntries", $max));
if ($user->rights->accounting->mouvements->lire) {
if ($user->hasRight('accounting', 'mouvements, 'lire')) {
$sql = "SELECT DISTINCT b.piece_num";
$sql .= ", b.doc_date as date_movement";
$sql .= ", b.label_operation";

View file

@ -78,7 +78,7 @@ class box_accountancy_suspense_account extends ModeleBoxes
$this->info_box_head = array('text' => $langs->trans("BoxTitleSuspenseAccount"));
if ($user->rights->accounting->mouvements->lire) {
if ($user->hasRight('accounting', 'mouvements, 'lire')) {
$suspenseAccount = $conf->global->ACCOUNTING_ACCOUNT_SUSPENSE;
if (!empty($suspenseAccount) && $suspenseAccount > 0) {
$sql = "SELECT COUNT(*) as nb_suspense_account";

View file

@ -84,7 +84,7 @@ class box_actions extends ModeleBoxes
$this->info_box_head = array('text' => $langs->trans("BoxTitleOldestActionsToDo", $max));
if ($user->rights->agenda->myactions->read) {
if ($user->hasRight('agenda', 'myactions', 'read')) {
$sql = "SELECT a.id, a.label, a.datep as dp, a.percent as percentage";
$sql .= ", ta.code";
$sql .= ", ta.libelle as type_label";

View file

@ -86,7 +86,7 @@ class box_actions_future extends ModeleBoxes
$this->info_box_head = array('text' => $langs->trans("BoxTitleFutureActions", $max));
if ($user->rights->agenda->myactions->read) {
if ($user->hasRight('agenda', 'myactions', 'read')) {
$sql = "SELECT a.id, a.label, a.datep as dp, a.percent as percentage";
$sql .= ", ta.code";
$sql .= ", ta.libelle as type_label";

View file

@ -693,7 +693,7 @@ function restrictedArea(User $user, $features, $object = 0, $tableandshare = '',
$deleteok = 0;
}
} elseif ($feature == 'produit|service') {
if (!$user->rights->produit->supprimer && !$user->rights->service->supprimer) {
if (!$user->hasRight('produit', 'supprimer') && !$user->hasRight('service', 'supprimer')) {
$deleteok = 0;
}
} elseif ($feature == 'commande_fournisseur') {

View file

@ -374,8 +374,8 @@ function print_left_auguria_menu($db, $menu_array_before, $menu_array_after, &$t
$db->free($resql);
}
if (isModEnabled('accounting') && !empty($user->rights->accounting->comptarapport->lire) && $mainmenu == 'accountancy') { // Entry in accountancy journal for each bank account
$newmenu->add('', $langs->trans("RegistrationInAccounting"), 1, $user->rights->accounting->comptarapport->lire, '', 'accountancy', 'accountancy', 10);
if (isModEnabled('accounting') && $user->hasRight('accounting', 'comptarapport', 'lire') && $mainmenu == 'accountancy') { // Entry in accountancy journal for each bank account
$newmenu->add('', $langs->trans("RegistrationInAccounting"), 1, $user->hasRight('accounting', 'comptarapport', 'lire'), '', 'accountancy', 'accountancy', 10);
// Multi journal
$sql = "SELECT rowid, code, label, nature";
@ -430,13 +430,13 @@ function print_left_auguria_menu($db, $menu_array_before, $menu_array_after, &$t
if ($nature) {
$langs->load('accountancy');
$journallabel = $langs->transnoentities($objp->label); // Labels in this table are set by loading llx_accounting_abc.sql. Label can be 'ACCOUNTING_SELL_JOURNAL', 'InventoryJournal', ...
$newmenu->add('/accountancy/journal/'.$nature.'journal.php?mainmenu=accountancy&leftmenu=accountancy_journal&id_journal='.$objp->rowid, $journallabel, 2, $user->rights->accounting->comptarapport->lire);
$newmenu->add('/accountancy/journal/'.$nature.'journal.php?mainmenu=accountancy&leftmenu=accountancy_journal&id_journal='.$objp->rowid, $journallabel, 2, $user->hasRight('accounting', 'comptarapport', 'lire'));
}
$i++;
}
} else {
// Should not happend. Entries are added
$newmenu->add('', $langs->trans("NoJournalDefined"), 2, $user->rights->accounting->comptarapport->lire);
$newmenu->add('', $langs->trans("NoJournalDefined"), 2, $user->hasRight('accounting', 'comptarapport', 'lire'));
}
} else {
dol_print_error($db);

View file

@ -51,7 +51,7 @@ if (empty($modulepart)) {
$accessallowed = 0;
if ($modulepart == 'produit' || $modulepart == 'product' || $modulepart == 'service' || $modulepart == 'produit|service') {
$result = restrictedArea($user, 'produit|service', $id, 'product&product');
if ($modulepart == 'produit|service' && (!$user->rights->produit->lire && !$user->rights->service->lire)) {
if ($modulepart == 'produit|service' && (!$user->hasRight('produit', 'lire') && !$user->hasRight('service', 'lire'))) {
accessforbidden();
}
$accessallowed = 1;

View file

@ -59,7 +59,7 @@ if ($module == 'propal') {
} elseif ($module == 'project') {
$permission = $user->rights->projet->creer;
} elseif ($module == 'action') {
$permission = $user->rights->agenda->myactions->create;
$permission = $user->hasRight('agenda', 'myactions', 'create');
} elseif ($module == 'shipping') {
$permission = $user->rights->expedition->creer;
} elseif ($module == 'reception') {

View file

@ -195,7 +195,7 @@ if ($object->id > 0) {
$out = '&origin='.urlencode($object->element.(property_exists($object, 'module') ? '@'.$object->module : '')).'&originid='.urlencode($object->id);
$urlbacktopage = $_SERVER['PHP_SELF'].'?id='.$object->id;
$out .= '&backtopage='.urlencode($urlbacktopage);
$permok = $user->rights->agenda->myactions->create;
$permok = $user->hasRight('agenda', 'myactions', 'create');
if ((!empty($objthirdparty->id) || !empty($objcon->id)) && $permok) {
//$out.='<a href="'.DOL_URL_ROOT.'/comm/action/card.php?action=create';
if (get_class($objthirdparty) == 'Societe') {

View file

@ -188,7 +188,7 @@ print dol_get_fiche_end();
// Actions buttons
$out = '';
$permok = $user->rights->agenda->myactions->create;
$permok = $user->hasRight('agenda', 'myactions', 'create');
if ($permok) {
$out .= '&originid='.$object->id.'&origin=order_supplier';
}

View file

@ -187,7 +187,7 @@ if ($object->id > 0) {
$out = '&origin='.urlencode($object->element.'@'.$object->module).'&originid='.urlencode($object->id);
$urlbacktopage = $_SERVER['PHP_SELF'].'?id='.$object->id;
$out .= '&backtopage='.urlencode($urlbacktopage);
$permok = $user->rights->agenda->myactions->create;
$permok = $user->hasRight('agenda', 'myactions', 'create');
if ((!empty($objthirdparty->id) || !empty($objcon->id)) && $permok) {
//$out.='<a href="'.DOL_URL_ROOT.'/comm/action/card.php?action=create';
if (get_class($objthirdparty) == 'Societe') {

View file

@ -177,7 +177,7 @@ if ($object->id > 0) {
$out = '&origin='.urlencode($object->element.'@'.$object->module).'&originid='.urlencode($object->id);
$urlbacktopage = $_SERVER['PHP_SELF'].'?id='.$object->id;
$out .= '&backtopage='.urlencode($urlbacktopage);
$permok = $user->rights->agenda->myactions->create;
$permok = $user->hasRight('agenda', 'myactions', 'create');
if ((!empty($objthirdparty->id) || !empty($objcon->id)) && $permok) {
//$out.='<a href="'.DOL_URL_ROOT.'/comm/action/card.php?action=create';
if (get_class($objthirdparty) == 'Societe') {

View file

@ -185,7 +185,7 @@ if ($object->id > 0) {
$out = '&origin='.urlencode($object->element.'@'.$object->module).'&originid='.urlencode($object->id);
$urlbacktopage = $_SERVER['PHP_SELF'].'?id='.$object->id;
$out .= '&backtopage='.urlencode($urlbacktopage);
$permok = $user->rights->agenda->myactions->create;
$permok = $user->hasRight('agenda', 'myactions', 'create');
if ((!empty($objthirdparty->id) || !empty($objcon->id)) && $permok) {
//$out.='<a href="'.DOL_URL_ROOT.'/comm/action/card.php?action=create';
if (get_class($objthirdparty) == 'Societe') {

View file

@ -179,7 +179,7 @@ if ($object->id > 0) {
$out = '&origin='.urlencode($object->element.'@'.$object->module).'&originid='.urlencode($object->id);
$urlbacktopage = $_SERVER['PHP_SELF'].'?id='.$object->id;
$out .= '&backtopage='.urlencode($urlbacktopage);
$permok = $user->rights->agenda->myactions->create;
$permok = $user->hasRight('agenda', 'myactions', 'create');
if ((!empty($objthirdparty->id) || !empty($objcon->id)) && $permok) {
//$out.='<a href="'.DOL_URL_ROOT.'/comm/action/card.php?action=create';
if (get_class($objthirdparty) == 'Societe') {

View file

@ -206,7 +206,7 @@ if ($object->id > 0) {
$out = '&origin='.urlencode($object->element.'@'.$object->module).'&originid='.urlencode($object->id);
$urlbacktopage = $_SERVER['PHP_SELF'].'?id='.$object->id;
$out .= '&backtopage='.urlencode($urlbacktopage);
$permok = $user->rights->agenda->myactions->create;
$permok = $user->hasRight('agenda', 'myactions', 'create');
if ((!empty($objthirdparty->id) || !empty($objcon->id)) && $permok) {
//$out.='<a href="'.DOL_URL_ROOT.'/comm/action/card.php?action=create';
if (get_class($objthirdparty) == 'Societe') {

View file

@ -265,7 +265,7 @@ if ($object->id > 0) {
$out = '&origin='.urlencode($object->element.(property_exists($object, 'module') ? '@'.$object->module : '')).'&originid='.urlencode($object->id);
$urlbacktopage = $_SERVER['PHP_SELF'].'?id='.$object->id;
$out .= '&backtopage='.urlencode($urlbacktopage);
$permok = $user->rights->agenda->myactions->create;
$permok = $user->hasRight('agenda', 'myactions', 'create');
if ((!empty($objthirdparty->id) || !empty($objcon->id)) && $permok) {
//$out.='<a href="'.DOL_URL_ROOT.'/comm/action/card.php?action=create';
if (get_class($objthirdparty) == 'Societe') {

View file

@ -203,7 +203,7 @@ if ($object->id > 0) {
$objcon = new stdClass();
$out = '&origin='.$object->element.'&originid='.$object->id;
$permok = $user->rights->agenda->myactions->create;
$permok = $user->hasRight('agenda', 'myactions', 'create');
if ((!empty($objthirdparty->id) || !empty($objcon->id)) && $permok) {
//$out.='<a href="'.DOL_URL_ROOT.'/comm/action/card.php?action=create';
if (get_class($objthirdparty) == 'Societe') {

View file

@ -212,7 +212,7 @@ if ($object->id > 0) {
$out = '&origin='.urlencode($object->element.'@'.$object->module).'&originid='.urlencode($object->id);
$urlbacktopage = $_SERVER['PHP_SELF'].'?id='.$object->id;
$out .= '&backtopage='.urlencode($urlbacktopage);
$permok = $user->rights->agenda->myactions->create;
$permok = $user->hasRight('agenda', 'myactions', 'create');
if ((!empty($objthirdparty->id) || !empty($objcon->id)) && $permok) {
//$out.='<a href="'.DOL_URL_ROOT.'/comm/action/card.php?action=create';
if (get_class($objthirdparty) == 'Societe') {

View file

@ -81,7 +81,7 @@ if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter',
$search_year = '';
}
if (!$user->rights->produit->lire) accessforbidden();
if (!$user->hasRight('produit', 'lire')) accessforbidden();
/*

View file

@ -81,7 +81,7 @@ if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter',
$search_year = '';
}
if (!$user->rights->produit->lire) accessforbidden();
if (!$user->hasRight('produit', 'lire')) accessforbidden();
/*

View file

@ -74,7 +74,7 @@ if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter',
$search_year = '';
}
if (!$user->rights->produit->lire) accessforbidden();
if (!$user->hasRight('produit', 'lire')) accessforbidden();
/*

View file

@ -81,7 +81,7 @@ if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter',
$search_year = '';
}
if (!$user->rights->produit->lire) accessforbidden();
if (!$user->hasRight('produit', 'lire')) accessforbidden();
/*

View file

@ -188,7 +188,7 @@ if ($object->id > 0) {
$objcon = new stdClass();
$out = '&origin='.$object->element.'&originid='.$object->id;
$permok = $user->rights->agenda->myactions->create;
$permok = $user->hasRight('agenda', 'myactions', 'create');
if ((!empty($objthirdparty->id) || !empty($objcon->id)) && $permok) {
//$out.='<a href="'.DOL_URL_ROOT.'/comm/action/card.php?action=create';
if (get_class($objthirdparty) == 'Societe') $out .= '&amp;socid='.$objthirdparty->id;

View file

@ -162,7 +162,7 @@ print dol_get_fiche_end();
// Actions buttons
$out = '';
$permok = $user->rights->agenda->myactions->create;
$permok = $user->hasRight('agenda', 'myactions', 'create');
if ($permok) {
$out .= '&projectid='.$object->id;
}

View file

@ -207,7 +207,7 @@ if ($object->id > 0) {
$objcon = new stdClass();
$out = '&origin='.$object->element.'@recruitment&originid='.$object->id;
$permok = $user->rights->agenda->myactions->create;
$permok = $user->hasRight('agenda', 'myactions', 'create');
if ((!empty($objthirdparty->id) || !empty($objcon->id)) && $permok) {
//$out.='<a href="'.DOL_URL_ROOT.'/comm/action/card.php?action=create';
if (get_class($objthirdparty) == 'Societe') {

View file

@ -204,7 +204,7 @@ if ($object->id > 0) {
$objcon = new stdClass();
$out = '&origin='.$object->element.'@recruitment&originid='.$object->id;
$permok = $user->rights->agenda->myactions->create;
$permok = $user->hasRight('agenda', 'myactions', 'create');
if ((!empty($objthirdparty->id) || !empty($objcon->id)) && $permok) {
//$out.='<a href="'.DOL_URL_ROOT.'/comm/action/card.php?action=create';
if (get_class($objthirdparty) == 'Societe') {

View file

@ -47,7 +47,7 @@ if (is_numeric($type)) {
$type = Categorie::$MAP_ID_TO_CODE[$type]; // For backward compatibility
}
if (!$user->rights->categorie->lire) {
if (!$user->hasRight('categorie', 'lire')) {
accessforbidden();
}

View file

@ -207,7 +207,7 @@ if ($object->id > 0) {
$out = '&origin='.urlencode($object->element.'@'.$object->module).'&originid='.urlencode($object->id);
$urlbacktopage = $_SERVER['PHP_SELF'].'?id='.$object->id;
$out .= '&backtopage='.urlencode($urlbacktopage);
$permok = $user->rights->agenda->myactions->create;
$permok = $user->hasRight('agenda', 'myactions', 'create');
if ((!empty($objthirdparty->id) || !empty($objcon->id)) && $permok) {
//$out.='<a href="'.DOL_URL_ROOT.'/comm/action/card.php?action=create';
if (get_class($objthirdparty) == 'Societe') {

View file

@ -42,7 +42,7 @@ if (!$user->admin) {
accessforbidden();
}
if (empty($conf->zapier->enabled)) accessforbidden();
if (!isModEnabled('zapier')) accessforbidden();
if (empty($user->admin)) accessforbidden();

View file

@ -46,7 +46,7 @@ $arrayofparameters = array(
// 'ZAPIERFORDOLIBARR_MYPARAM2'=>array('css'=>'minwidth500', 'enabled'=>1)
);
if (empty($conf->zapier->enabled)) accessforbidden();
if (!isModEnabled('zapier')) accessforbidden();
if (empty($user->admin)) accessforbidden();