From 7ba663b89dd21f7046fc06dbe5a9ddb4aecd3bf3 Mon Sep 17 00:00:00 2001 From: John BOTELLA <68917336+thersane-john@users.noreply.github.com> Date: Fri, 4 Oct 2024 08:52:25 +0200 Subject: [PATCH] Fix php 8 warnings (#31254) Co-authored-by: Laurent Destailleur --- htdocs/fourn/product/list.php | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/htdocs/fourn/product/list.php b/htdocs/fourn/product/list.php index e0dd5a9af29..14e213e01e8 100644 --- a/htdocs/fourn/product/list.php +++ b/htdocs/fourn/product/list.php @@ -39,6 +39,7 @@ $langs->loadLangs(array('products', 'suppliers')); // Get Parameters $action = GETPOST('action', 'aZ09') ? GETPOST('action', 'aZ09') : 'view'; // The action 'create'/'add', 'edit'/'update', 'view', ... +$massaction = GETPOST('massaction', 'alpha'); $toselect = GETPOST('toselect', 'array:int'); // Array of ids of elements selected into a list $optioncss = GETPOST('optioncss', 'alpha'); $mode = GETPOST('mode', 'aZ'); // The output mode ('list', 'kanban', 'hierarchy', 'calendar', ...) @@ -226,7 +227,7 @@ if (!$resql) { $num = $db->num_rows($resql); $i = 0; - +$help_url = ''; if ($num == 1 && (GETPOST("mode") == 'search')) { $objp = $db->fetch_object($resql); header("Location: ".DOL_URL_ROOT."/product/card.php?id=".$objp->rowid); @@ -301,10 +302,11 @@ print ''; print ''; print ''; +$moreforfilter = ''; $topicmail = "Information"; $modelmail = "product"; $objecttmp = new Product($db); -$trackid = 'prod'.$object->id; +$trackid = 'prod'.$productstatic->id; include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php'; $varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage; @@ -341,7 +343,7 @@ print ''; print ''; // add filters from hooks $parameters = array(); -$reshook = $hookmanager->executeHooks('printFieldPreListTitle', $parameters, $object, $action); +$reshook = $hookmanager->executeHooks('printFieldPreListTitle', $parameters, $productstatic, $action); if ($reshook < 0) { setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); } @@ -355,6 +357,10 @@ if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { } print ''."\n"; +$totalarray = [ + 'nbfield' => 0 +]; + // Fields title label // -------------------------------------------------------------------- print ''; @@ -372,7 +378,7 @@ print_liste_field_titre("QtyMin", $_SERVER["PHP_SELF"], "ppf.quantity", $param, print_liste_field_titre("UnitPrice", $_SERVER["PHP_SELF"], "ppf.unitprice", $param, "", '', $sortfield, $sortorder, 'right '); // add header cells from hooks $parameters = array(); -$reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters, $object, $action); +$reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters, $productstatic, $action); if ($reshook < 0) { setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); } @@ -406,17 +412,17 @@ while ($i < $imaxinloop) { $productstatic->barcode = $objp->barcode; $productstatic->barcode_type = $objp->fk_barcode_type; - print ''; + print ''; // Action column if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { print ''; if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined $selected = 0; - if (in_array($object->id, $arrayofselected)) { + if (in_array($productstatic->id, $arrayofselected)) { $selected = 1; } - print ''; + print ''; } print ''; if (!$i) { @@ -459,10 +465,10 @@ while ($i < $imaxinloop) { print ''; if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined $selected = 0; - if (in_array($object->id, $arrayofselected)) { + if (in_array($productstatic->id, $arrayofselected)) { $selected = 1; } - print ''; + print ''; } print ''; if (!$i) { @@ -491,7 +497,7 @@ if ($num == 0) { $db->free($resql); $parameters = array('arrayfields' => $arrayfields, 'sql' => $sql); -$reshook = $hookmanager->executeHooks('printFieldListFooter', $parameters, $object, $action); // Note that $action and $object may have been modified by hook +$reshook = $hookmanager->executeHooks('printFieldListFooter', $parameters, $productstatic, $action); // Note that $action and $productstatic may have been modified by hook print $hookmanager->resPrint; print ''."\n";