From 3a27b44f9532774b31f0022dfb1f7c6b24199ff9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20NASSIET?= <109105553+comaiteseb@users.noreply.github.com> Date: Mon, 1 Sep 2025 19:49:50 +0200 Subject: [PATCH 1/3] FIX #35154 - Massaction createbills in reception list don't mind about order and/or thirdparty currency (#35156) * FIX#35154 Massaction createbills in reception list don't mind about order and/or thirdparty currency * FIX#35154 * FIX#35154 * Delete white space line 406 * Correcting typing error --- htdocs/langs/en_US/receptions.lang | 1 + htdocs/langs/fr_FR/receptions.lang | 1 + htdocs/reception/list.php | 22 +++++++++++++++++++++- 3 files changed, 23 insertions(+), 1 deletion(-) diff --git a/htdocs/langs/en_US/receptions.lang b/htdocs/langs/en_US/receptions.lang index 80e9724b3b4..1ba30201969 100644 --- a/htdocs/langs/en_US/receptions.lang +++ b/htdocs/langs/en_US/receptions.lang @@ -54,3 +54,4 @@ RestoreWithCurrentQtySaved=Fill quantities with latest saved values ReceptionsRecorded=Receptions recorded ReceptionUpdated=Reception successfully updated ReceptionDistribution=Reception distribution +ReceptionMustBeInTheSameCurrencyThanOther=Reception have to be int the same currency than the other diff --git a/htdocs/langs/fr_FR/receptions.lang b/htdocs/langs/fr_FR/receptions.lang index 5428232bca6..33bb7ac3f1a 100644 --- a/htdocs/langs/fr_FR/receptions.lang +++ b/htdocs/langs/fr_FR/receptions.lang @@ -56,3 +56,4 @@ RestoreWithCurrentQtySaved=Remplir les quantités avec les dernières valeurs en ReceptionsRecorded=Réceptions enregistrées ReceptionUpdated=Réception mise à jour avec succès ReceptionDistribution=Distribution de réception +ReceptionMustBeInTheSameCurrencyThanOther=Cette Reception n'est pas dans la même devise que les autres diff --git a/htdocs/reception/list.php b/htdocs/reception/list.php index b8334a9c729..d13aabeb22c 100644 --- a/htdocs/reception/list.php +++ b/htdocs/reception/list.php @@ -265,6 +265,8 @@ if (empty($reshook)) { $mode_reglement_id = 0; $fk_account = 0; $transport_mode_id = 0; + $multicurrency_code = null; + if (!empty($rcp->cond_reglement_id)) { $cond_reglement_id = $rcp->cond_reglement_id; } @@ -277,11 +279,15 @@ if (empty($reshook)) { if (!empty($rcp->transport_mode_id)) { $transport_mode_id = $rcp->transport_mode_id; } + if (!empty($rcp->multicurrency_code)) { + $multicurrency_code = $rcp->multicurrency_code; + } if (empty($cond_reglement_id) || empty($mode_reglement_id) || empty($fk_account) || empty($transport_mode_id) + || empty($multicurrency_code) ) { if (!isset($rcp->supplier_order)) { $rcp->fetch_origin(); @@ -302,6 +308,9 @@ if (empty($reshook)) { if (empty($transport_mode_id) && !empty($supplierOrder->transport_mode_id)) { $transport_mode_id = $supplierOrder->transport_mode_id; } + if (empty($multicurrency_code) && !empty($supplierOrder->multicurrency_code)) { + $multicurrency_code = $supplierOrder->multicurrency_code; + } } // try get from third-party of reception @@ -319,6 +328,9 @@ if (empty($reshook)) { if (empty($transport_mode_id) && !empty($soc->transport_mode_id)) { $transport_mode_id = $soc->transport_mode_id; } + if (empty($multicurrency_code) && !empty($soc->multicurrency_code)) { + $multicurrency_code = $soc->multicurrency_code; + } } } @@ -329,6 +341,7 @@ if (empty($reshook)) { $objecttmp->mode_reglement_id = $mode_reglement_id; $objecttmp->fk_account = $fk_account; $objecttmp->transport_mode_id = $transport_mode_id; + $objecttmp->multicurrency_code = $multicurrency_code; // if the VAT reverse-charge is activated by default in supplier card to resume the information $objecttmp->vat_reverse_charge = $soc->vat_reverse_charge; @@ -384,6 +397,13 @@ if (empty($reshook)) { } if ($objecttmp->id > 0) { + if (!isset($rcp->origin_object)) { + $rcp->fetch_origin(); + } + if ($rcp->origin_object->multicurrency_code != $objecttmp->multicurrency_code) { + $errors[] = $rcp->ref." : ".$langs->trans("ReceptionMustBeInTheSameCurrencyThanOther"); + } + $res = $objecttmp->add_object_linked($objecttmp->origin, $id_reception); if ($res == 0) { @@ -492,7 +512,7 @@ if (empty($reshook)) { array(), null, $lines[$i]->rowid, - 0, + $lines[$i]->multicurrency_subprice, $lines[$i]->ref_supplier ); From 355021adb84d1726078ea151f3c42df25851d734 Mon Sep 17 00:00:00 2001 From: Benjamin Chanudet Date: Wed, 3 Sep 2025 14:51:50 +0200 Subject: [PATCH 2/3] FIX #35181 Cancelled purchase orders now shown as such in Project Overview (#35186) * exclude "cancelled" purchase orders from total * show cancelled purchase order as cancelled * show cancelled order by default, as the visibility button is "cancelled shown" by default --- htdocs/projet/element.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/projet/element.php b/htdocs/projet/element.php index c70ebf80791..daace8203a1 100644 --- a/htdocs/projet/element.php +++ b/htdocs/projet/element.php @@ -1272,12 +1272,12 @@ foreach ($listofreferent as $key => $value) { if (!empty($element->close_code) && $element->close_code == 'replaced') { $qualifiedfortotal = false; // Replacement invoice, do not include into total } - } elseif ($key == 'order_supplier' && $element->status == 7) { + } elseif ($key == 'order_supplier' && ($element->status == 6 || $element->status == 7)) { $qualifiedfortotal = false; // It makes no sense to include canceled orders in the total } - if ($key == "order_supplier" && $element->status == 7) { - print ''; + if ($key == "order_supplier" && ($element->status == 6 || $element->status == 7)) { + print ''; } else { print ''; } From e3abe90ee0a1a88a94e87a223c7ab9b80055721f Mon Sep 17 00:00:00 2001 From: ldestailleur Date: Wed, 3 Sep 2025 19:19:49 +0200 Subject: [PATCH 3/3] FIX Restore decimal quantity for stock correction/transfer --- htdocs/product/stock/movement_list.php | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/htdocs/product/stock/movement_list.php b/htdocs/product/stock/movement_list.php index 4653864a5ba..9f2cb1d1209 100644 --- a/htdocs/product/stock/movement_list.php +++ b/htdocs/product/stock/movement_list.php @@ -358,7 +358,7 @@ if ($action == "correct_stock" && $permissiontoadd) { setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Product")), null, 'errors'); $action = 'correction'; } - if (!is_numeric(GETPOST("nbpiece"))) { + if (!GETPOSTFLOAT("nbpiece")) { $error++; setEventMessages($langs->trans("ErrorFieldMustBeANumeric", $langs->transnoentitiesnoconv("NumberOfUnit")), null, 'errors'); $action = 'correction'; @@ -384,7 +384,7 @@ if ($action == "correct_stock" && $permissiontoadd) { $result = $product->correct_stock_batch( $user, $id, - GETPOSTINT("nbpiece"), + GETPOSTFLOAT("nbpiece"), GETPOSTINT("mouvement"), GETPOST("label", 'alphanohtml'), price2num(GETPOST('unitprice'), 'MT'), @@ -401,7 +401,7 @@ if ($action == "correct_stock" && $permissiontoadd) { $result = $product->correct_stock( $user, $id, - GETPOSTINT("nbpiece"), + GETPOSTFLOAT("nbpiece"), GETPOSTINT("mouvement"), GETPOST("label", 'alphanohtml'), price2num(GETPOST('unitprice'), 'MT'), @@ -446,7 +446,7 @@ if ($action == "transfert_stock" && $permissiontoadd && !$cancel) { setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Product")), null, 'errors'); $action = 'transfert'; } - if (!GETPOSTINT("nbpiece")) { + if (!GETPOSTFLOAT("nbpiece")) { setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("NumberOfUnit")), null, 'errors'); $error++; $action = 'transfert'; @@ -510,7 +510,7 @@ if ($action == "transfert_stock" && $permissiontoadd && !$cancel) { $result1 = $product->correct_stock_batch( $user, $srcwarehouseid, - GETPOSTINT("nbpiece"), + GETPOSTFLOAT("nbpiece"), 1, GETPOST("label", 'san_alpha'), $pricesrc, @@ -527,7 +527,7 @@ if ($action == "transfert_stock" && $permissiontoadd && !$cancel) { $result2 = $product->correct_stock_batch( $user, GETPOSTINT("id_entrepot_destination"), - GETPOSTINT("nbpiece"), + GETPOSTFLOAT("nbpiece"), 0, GETPOST("label", 'san_alpha'), $pricedest, @@ -546,9 +546,9 @@ if ($action == "transfert_stock" && $permissiontoadd && !$cancel) { $result1 = $product->correct_stock( $user, $id, - GETPOST("nbpiece"), + GETPOSTFLOAT("nbpiece"), 1, - GETPOST("label", 'san_alpha'), + GETPOST("label", 'alphanohtml'), $pricesrc, GETPOST('inventorycode', 'alphanohtml'), '', @@ -561,9 +561,9 @@ if ($action == "transfert_stock" && $permissiontoadd && !$cancel) { $result2 = $product->correct_stock( $user, GETPOST("id_entrepot_destination"), - GETPOST("nbpiece"), + GETPOSTFLOAT("nbpiece"), 0, - GETPOST("label", 'san_alpha'), + GETPOST("label", 'alphanohtml'), $pricedest, GETPOST('inventorycode', 'alphanohtml'), '',