fix: PHP fatal error on php 8.2 Unsupported operand types: string * string (#36930)

This commit is contained in:
HENRY Florian 2026-01-20 13:58:17 +01:00 committed by GitHub
parent 39fe5e85e5
commit 926ed04ebe
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 3 additions and 2 deletions

View file

@ -250,7 +250,7 @@ if (empty($reshook)) {
$i = 1;
while (GETPOSTISSET('qty-'.$line->id.'-'.$i)) {
$qtytoprocess = price2num(GETPOST('qty-'.$line->id.'-'.$i));
$qtytoprocess = (float) price2num(GETPOST('qty-'.$line->id.'-'.$i));
if ($qtytoprocess != 0) {
// Check warehouse is set if we should have to

View file

@ -505,6 +505,7 @@ class MouvementStock extends CommonObject
// Test if there is already a record for couple (warehouse / product), so later we will make an update or create.
$alreadyarecord = 0;
$fk_product_stock = 0;
if (!$error) {
$sql = "SELECT rowid, reel FROM ".$this->db->prefix()."product_stock";
$sql .= " WHERE fk_entrepot = ".((int) $entrepot_id)." AND fk_product = ".((int) $fk_product); // This is a unique key
@ -535,7 +536,7 @@ class MouvementStock extends CommonObject
if ($price > 0 || (getDolGlobalString('STOCK_UPDATE_AWP_EVEN_WHEN_ENTRY_PRICE_IS_NULL') && $price == 0 && in_array($this->origin_type, array('order_supplier', 'invoice_supplier')))) {
$oldqtytouse = ($oldqty >= 0 ? $oldqty : 0);
// We make a test on oldpmp>0 to avoid to use normal rule on old data with no pmp field defined
if ($oldpmp > 0) {
if ($oldpmp > 0 && ($oldqtytouse + $qty) != 0) {
$newpmp = price2num((($oldqtytouse * $oldpmp) + ($qty * $price)) / ($oldqtytouse + $qty), 'MU');
} else {
$newpmp = $price; // For this product, PMP was not yet set. We set it to input price.