Compare commits

...

2 Commits

Author SHA1 Message Date
Expresion
9fa9d395dc Fix numeric input parsing to support comma as decimal separator (#36845)
* Fix numeric input parsing to support comma as decimal separator

GETPOSTINT()  only handles integer values and fails when input uses a comma as decimal

* Update dispatch.php

* Change GETPOST to GETPOSTFLOAT for price input

---------

Co-authored-by: Laurent Destailleur <eldy@destailleur.fr>
2026-01-10 18:24:19 +01:00
Laurent Destailleur
cf621642fb Revert "NEW : allow to save stocks as 0 on a stock movement. (#36812)" (#36848)
This reverts commit 5662bfad31.
2026-01-10 18:21:41 +01:00
4 changed files with 7 additions and 9 deletions

View File

@@ -286,7 +286,7 @@ if ($action == 'dispatch' && $permissiontoreceive) {
if (!$error && getDolGlobalString('SUPPLIER_ORDER_CAN_UPDATE_BUYINGPRICE_DURING_RECEIPT')) {
if (!isModEnabled("multicurrency") && empty($conf->dynamicprices->enabled)) {
$dto = price2num(GETPOSTINT("dto_".$reg[1].'_'.$reg[2]), '');
$dto = price2num(GETPOST("dto_".$reg[1].'_'.$reg[2]), '');
if (empty($dto)) {
$dto = 0;
}
@@ -328,7 +328,7 @@ if ($action == 'dispatch' && $permissiontoreceive) {
if (getDolGlobalString('SUPPLIER_ORDER_CAN_UPDATE_BUYINGPRICE_DURING_RECEIPT')) {
if (!isModEnabled("multicurrency") && empty($conf->dynamicprices->enabled)) {
$dto = GETPOSTINT("dto_".$reg[1].'_'.$reg[2]);
$dto = GETPOSTFLOAT("dto_".$reg[1].'_'.$reg[2]);
if (!empty($dto)) {
$unit_price = price2num((float) GETPOST("pu_".$reg[1]) * (100 - $dto) / 100, 'MU');
}
@@ -374,7 +374,7 @@ if ($action == 'dispatch' && $permissiontoreceive) {
if (!$error && getDolGlobalString('SUPPLIER_ORDER_CAN_UPDATE_BUYINGPRICE_DURING_RECEIPT')) {
if (!isModEnabled("multicurrency") && empty($conf->dynamicprices->enabled)) {
$dto = GETPOSTINT("dto_".$reg[1].'_'.$reg[2]);
$dto = GETPOSTFLOAT("dto_".$reg[1].'_'.$reg[2]);
//update supplier price
if (GETPOSTISSET($saveprice)) {
// TODO Use class

View File

@@ -656,7 +656,7 @@ class MouvementStock extends CommonObject
}
}
if (empty($donotcleanemptylines) && !getDolGlobalInt('STOCK_MOVEMENT_FORCE_DO_NOT_CLEAN_EMPTY_LINES')) {
if (empty($donotcleanemptylines)) {
// If stock is now 0, we can remove entry into llx_product_stock, but only if there is no child lines into llx_product_batch (detail of batch, because we can imagine
// having a lot1/qty=X and lot2/qty=-X, so 0 but we must not loose repartition of different lot.
$sql = "DELETE FROM ".$this->db->prefix()."product_stock WHERE reel = 0 AND rowid NOT IN (SELECT fk_product_stock FROM ".$this->db->prefix()."product_batch as pb)";

View File

@@ -1052,10 +1052,8 @@ if (!$variants || getDolGlobalString('VARIANT_ALLOW_STOCK_MOVEMENT_ON_VARIANT_PA
$sql .= " FROM ".MAIN_DB_PREFIX."entrepot as e,";
$sql .= " ".MAIN_DB_PREFIX."product_stock as ps";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product as p ON p.rowid = ps.fk_product";
$sql .= " WHERE ps.fk_entrepot = e.rowid";
if (!getDolGlobalInt('STOCK_MOVEMENT_FORCE_DO_NOT_CLEAN_EMPTY_LINES')) {
$sql .= " AND ps.reel != 0";
}
$sql .= " WHERE ps.reel != 0";
$sql .= " AND ps.fk_entrepot = e.rowid";
$sql .= " AND e.entity IN (".getEntity('stock').")";
$sql .= " AND ps.fk_product = ".((int) $object->id);
$sql .= " ORDER BY e.ref";

View File

@@ -265,7 +265,7 @@ if ($action == 'updatelines' && $permissiontoreceive) {
if (!$error && getDolGlobalString('SUPPLIER_ORDER_CAN_UPDATE_BUYINGPRICE_DURING_RECEIPT')) {
if (!isModEnabled("multicurrency") && empty($conf->dynamicprices->enabled)) {
$dto = price2num(GETPOSTINT("dto_".$reg[1].'_'.$reg[2]), '');
$dto = price2num(GETPOST("dto_".$reg[1].'_'.$reg[2]), '');
if (empty($dto)) {
$dto = 0;
}