From 2d13b47441a7fb9173e73cc871c87b1808b81d4c Mon Sep 17 00:00:00 2001 From: lmarcouiller Date: Tue, 31 May 2022 11:36:54 +0200 Subject: [PATCH] fix php8.0 warnings --- htdocs/comm/propal/stats/index.php | 6 +++--- htdocs/commande/stats/index.php | 6 +++--- htdocs/fourn/commande/card.php | 16 ++++++++-------- htdocs/mrp/tpl/originproductline.tpl.php | 2 +- 4 files changed, 15 insertions(+), 15 deletions(-) diff --git a/htdocs/comm/propal/stats/index.php b/htdocs/comm/propal/stats/index.php index 0a182e6dcbe..576285594b4 100644 --- a/htdocs/comm/propal/stats/index.php +++ b/htdocs/comm/propal/stats/index.php @@ -335,11 +335,11 @@ foreach ($data as $val) { print ''; print ' 0 ? '&userid='.$userid : '').'">'.$year.''; print ''.$val['nb'].''; - print ''.round($val['nb_diff']).'%'; + print ''.(isset($val['nb_diff']) ? round($val['nb_diff']): "0").'%'; print ''.price(price2num($val['total'], 'MT'), 1).''; - print ''.round($val['total_diff']).'%'; + print ''.(isset($val['total_diff']) ? round($val['total_diff']) : "0").'%'; print ''.price(price2num($val['avg'], 'MT'), 1).''; - print ''.round($val['avg_diff']).'%'; + print ''.(isset($val['avg_diff']) ? round($val['avg_diff']) : "0").'%'; print ''; $oldyear = $year; } diff --git a/htdocs/commande/stats/index.php b/htdocs/commande/stats/index.php index 603627ee91e..3e33ddedf57 100644 --- a/htdocs/commande/stats/index.php +++ b/htdocs/commande/stats/index.php @@ -394,11 +394,11 @@ foreach ($data as $val) { print ''; print ' 0 ? '&userid='.$userid : '').'">'.$year.''; print ''.$val['nb'].''; - print ''.round($val['nb_diff']).'%'; + print ''.(isset($val['nb_diff']) ? round($val['nb_diff']): "0").'%'; print ''.price(price2num($val['total'], 'MT'), 1).''; - print ''.round($val['total_diff']).'%'; + print ''.(isset($val['total_diff']) ? round($val['total_diff']) : "0").'%'; print ''.price(price2num($val['avg'], 'MT'), 1).''; - print ''.round($val['avg_diff']).'%'; + print ''.(isset($val['avg_diff']) ? round($val['avg_diff']) : "0").'%'; print ''; $oldyear = $year; } diff --git a/htdocs/fourn/commande/card.php b/htdocs/fourn/commande/card.php index a945a03b85d..6ab316edb56 100644 --- a/htdocs/fourn/commande/card.php +++ b/htdocs/fourn/commande/card.php @@ -143,9 +143,9 @@ $usercandelete = (($user->rights->fournisseur->commande->supprimer || $user->rig $usercanvalidate = ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($usercancreate)) || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->fournisseur->supplier_order_advance->validate))); // Additional area permissions -$usercanapprove = $user->rights->fournisseur->commande->approuver; -$usercanapprovesecond = $user->rights->fournisseur->commande->approve2; -$usercanorder = $user->rights->fournisseur->commande->commander; +$usercanapprove = !empty($user->rights->fournisseur->commande->approuver) ? $user->rights->fournisseur->commande->approuver : 0; +$usercanapprovesecond = !empty($user->rights->fournisseur->commande->approve2) ? $user->rights->fournisseur->commande->approve2 : 0; +$usercanorder = !empty($user->rights->fournisseur->commande->commander) ? $user->rights->fournisseur->commande->commander : 0; if (empty($conf->reception->enabled)) { $usercanreceive = $user->rights->fournisseur->commande->receptionner; } else { @@ -1627,8 +1627,8 @@ if ($action == 'create') { // Object source contacts list $srccontactslist = $objectsrc->liste_contact(-1, 'external', 1); } else { - $cond_reglement_id = $societe->cond_reglement_supplier_id; - $mode_reglement_id = $societe->mode_reglement_supplier_id; + $cond_reglement_id = !empty($societe->cond_reglement_supplier_id) ? $societe->cond_reglement_supplier_id : 0; + $mode_reglement_id = !empty($societe->mode_reglement_supplier_id) ? $societe->mode_reglement_supplier_id : 0; if (!empty($conf->multicurrency->enabled) && !empty($societe->multicurrency_code)) { $currency_code = $societe->multicurrency_code; @@ -1674,7 +1674,7 @@ if ($action == 'create') { print ''.$langs->trans('Supplier').''; print ''; - if ($societe->id > 0) { + if (!empty($societe->id) && $societe->id > 0) { print $societe->getNomUrl(1, 'supplier'); print ''; } else { @@ -1696,7 +1696,7 @@ if ($action == 'create') { } print ''; - if ($societe->id > 0) { + if (!empty($societe->id) && $societe->id > 0) { // Discounts for third party print ''.$langs->trans('Discounts').''; @@ -1752,7 +1752,7 @@ if ($action == 'create') { $langs->load('projects'); print ''.$langs->trans('Project').''; print img_picto('', 'project').$formproject->select_projects((empty($conf->global->PROJECT_CAN_ALWAYS_LINK_TO_ALL_SUPPLIERS) ? $societe->id : -1), $projectid, 'projectid', 0, 0, 1, 1, 0, 0, 0, '', 1, 0, 'maxwidth500'); - print '   id).'">'; + print '   id) ? '&socid='.$societe->id : "")).'">'; print ''; } diff --git a/htdocs/mrp/tpl/originproductline.tpl.php b/htdocs/mrp/tpl/originproductline.tpl.php index d65f625048b..e641bd142fc 100644 --- a/htdocs/mrp/tpl/originproductline.tpl.php +++ b/htdocs/mrp/tpl/originproductline.tpl.php @@ -24,7 +24,7 @@ if (empty($conf) || !is_object($conf)) { global $db; -if (!is_object($form)) { +if (!empty($form) && !is_object($form)) { $form = new Form($db); }