From 1b117d5581b0ab20c16b7c5e3db47073dd6f023d Mon Sep 17 00:00:00 2001 From: BENKE Charlie Date: Fri, 21 Aug 2015 14:10:55 +0200 Subject: [PATCH 1/2] add in get_origin function generic origintype actually we have only internal module origintype propose to add feature to add stockmovement from other external module --- htdocs/product/stock/class/mouvementstock.class.php | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/htdocs/product/stock/class/mouvementstock.class.php b/htdocs/product/stock/class/mouvementstock.class.php index 52c69b16ec6..1e72e151044 100644 --- a/htdocs/product/stock/class/mouvementstock.class.php +++ b/htdocs/product/stock/class/mouvementstock.class.php @@ -660,9 +660,16 @@ class MouvementStock extends CommonObject require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php'; $origin = new FactureFournisseur($this->db); break; - + default: - return ''; + if ($origintype) + { + require_once DOL_DOCUMENT_ROOT.'/'.$origintype.'/class/'.$origintype.'.class.php'; + $classname = ucfirst($origintype); + $origin = new $classname($this->db); + } + else + return ''; break; } From af7302fa90bc43fb537aa7356695bec82f252ecb Mon Sep 17 00:00:00 2001 From: BENKE Charlie Date: Sun, 23 Aug 2015 00:30:11 +0200 Subject: [PATCH 2/2] change done --- htdocs/product/stock/class/mouvementstock.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/product/stock/class/mouvementstock.class.php b/htdocs/product/stock/class/mouvementstock.class.php index 1e72e151044..21bfad54f0e 100644 --- a/htdocs/product/stock/class/mouvementstock.class.php +++ b/htdocs/product/stock/class/mouvementstock.class.php @@ -664,7 +664,7 @@ class MouvementStock extends CommonObject default: if ($origintype) { - require_once DOL_DOCUMENT_ROOT.'/'.$origintype.'/class/'.$origintype.'.class.php'; + dol_include_once ('/'.$origintype.'/class/'.$origintype.'.class.php'); $classname = ucfirst($origintype); $origin = new $classname($this->db); }