From 3749abb41977bb49029a5b5a8be3d89728811c90 Mon Sep 17 00:00:00 2001 From: MDW Date: Fri, 8 Mar 2024 02:53:03 +0100 Subject: [PATCH] Fix: Ensure string type for urlencode() --- htdocs/product/stock/replenish.php | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/htdocs/product/stock/replenish.php b/htdocs/product/stock/replenish.php index ee51a45c4d5..febc2adf39e 100644 --- a/htdocs/product/stock/replenish.php +++ b/htdocs/product/stock/replenish.php @@ -650,23 +650,23 @@ if ($search_ref || $search_label || $sall || $salert || $draftorder || GETPOST(' $filters .= '&draftorder='.urlencode($draftorder); $filters .= '&mode='.urlencode($mode); if ($fk_supplier > 0) { - $filters .= '&fk_supplier='.urlencode($fk_supplier); + $filters .= '&fk_supplier='.urlencode((string) ($fk_supplier)); } if ($fk_entrepot > 0) { - $filters .= '&fk_entrepot='.urlencode($fk_entrepot); + $filters .= '&fk_entrepot='.urlencode((string) ($fk_entrepot)); } } else { $filters = '&search_ref='.urlencode($search_ref).'&search_label='.urlencode($search_label); - $filters .= '&fourn_id='.urlencode($fourn_id); - $filters .= (isset($type) ? '&type='.urlencode($type) : ''); + $filters .= '&fourn_id='.urlencode((string) ($fourn_id)); + $filters .= (isset($type) ? '&type='.urlencode((string) ($type)) : ''); $filters .= '&='.urlencode($salert); $filters .= '&draftorder='.urlencode($draftorder); $filters .= '&mode='.urlencode($mode); if ($fk_supplier > 0) { - $filters .= '&fk_supplier='.urlencode($fk_supplier); + $filters .= '&fk_supplier='.urlencode((string) ($fk_supplier)); } if ($fk_entrepot > 0) { - $filters .= '&fk_entrepot='.urlencode($fk_entrepot); + $filters .= '&fk_entrepot='.urlencode((string) ($fk_entrepot)); } } if ($limit > 0 && $limit != $conf->liste_limit) { @@ -679,12 +679,12 @@ if (!empty($salert)) { $filters .= '&salert='.urlencode($salert); } -$param = (isset($type) ? '&type='.urlencode($type) : ''); -$param .= '&fourn_id='.urlencode($fourn_id).'&search_label='.urlencode($search_label).'&includeproductswithoutdesiredqty='.urlencode($includeproductswithoutdesiredqty).'&salert='.urlencode($salert).'&draftorder='.urlencode($draftorder); +$param = (isset($type) ? '&type='.urlencode((string) ($type)) : ''); +$param .= '&fourn_id='.urlencode((string) ($fourn_id)).'&search_label='.urlencode((string) ($search_label)).'&includeproductswithoutdesiredqty='.urlencode((string) ($includeproductswithoutdesiredqty)).'&salert='.urlencode((string) ($salert)).'&draftorder='.urlencode((string) ($draftorder)); $param .= '&search_ref='.urlencode($search_ref); $param .= '&mode='.urlencode($mode); -$param .= '&fk_supplier='.urlencode($fk_supplier); -$param .= '&fk_entrepot='.urlencode($fk_entrepot); +$param .= '&fk_supplier='.urlencode((string) ($fk_supplier)); +$param .= '&fk_entrepot='.urlencode((string) ($fk_entrepot)); if (!empty($includeproductswithoutdesiredqty)) { $param .= '&includeproductswithoutdesiredqty='.urlencode($includeproductswithoutdesiredqty); } @@ -768,7 +768,7 @@ if (getDolGlobalString('STOCK_REPLENISH_ADD_CHECKBOX_INCLUDE_DRAFT_ORDER')) { print ''; print ' '; // Fields from hook -$parameters = array('param'=>$param, 'sortfield'=>$sortfield, 'sortorder'=>$sortorder); +$parameters = array('param' => $param, 'sortfield' => $sortfield, 'sortorder' => $sortorder); $reshook = $hookmanager->executeHooks('printFieldListOption', $parameters); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; @@ -797,7 +797,7 @@ print_liste_field_titre('StockToBuy', $_SERVER["PHP_SELF"], '', $param, '', '', print_liste_field_titre('SupplierRef', $_SERVER["PHP_SELF"], '', $param, '', '', $sortfield, $sortorder, 'right '); // Hook fields -$parameters = array('param'=>$param, 'sortfield'=>$sortfield, 'sortorder'=>$sortorder); +$parameters = array('param' => $param, 'sortfield' => $sortfield, 'sortorder' => $sortorder); $reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; @@ -959,7 +959,7 @@ while ($i < ($limit ? min($num, $limit) : $num)) { print ''; // Fields from hook - $parameters = array('objp'=>$objp, 'i'=>$i, 'tobuy'=>$tobuy); + $parameters = array('objp' => $objp, 'i' => $i, 'tobuy' => $tobuy); $reshook = $hookmanager->executeHooks('printFieldListValue', $parameters); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; @@ -983,7 +983,7 @@ if ($num == 0) { print ''; } -$parameters = array('sql'=>$sql); +$parameters = array('sql' => $sql); $reshook = $hookmanager->executeHooks('printFieldListFooter', $parameters); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint;