Update product.class.php

This commit is contained in:
Laurent Destailleur 2018-03-10 18:57:55 +01:00 committed by GitHub
parent 6793bfae3a
commit 6fcc271790
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -2272,7 +2272,12 @@ class Product extends CommonObject
} }
} }
if (! empty($conf->global->STOCK_CALCULATE_ON_BILL) && ! empty($conf->global->DECREASE_ONLY_UNINVOICEDPRODUCTS)) // If stock decrease is on invoice validation, the theorical stock continue to
// count the orders to ship in theorical stock when some are already removed b invoice validation.
// If option DECREASE_ONLY_UNINVOICEDPRODUCTS is on, we make a compensation.
if (! empty($conf->global->STOCK_CALCULATE_ON_BILL))
{
if (! empty($conf->global->DECREASE_ONLY_UNINVOICEDPRODUCTS))
{ {
$adeduire = 0; $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 fd ";
@ -2292,7 +2297,8 @@ class Product extends CommonObject
} }
} }
$this->stats_commande['qty'] -= $adeduire ; $this->stats_commande['qty'] -= $adeduire;
}
} }
return 1; return 1;