From 380cae761abd903efbfe1d5edf86436249fcd28c Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 25 Jun 2022 04:06:18 +0200 Subject: [PATCH 1/3] doc --- htdocs/expedition/card.php | 2 +- htdocs/expedition/class/expedition.class.php | 6 ++++++ htdocs/product/stock/class/mouvementstock.class.php | 12 +++++++----- 3 files changed, 14 insertions(+), 6 deletions(-) diff --git a/htdocs/expedition/card.php b/htdocs/expedition/card.php index 0b32229ae65..95d183153d4 100644 --- a/htdocs/expedition/card.php +++ b/htdocs/expedition/card.php @@ -2155,7 +2155,7 @@ elseif ($id || $ref) //if ($filter) $sql.= $filter; $sql .= " ORDER BY obj.fk_product"; - dol_syslog("get list of shipment lines", LOG_DEBUG); + dol_syslog("expedition/card.php get list of shipment lines", LOG_DEBUG); $resql = $db->query($sql); if ($resql) { diff --git a/htdocs/expedition/class/expedition.class.php b/htdocs/expedition/class/expedition.class.php index bcccd2aee2a..8ba9dd4fbbc 100644 --- a/htdocs/expedition/class/expedition.class.php +++ b/htdocs/expedition/class/expedition.class.php @@ -801,6 +801,12 @@ class Expedition extends CommonObject } } } + + // 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 ".MAIN_DB_PREFIX."product_stock WHERE reel = 0 AND rowid NOT IN (SELECT fk_product_stock FROM ".MAIN_DB_PREFIX."product_batch as pb)"; + $resql = $this->db->query($sql); + // We do not test error, it can fails if there is child in batch details } else { diff --git a/htdocs/product/stock/class/mouvementstock.class.php b/htdocs/product/stock/class/mouvementstock.class.php index 5c44019b1fc..25596a24684 100644 --- a/htdocs/product/stock/class/mouvementstock.class.php +++ b/htdocs/product/stock/class/mouvementstock.class.php @@ -571,11 +571,13 @@ class MouvementStock extends CommonObject } } - // 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 ".MAIN_DB_PREFIX."product_stock WHERE reel = 0 AND rowid NOT IN (SELECT fk_product_stock FROM ".MAIN_DB_PREFIX."product_batch as pb)"; - $resql = $this->db->query($sql); - // We do not test error, it can fails if there is child in batch details + if (empty($donotcleanemptyline)) { + // 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 ".MAIN_DB_PREFIX."product_stock WHERE reel = 0 AND rowid NOT IN (SELECT fk_product_stock FROM ".MAIN_DB_PREFIX."product_batch as pb)"; + $resql = $this->db->query($sql); + // We do not test error, it can fails if there is child in batch details + } } // Add movement for sub products (recursive call) From eeaa4f8205c6314b0ba2dbf332f79283effc98ae Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 25 Jun 2022 04:06:55 +0200 Subject: [PATCH 2/3] Revert "doc" This reverts commit 380cae761abd903efbfe1d5edf86436249fcd28c. --- htdocs/expedition/card.php | 2 +- htdocs/expedition/class/expedition.class.php | 6 ------ htdocs/product/stock/class/mouvementstock.class.php | 12 +++++------- 3 files changed, 6 insertions(+), 14 deletions(-) diff --git a/htdocs/expedition/card.php b/htdocs/expedition/card.php index 95d183153d4..0b32229ae65 100644 --- a/htdocs/expedition/card.php +++ b/htdocs/expedition/card.php @@ -2155,7 +2155,7 @@ elseif ($id || $ref) //if ($filter) $sql.= $filter; $sql .= " ORDER BY obj.fk_product"; - dol_syslog("expedition/card.php get list of shipment lines", LOG_DEBUG); + dol_syslog("get list of shipment lines", LOG_DEBUG); $resql = $db->query($sql); if ($resql) { diff --git a/htdocs/expedition/class/expedition.class.php b/htdocs/expedition/class/expedition.class.php index 8ba9dd4fbbc..bcccd2aee2a 100644 --- a/htdocs/expedition/class/expedition.class.php +++ b/htdocs/expedition/class/expedition.class.php @@ -801,12 +801,6 @@ class Expedition extends CommonObject } } } - - // 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 ".MAIN_DB_PREFIX."product_stock WHERE reel = 0 AND rowid NOT IN (SELECT fk_product_stock FROM ".MAIN_DB_PREFIX."product_batch as pb)"; - $resql = $this->db->query($sql); - // We do not test error, it can fails if there is child in batch details } else { diff --git a/htdocs/product/stock/class/mouvementstock.class.php b/htdocs/product/stock/class/mouvementstock.class.php index 25596a24684..5c44019b1fc 100644 --- a/htdocs/product/stock/class/mouvementstock.class.php +++ b/htdocs/product/stock/class/mouvementstock.class.php @@ -571,13 +571,11 @@ class MouvementStock extends CommonObject } } - if (empty($donotcleanemptyline)) { - // 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 ".MAIN_DB_PREFIX."product_stock WHERE reel = 0 AND rowid NOT IN (SELECT fk_product_stock FROM ".MAIN_DB_PREFIX."product_batch as pb)"; - $resql = $this->db->query($sql); - // We do not test error, it can fails if there is child in batch details - } + // 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 ".MAIN_DB_PREFIX."product_stock WHERE reel = 0 AND rowid NOT IN (SELECT fk_product_stock FROM ".MAIN_DB_PREFIX."product_batch as pb)"; + $resql = $this->db->query($sql); + // We do not test error, it can fails if there is child in batch details } // Add movement for sub products (recursive call) From e381e646b3e7025fef2dcd2688e9dbf26f1227e2 Mon Sep 17 00:00:00 2001 From: daraelmin Date: Sat, 25 Jun 2022 21:22:30 +0200 Subject: [PATCH 3/3] Fix css class declared in wrong param In print_liste_field_titre CSS class name can only be added in prefix parameter (except 'class="right"' for backward compatibility) If the title is centered, the field should be also --- htdocs/accountancy/bookkeeping/card.php | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/htdocs/accountancy/bookkeeping/card.php b/htdocs/accountancy/bookkeeping/card.php index efa9fc03c78..062fd03e7f9 100644 --- a/htdocs/accountancy/bookkeeping/card.php +++ b/htdocs/accountancy/bookkeeping/card.php @@ -637,7 +637,7 @@ if ($action == 'create') { print_liste_field_titre("Debit", "", "", "", "", 'class="right"'); print_liste_field_titre("Credit", "", "", "", "", 'class="right"'); if (empty($object->date_validation)) { - print_liste_field_titre("Action", "", "", "", "", 'width="60" class="center"'); + print_liste_field_titre("Action", "", "", "", "", 'width="60"', "", "", 'center '); } else { print_liste_field_titre(""); } @@ -704,9 +704,7 @@ if ($action == 'create') { print ''; print ''; print ''; - print ''; - print ''; - print ''; + print ''; } } else { print '';