Update product.class.php

This commit is contained in:
Laurent Destailleur 2022-12-28 19:15:46 +01:00 committed by GitHub
parent 934d7b46d0
commit 572ba6d3e0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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 ';