From 572ba6d3e06b591c51dd7c0dd3d0ec7f6592248e Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 28 Dec 2022 19:15:46 +0100 Subject: [PATCH] Update product.class.php --- htdocs/product/class/product.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index d9e09ce788d..0271e0c0d2c 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -3070,7 +3070,7 @@ class Product extends CommonObject if (!empty($conf->global->STOCK_CALCULATE_ON_BILL)) { if (!empty($conf->global->DECREASE_ONLY_UNINVOICEDPRODUCTS)) { $adeduire = 0; - $sql = "SELECT sum(fd.qty) as count FROM ".$this->db->prefix()."facturedet fd "; + $sql = "SELECT sum(fd.qty) as count FROM ".$this->db->prefix()."facturedet as fd "; $sql .= " JOIN ".$this->db->prefix()."facture as f ON fd.fk_facture = f.rowid "; $sql .= " JOIN ".$this->db->prefix()."element_element as el ON ((el.fk_target = f.rowid AND el.targettype = 'facture' AND sourcetype = 'commande') OR (el.fk_source = f.rowid AND el.targettype = 'commande' AND sourcetype = 'facture'))"; $sql .= " JOIN ".$this->db->prefix()."commande as c ON el.fk_source = c.rowid "; @@ -3090,7 +3090,7 @@ class Product extends CommonObject // For every order having invoice already validated we need to decrease stock cause it's in physical stock $adeduire = 0; - $sql = 'SELECT sum(fd.qty) as count FROM '.MAIN_DB_PREFIX.'facturedet fd '; + $sql = 'SELECT sum(fd.qty) as count FROM '.MAIN_DB_PREFIX.'facturedet as fd '; $sql .= ' JOIN '.MAIN_DB_PREFIX.'facture as f ON fd.fk_facture = f.rowid '; $sql .= ' JOIN '.MAIN_DB_PREFIX."element_element as el ON ((el.fk_target = f.rowid AND el.targettype = 'facture' AND sourcetype = 'commande') OR (el.fk_source = f.rowid AND el.targettype = 'commande' AND sourcetype = 'facture'))"; $sql .= ' JOIN '.MAIN_DB_PREFIX.'commande as c ON el.fk_source = c.rowid ';