From fbabd1e696bdb399096b5bafa153cd256bc62f86 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Thu, 15 Aug 2024 16:42:54 +0200 Subject: [PATCH] fix ignored phpstan (#30642) * fix ignored phpstan * fix ignored phpstan * fix ignored phpstan * fix ignored phpstan --- htdocs/admin/stock.php | 16 ++++++++-------- htdocs/core/class/html.form.class.php | 8 ++++---- htdocs/product/class/product.class.php | 1 + phpstan.neon.dist | 1 - 4 files changed, 13 insertions(+), 13 deletions(-) diff --git a/htdocs/admin/stock.php b/htdocs/admin/stock.php index ed5e508cbd1..5005a7f5d1b 100644 --- a/htdocs/admin/stock.php +++ b/htdocs/admin/stock.php @@ -252,7 +252,7 @@ if (isModEnabled('order')) { if ($disabled) { print img_picto($langs->trans("Disabled"), 'off', 'class="opacitymedium"'); } else { - print ajax_constantonoff('STOCK_CALCULATE_ON_VALIDATE_ORDER', array(), null, 0, 0, 0, 2, 1, '', '', 'reposition'); + print ajax_constantonoff('STOCK_CALCULATE_ON_VALIDATE_ORDER', array(), null, 0, 0, 0, 2, 1, 0, '', 'reposition'); } } else { $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes")); @@ -273,7 +273,7 @@ print ''.$langs->trans("DeStockOnShipment").''; print ''; if (isModEnabled("shipping")) { if ($conf->use_javascript_ajax) { - print ajax_constantonoff('STOCK_CALCULATE_ON_SHIPMENT', array(), null, 0, 0, 0, 2, 1, '', '', 'reposition'); + print ajax_constantonoff('STOCK_CALCULATE_ON_SHIPMENT', array(), null, 0, 0, 0, 2, 1, 0, '', 'reposition'); } else { $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes")); print $form->selectarray("STOCK_CALCULATE_ON_SHIPMENT", $arrval, $conf->global->STOCK_CALCULATE_ON_SHIPMENT); @@ -290,7 +290,7 @@ print ''.$langs->trans("DeStockOnShipmentOnClosing").''; print ''; if (isModEnabled("shipping")) { if ($conf->use_javascript_ajax) { - print ajax_constantonoff('STOCK_CALCULATE_ON_SHIPMENT_CLOSE', array(), null, 0, 0, 0, 2, 1, '', '', 'reposition'); + print ajax_constantonoff('STOCK_CALCULATE_ON_SHIPMENT_CLOSE', array(), null, 0, 0, 0, 2, 1, 0, '', 'reposition'); } else { $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes")); print $form->selectarray("STOCK_CALCULATE_ON_SHIPMENT_CLOSE", $arrval, getDolGlobalString('STOCK_CALCULATE_ON_SHIPMENT_CLOSE')); @@ -326,7 +326,7 @@ if (isModEnabled("supplier_order") || isModEnabled("supplier_invoice")) { if ($disabled) { print img_picto($langs->trans("Disabled"), 'off', 'class="opacitymedium"'); } else { - print ajax_constantonoff('STOCK_CALCULATE_ON_SUPPLIER_BILL', array(), null, 0, 0, 0, 2, 1, '', '', 'reposition'); + print ajax_constantonoff('STOCK_CALCULATE_ON_SUPPLIER_BILL', array(), null, 0, 0, 0, 2, 1, 0, '', 'reposition'); } } else { $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes")); @@ -348,7 +348,7 @@ if (isModEnabled("supplier_order") || isModEnabled("supplier_invoice")) { if ($disabled) { print img_picto($langs->trans("Disabled"), 'off', 'class="opacitymedium"'); } else { - print ajax_constantonoff('STOCK_CALCULATE_ON_SUPPLIER_VALIDATE_ORDER', array(), null, 0, 0, 0, 2, 1, '', '', 'reposition'); + print ajax_constantonoff('STOCK_CALCULATE_ON_SUPPLIER_VALIDATE_ORDER', array(), null, 0, 0, 0, 2, 1, 0, '', 'reposition'); } } else { $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes")); @@ -367,7 +367,7 @@ if (isModEnabled("reception")) { print ''; if ($conf->use_javascript_ajax) { - print ajax_constantonoff('STOCK_CALCULATE_ON_RECEPTION', array(), null, 0, 0, 0, 2, 1, '', '', 'reposition'); + print ajax_constantonoff('STOCK_CALCULATE_ON_RECEPTION', array(), null, 0, 0, 0, 2, 1, 0, '', 'reposition'); } else { $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes")); print $form->selectarray("STOCK_CALCULATE_ON_RECEPTION", $arrval, $conf->global->STOCK_CALCULATE_ON_RECEPTION); @@ -382,7 +382,7 @@ if (isModEnabled("reception")) { print ''; if ($conf->use_javascript_ajax) { - print ajax_constantonoff('STOCK_CALCULATE_ON_RECEPTION_CLOSE', array(), null, 0, 0, 0, 2, 1, '', '', 'reposition'); + print ajax_constantonoff('STOCK_CALCULATE_ON_RECEPTION_CLOSE', array(), null, 0, 0, 0, 2, 1, 0, '', 'reposition'); } else { $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes")); print $form->selectarray("STOCK_CALCULATE_ON_RECEPTION_CLOSE", $arrval, $conf->global->STOCK_CALCULATE_ON_RECEPTION_CLOSE); @@ -396,7 +396,7 @@ if (isModEnabled("reception")) { print ''; if (isModEnabled("supplier_order")) { if ($conf->use_javascript_ajax) { - print ajax_constantonoff('STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER', array(), null, 0, 0, 0, 2, 1, '', '', 'reposition'); + print ajax_constantonoff('STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER', array(), null, 0, 0, 0, 2, 1, 0, '', 'reposition'); } else { $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes")); print $form->selectarray("STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER", $arrval, $conf->global->STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER); diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 20d566a20cd..7cb4995469d 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -1374,7 +1374,7 @@ class Form $out .= ajax_event($htmlname, $events); - $out .= ajax_autocompleter($selected, $htmlname, DOL_URL_ROOT.'/societe/ajax/company.php', $urloption, getDolGlobalString('COMPANY_USE_SEARCH_TO_SELECT'), 0, $ajaxoptions); + $out .= ajax_autocompleter($selected, $htmlname, DOL_URL_ROOT.'/societe/ajax/company.php', $urloption, getDolGlobalInt('COMPANY_USE_SEARCH_TO_SELECT'), 0, $ajaxoptions); } else { // Immediate load of all database $out .= $this->select_thirdparty_list($selected, $htmlname, $filter, $showempty, $showtype, $forcecombo, $events, '', 0, $limit, $morecss, $moreparam, $multiple, $excludeids, $showcode); @@ -1453,7 +1453,7 @@ class Form $out .= ajax_event($htmlname, $events); - $out .= ajax_autocompleter($selected, $htmlname, DOL_URL_ROOT.'/contact/ajax/contact.php', $urloption, getDolGlobalString('CONTACT_USE_SEARCH_TO_SELECT'), 0, $events); + $out .= ajax_autocompleter($selected, $htmlname, DOL_URL_ROOT.'/contact/ajax/contact.php', $urloption, getDolGlobalInt('CONTACT_USE_SEARCH_TO_SELECT'), 0, $events); } else { // Immediate load of all database $multiple = false; @@ -3639,7 +3639,7 @@ class Form // mode=2 means suppliers products $urloption = ($socid > 0 ? 'socid=' . $socid . '&' : '') . 'htmlname=' . $htmlname . '&outjson=1&price_level=' . $price_level . '&type=' . $filtertype . '&mode=2&status=' . $status . '&finished=' . $finished . '&alsoproductwithnosupplierprice=' . $alsoproductwithnosupplierprice; - print ajax_autocompleter($selected, $htmlname, DOL_URL_ROOT . '/product/ajax/products.php', $urloption, getDolGlobalString('PRODUIT_USE_SEARCH_TO_SELECT'), 0, $ajaxoptions); + print ajax_autocompleter($selected, $htmlname, DOL_URL_ROOT . '/product/ajax/products.php', $urloption, getDolGlobalInt('PRODUIT_USE_SEARCH_TO_SELECT'), 0, $ajaxoptions); print($hidelabel ? '' : $langs->trans("RefOrLabel") . ' : ') . ''; } else { @@ -8402,7 +8402,7 @@ class Form $urloption = 'htmlname=' . urlencode($htmlname) . '&outjson=1&objectdesc=' . urlencode($objectdescorig) . '&objectfield='.urlencode($objectfield) . ($sortfield ? '&sortfield=' . urlencode($sortfield) : ''); // Activate the auto complete using ajax call. - $out .= ajax_autocompleter($preSelectedValue, $htmlname, $urlforajaxcall, $urloption, getDolGlobalString($confkeyforautocompletemode), 0); + $out .= ajax_autocompleter($preSelectedValue, $htmlname, $urlforajaxcall, $urloption, getDolGlobalInt($confkeyforautocompletemode), 0); $out .= ''; $out .= ''; } else { diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index 3ee571bb504..cec04137697 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -513,6 +513,7 @@ class Product extends CommonObject * @var float|string */ public $weight; + /** * @var int|string */ diff --git a/phpstan.neon.dist b/phpstan.neon.dist index ed6eedec715..d567d7ba771 100644 --- a/phpstan.neon.dist +++ b/phpstan.neon.dist @@ -72,7 +72,6 @@ parameters: - '#expects int\|null#' - '#expects int<-2, 2>, bool given.#' - '#expects int<0, 1>#' - - '#ajax.* expects int, string#' - '#measu.* expects int, string#' - '#color.* expects int, string#' - '#imap.* expects int, string#'