Skip to content

Commit

Permalink
Fix php 8 warnings (#31254)
Browse files Browse the repository at this point in the history
Co-authored-by: Laurent Destailleur <[email protected]>
  • Loading branch information
thersane-john and eldy authored Oct 4, 2024
1 parent d31baf0 commit 7ba663b
Showing 1 changed file with 16 additions and 10 deletions.
26 changes: 16 additions & 10 deletions htdocs/fourn/product/list.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@

// 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', ...)
Expand Down Expand Up @@ -226,7 +227,7 @@
$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);
Expand Down Expand Up @@ -301,10 +302,11 @@
print '<input type="hidden" name="page" value="'.$page.'">';
print '<input type="hidden" name="type" value="'.$type.'">';

$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;
Expand Down Expand Up @@ -341,7 +343,7 @@
print '<td></td>';
// 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');
}
Expand All @@ -355,6 +357,10 @@
}
print '</tr>'."\n";

$totalarray = [
'nbfield' => 0
];

// Fields title label
// --------------------------------------------------------------------
print '<tr class="liste_titre">';
Expand All @@ -372,7 +378,7 @@
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');
}
Expand Down Expand Up @@ -406,17 +412,17 @@
$productstatic->barcode = $objp->barcode;
$productstatic->barcode_type = $objp->fk_barcode_type;

print '<tr data-rowid="'.$object->id.'" class="oddeven">';
print '<tr data-rowid="'.$productstatic->id.'" class="oddeven">';

// Action column
if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
print '<td class="nowrap center">';
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 '<input id="cb'.$object->id.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$object->id.'"'.($selected ? ' checked="checked"' : '').'>';
print '<input id="cb'.$productstatic->id.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$productstatic->id.'"'.($selected ? ' checked="checked"' : '').'>';
}
print '</td>';
if (!$i) {
Expand Down Expand Up @@ -459,10 +465,10 @@
print '<td class="nowrap center">';
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 '<input id="cb'.$object->id.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$object->id.'"'.($selected ? ' checked="checked"' : '').'>';
print '<input id="cb'.$productstatic->id.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$productstatic->id.'"'.($selected ? ' checked="checked"' : '').'>';
}
print '</td>';
if (!$i) {
Expand Down Expand Up @@ -491,7 +497,7 @@
$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 '</table>'."\n";
Expand Down

0 comments on commit 7ba663b

Please sign in to comment.