From 2ee52c1659e851221bf184ee46f014a5dcf2b288 Mon Sep 17 00:00:00 2001 From: Ferran Marcet Date: Tue, 12 Mar 2024 13:44:19 +0100 Subject: [PATCH 1/2] Fix: Error in the SQL to update the stock from batch to non-batch management --- htdocs/product/class/product.class.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index b959d87063f..fa89c13b5cf 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -12,7 +12,7 @@ * Copyright (C) 2014 Henry Florian * Copyright (C) 2014-2016 Philippe Grand * Copyright (C) 2014 Ion agorria - * Copyright (C) 2016-2018 Ferran Marcet + * Copyright (C) 2016-2024 Ferran Marcet * Copyright (C) 2017 Gustavo Novaro * Copyright (C) 2019-2023 Frédéric France * Copyright (C) 2023 Benjamin Falière @@ -1341,8 +1341,8 @@ class Product extends CommonObject if (!$this->hasbatch() && $this->oldcopy->hasbatch()) { // Selection of all product stock mouvements that contains batchs - $sql = 'SELECT pb.qty, pb.fk_entrepot, pb.batch FROM '.MAIN_DB_PREFIX.'product_batch as pb'; - $sql.= ' INNER JOIN '.MAIN_DB_PREFIX.'product_stock as ps ON (ps.rowid = batch.fk_product_stock)'; + $sql = 'SELECT pb.qty, ps.fk_entrepot, pb.batch FROM '.MAIN_DB_PREFIX.'product_batch as pb'; + $sql.= ' INNER JOIN '.MAIN_DB_PREFIX.'product_stock as ps ON (ps.rowid = pb.fk_product_stock)'; $sql.= ' WHERE ps.fk_product = '.(int) $this->id; $resql = $this->db->query($sql); From 6679565638d619522280ba8587f28d70bb775cf0 Mon Sep 17 00:00:00 2001 From: Ferran Marcet Date: Tue, 12 Mar 2024 17:01:59 +0100 Subject: [PATCH 2/2] Fix: Error in the treatment of the date and the name of the variable --- htdocs/product/class/productbatch.class.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/product/class/productbatch.class.php b/htdocs/product/class/productbatch.class.php index 0d6d4f52e68..f9d0edb5988 100644 --- a/htdocs/product/class/productbatch.class.php +++ b/htdocs/product/class/productbatch.class.php @@ -1,6 +1,7 @@ * Copyright (C) 2013-2014 Cedric GROSS + * Copyright (C) 2024 Ferran Marcet * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -519,7 +520,7 @@ class Productbatch extends CommonObject $tmp->import_key = $obj->import_key; if (getDolGlobalString('SHIPPING_DISPLAY_STOCK_ENTRY_DATE')) { - $tmp->context['stock_date_entry'] = $obj->date_entree; + $tmp->context['stock_entry_date'] = $dbs->jdate($obj->date_entree); } if ($fk_product > 0) {