fix: phpstan

htdocs/product/stock/product.php	156	Property Product::$cost_price (float) does not accept string.
htdocs/product/stock/product.php	193	Property ProductStockEntrepot::$fk_entrepot (int) does not accept array|string.
htdocs/product/stock/product.php	222	Property Product::$seuil_stock_alerte (float) does not accept array|string.
This commit is contained in:
thibdrev
2024-01-18 21:17:49 +01:00
committed by GitHub
parent c103e0e5fd
commit 4fcb97dd8d

View File

@@ -67,7 +67,7 @@ $cancel = GETPOST('cancel', 'alpha');
$id = GETPOST('id', 'int');
$ref = GETPOST('ref', 'alpha');
$stocklimit = GETPOST('seuil_stock_alerte');
$stocklimit = (float) GETPOST('seuil_stock_alerte');
$desiredstock = GETPOST('desiredstock');
$cancel = GETPOST('cancel', 'alpha');
$fieldid = isset($_GET["ref"]) ? 'ref' : 'rowid';
@@ -153,7 +153,7 @@ if ($reshook < 0) {
if ($action == 'setcost_price') {
if ($id) {
$result = $object->fetch($id);
$object->cost_price = price2num($cost_price);
$object->cost_price = (float) price2num($cost_price);
$result = $object->update($object->id, $user);
if ($result > 0) {
setEventMessages($langs->trans("RecordSaved"), null, 'mesgs');
@@ -190,7 +190,7 @@ if ($action == 'addlimitstockwarehouse' && $user->hasRight('produit', 'creer'))
}
} else {
// Create
$pse->fk_entrepot = GETPOST('fk_entrepot', 'int');
$pse->fk_entrepot = GETPOSTINT('fk_entrepot');
$pse->fk_product = $id;
$pse->seuil_stock_alerte = GETPOST('seuil_stock_alerte');
$pse->desiredstock = GETPOST('desiredstock');