From 5ac0f77d0e0acae668eade5d9efe03be1d73c0b3 Mon Sep 17 00:00:00 2001 From: BENKE Charlene Date: Wed, 2 May 2018 17:29:31 +0200 Subject: [PATCH] Add trigger for virtual stock Allow to add/sustract some qty for GPAO OF running --- htdocs/product/class/product.class.php | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index 2f36fd59035..2fa802a532c 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -3925,7 +3925,7 @@ class Product extends CommonObject */ function load_virtual_stock() { - global $conf; + global $conf, $user, $langs; $stock_commande_client=0; $stock_commande_fournisseur=0; @@ -3975,6 +3975,16 @@ class Product extends CommonObject if (! empty($conf->global->STOCK_CALCULATE_ON_SUPPLIER_BILL)) { $this->stock_theorique+=$stock_commande_fournisseur-$stock_reception_fournisseur; } + + // Call triggers + include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php'; + $interface=new Interfaces($this->db); + $result=$interface->run_triggers('LOAD_VIRTUAL_STOCK', $this, $user, $langs, $conf); + if ($result < 0) { + $this->errors=$interface->errors; + return -1; + } + }