From 79ecc945e9b1351b0364f64a9eb8cfe5780ab2bc Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 14 Jan 2023 11:43:47 +0100 Subject: [PATCH] Fix warning --- htdocs/bookmarks/list.php | 1 + htdocs/core/menus/standard/eldy_menu.php | 2 +- htdocs/core/search_page.php | 4 ++-- htdocs/modulebuilder/template/myobject_list.php | 10 +++++----- 4 files changed, 9 insertions(+), 8 deletions(-) diff --git a/htdocs/bookmarks/list.php b/htdocs/bookmarks/list.php index 9434cf031a2..2500d40e25d 100644 --- a/htdocs/bookmarks/list.php +++ b/htdocs/bookmarks/list.php @@ -37,6 +37,7 @@ $toselect = GETPOST('toselect', 'array'); $contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'bookmarklist'; // To manage different context of search $id = GETPOST("id", 'int'); $optioncss = GETPOST('optioncss', 'alpha'); +$mode = GETPOST('mode', 'aZ09'); // Load variable for pagination $limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit; diff --git a/htdocs/core/menus/standard/eldy_menu.php b/htdocs/core/menus/standard/eldy_menu.php index bbcd0cacf25..596e1e4cc3f 100644 --- a/htdocs/core/menus/standard/eldy_menu.php +++ b/htdocs/core/menus/standard/eldy_menu.php @@ -204,7 +204,7 @@ class MenuManager //if ($tmpmainmenu=='accountancy') { //var_dump($submenu->liste); exit; //} - $nexturl = dol_buildpath($submenu->liste[0]['url'], 1); + $nexturl = dol_buildpath(empty($submenu->liste[0]['url']) ? '' : $submenu->liste[0]['url'], 1); $canonrelurl = preg_replace('/\?.*$/', '', $relurl); $canonnexturl = preg_replace('/\?.*$/', '', $nexturl); diff --git a/htdocs/core/search_page.php b/htdocs/core/search_page.php index 4f6911497e4..2e5cad17c58 100644 --- a/htdocs/core/search_page.php +++ b/htdocs/core/search_page.php @@ -109,8 +109,8 @@ if ($conf->use_javascript_ajax && 1 == 2) { // select2 is not best with smartp $keysearch = 'search_all'; $accesskey = ''; - if (!$accesskeyalreadyassigned[$val['label'][0]]) { - $accesskey = $val['label'][0]; + if (empty($accesskeyalreadyassigned[$val['label'][0]])) { + $accesskey = $val['label'][0]; // First char of string $accesskeyalreadyassigned[$accesskey] = $accesskey; } diff --git a/htdocs/modulebuilder/template/myobject_list.php b/htdocs/modulebuilder/template/myobject_list.php index 29c9205b1f0..1135f6d9498 100644 --- a/htdocs/modulebuilder/template/myobject_list.php +++ b/htdocs/modulebuilder/template/myobject_list.php @@ -87,7 +87,7 @@ require_once __DIR__.'/class/myobject.class.php'; // Load translation files required by the page $langs->loadLangs(array("mymodule@mymodule", "other")); -$action = GETPOST('action', 'aZ09') ? GETPOST('action', 'aZ09') : 'view'; // The action 'add', 'create', 'edit', 'update', 'view', ... +$action = GETPOST('action', 'aZ09') ? GETPOST('action', 'aZ09') : 'view'; // The action 'create'/'add', 'edit'/'update', 'view', ... $massaction = GETPOST('massaction', 'alpha'); // The bulk action (combo box choice into lists) $show_files = GETPOST('show_files', 'int'); // Show files area generated by bulk actions ? $confirm = GETPOST('confirm', 'alpha'); // Result of a confirmation @@ -96,7 +96,7 @@ $toselect = GETPOST('toselect', 'array'); // Array of ids of elements selected $contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : str_replace('_', '', basename(dirname(__FILE__)).basename(__FILE__, '.php')); // To manage different context of search $backtopage = GETPOST('backtopage', 'alpha'); // Go back to a dedicated page $optioncss = GETPOST('optioncss', 'aZ'); // Option for the css output (always '' except when 'print') -$mode = GETPOST('mode', 'aZ'); +$mode = GETPOST('mode', 'aZ'); // The output mode ('list', 'kanban', 'hierarchy', 'calendar', ...) $id = GETPOST('id', 'int'); $ref = GETPOST('ref', 'alpha'); @@ -182,9 +182,9 @@ $arrayfields = dol_sort_array($arrayfields, 'position'); // Set $enablepermissioncheck to 1 to enable a minimum low level of checks $enablepermissioncheck = 0; if ($enablepermissioncheck) { - $permissiontoread = $user->rights->mymodule->myobject->read; - $permissiontoadd = $user->rights->mymodule->myobject->write; - $permissiontodelete = $user->rights->mymodule->myobject->delete; + $permissiontoread = $user->hasRight('mymodule', 'myobject', 'read'); + $permissiontoadd = $user->hasRight('mymodule', 'myobject', 'write'); + $permissiontodelete = $user->hasRight('mymodule', 'myobject', 'delete'); } else { $permissiontoread = 1; $permissiontoadd = 1;