From 0e2c57fe65734dddf69590c7997b22a5c17aa1f3 Mon Sep 17 00:00:00 2001 From: Francis Appels Date: Wed, 7 Jul 2021 14:50:10 +0200 Subject: [PATCH 1/3] Fix php 8 warning on user page --- htdocs/core/lib/usergroups.lib.php | 4 ++-- htdocs/user/bank.php | 3 +-- htdocs/user/card.php | 7 +++++-- htdocs/user/clicktodial.php | 4 +++- htdocs/user/notify/card.php | 2 +- htdocs/user/param_ihm.php | 10 ++++++---- htdocs/user/perms.php | 2 +- 7 files changed, 19 insertions(+), 13 deletions(-) diff --git a/htdocs/core/lib/usergroups.lib.php b/htdocs/core/lib/usergroups.lib.php index cd9ae5ad297..29f208e5254 100644 --- a/htdocs/core/lib/usergroups.lib.php +++ b/htdocs/core/lib/usergroups.lib.php @@ -906,7 +906,7 @@ function showSkins($fuser, $edit = 0, $foruserprofile = false) } // Use MAIN_OPTIMIZEFORTEXTBROWSER - if ($foruserprofile) { + if ($foruserprofile && !empty($fuser->conf->MAIN_OPTIMIZEFORTEXTBROWSER)) { //$default=yn($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER); $default = $langs->trans('No'); print ''; @@ -953,7 +953,7 @@ function showSkins($fuser, $edit = 0, $foruserprofile = false) // Use MAIN_OPTIMIZEFORTEXTBROWSER - if ($foruserprofile) { + if ($foruserprofile && !empty($fuser->conf->MAIN_OPTIMIZEFORCOLORBLIND)) { //$default=yn($conf->global->MAIN_OPTIMIZEFORCOLORBLIND); $default = $langs->trans('No'); print ''; diff --git a/htdocs/user/bank.php b/htdocs/user/bank.php index fc9002e13fb..0eaf3d533a9 100644 --- a/htdocs/user/bank.php +++ b/htdocs/user/bank.php @@ -506,7 +506,6 @@ if ($action != 'edit' && $action != 'create') { // If not bank account yet, $ac $exp->id = $objp->rowid; $exp->ref = $objp->ref; - $exp->fk_type = $objp->fk_type; $exp->status = $objp->status; print ''; @@ -557,7 +556,7 @@ if ($action != 'edit' && $action != 'create') { // If not bank account yet, $ac print_liste_field_titre("RIB"); print_liste_field_titre("IBAN"); print_liste_field_titre("BIC"); - print_liste_field_titre('', $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'maxwidthsearch '); + print_liste_field_titre('', $_SERVER["PHP_SELF"], "", '', '', '', '', '', 'maxwidthsearch '); print "\n"; if ($account->id > 0) { diff --git a/htdocs/user/card.php b/htdocs/user/card.php index 1efbdb18714..92284d45e1c 100644 --- a/htdocs/user/card.php +++ b/htdocs/user/card.php @@ -1451,8 +1451,11 @@ if ($action == 'create' || $action == 'adduserldap') { print ''.$langs->trans("None").''; } else { $huser = new User($db); - $huser->fetch($object->fk_user); - print $huser->getNomUrl(1); + if ($huser->fetch($object->fk_user) > 0) { + print $huser->getNomUrl(1); + } else { + print ''.$langs->trans("None").''; + } } print ''; print "\n"; diff --git a/htdocs/user/clicktodial.php b/htdocs/user/clicktodial.php index 0a9a65a2852..79450f2d811 100644 --- a/htdocs/user/clicktodial.php +++ b/htdocs/user/clicktodial.php @@ -150,7 +150,9 @@ if ($id > 0) { if (!empty($user->admin)) { print 'ClickToDial URL'; print ''; - $url = $conf->global->CLICKTODIAL_URL; + if (!empty($conf->global->CLICKTODIAL_URL)) { + $url = $conf->global->CLICKTODIAL_URL; + } if (!empty($object->clicktodial_url)) { $url = $object->clicktodial_url; } diff --git a/htdocs/user/notify/card.php b/htdocs/user/notify/card.php index 978c2d990b7..4ef62f25ab5 100644 --- a/htdocs/user/notify/card.php +++ b/htdocs/user/notify/card.php @@ -437,7 +437,7 @@ if ($result > 0) { } print '
'; - if ($optioncss != '') { + if (!empty($optioncss)) { print ''; } print ''; diff --git a/htdocs/user/param_ihm.php b/htdocs/user/param_ihm.php index b492e31177f..72f9b075be9 100644 --- a/htdocs/user/param_ihm.php +++ b/htdocs/user/param_ihm.php @@ -370,10 +370,12 @@ if ($action == 'edit') { print empty($dolibarr_main_demo) ? '' : ' disabled="disabled"'; // Disabled for demo print '> '.$langs->trans("UsePersonalValue").''; print ''; - if (!empty($tmparray[$object->conf->MAIN_LANDING_PAGE])) { - print $langs->trans($tmparray[$object->conf->MAIN_LANDING_PAGE]); - } else { - print $object->conf->MAIN_LANDING_PAGE; + if (!empty($object->conf->MAIN_LANDING_PAGE)) { + if (!empty($tmparray[$object->conf->MAIN_LANDING_PAGE])) { + print $langs->trans($tmparray[$object->conf->MAIN_LANDING_PAGE]); + } else { + print $object->conf->MAIN_LANDING_PAGE; + } } //print $form->selectarray('MAIN_LANDING_PAGE', $tmparray, (! empty($object->conf->MAIN_LANDING_PAGE)?$object->conf->MAIN_LANDING_PAGE:''), 0, 0, 0, '', 1); print ''; diff --git a/htdocs/user/perms.php b/htdocs/user/perms.php index 2136d0f07c5..957c7a3a819 100644 --- a/htdocs/user/perms.php +++ b/htdocs/user/perms.php @@ -407,7 +407,7 @@ if ($result) { print ''; print img_picto($langs->trans("Active"), 'tick'); print ''; - } elseif (is_array($permsgroupbyentity[$entity])) { + } elseif (isset($permsgroupbyentity[$entity]) && is_array($permsgroupbyentity[$entity])) { if (in_array($obj->id, $permsgroupbyentity[$entity])) { // Permission granted by group if ($caneditperms) { print ''; From a94218312737171b27da53ce8cd7fe841937e8dd Mon Sep 17 00:00:00 2001 From: Francis Appels Date: Wed, 7 Jul 2021 15:02:00 +0200 Subject: [PATCH 2/3] better fix for optioncss --- htdocs/user/notify/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/user/notify/card.php b/htdocs/user/notify/card.php index 4ef62f25ab5..3acad0ac0c3 100644 --- a/htdocs/user/notify/card.php +++ b/htdocs/user/notify/card.php @@ -437,7 +437,7 @@ if ($result > 0) { } print ''; - if (!empty($optioncss)) { + if (isset($optioncss) && $optioncss != '') { print ''; } print ''; From 7870336f2a2cd17b59ce2c7100c74390f77ebe85 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 8 Jul 2021 16:31:01 +0200 Subject: [PATCH 3/3] Update card.php --- htdocs/user/card.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/user/card.php b/htdocs/user/card.php index 92284d45e1c..152c39f79ac 100644 --- a/htdocs/user/card.php +++ b/htdocs/user/card.php @@ -1451,7 +1451,8 @@ if ($action == 'create' || $action == 'adduserldap') { print ''.$langs->trans("None").''; } else { $huser = new User($db); - if ($huser->fetch($object->fk_user) > 0) { + if ($object->fk_user > 0) { + $huser->fetch($object->fk_user); print $huser->getNomUrl(1); } else { print ''.$langs->trans("None").'';