From 03435d7d90b2e5448d7e0c044dca1b48d26c060f Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 1 Sep 2015 12:36:43 +0200 Subject: [PATCH] Fix bad error management --- .../product/stock/class/mouvementstock.class.php | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/htdocs/product/stock/class/mouvementstock.class.php b/htdocs/product/stock/class/mouvementstock.class.php index 21bfad54f0e..a612b7137cd 100644 --- a/htdocs/product/stock/class/mouvementstock.class.php +++ b/htdocs/product/stock/class/mouvementstock.class.php @@ -634,7 +634,7 @@ class MouvementStock extends CommonObject * * @param variant $fk_origin id of origin * @param int $origintype origin type - * @return string name url + * @return string Url link to object */ function get_origin($fk_origin, $origintype) { @@ -664,15 +664,18 @@ class MouvementStock extends CommonObject default: if ($origintype) { - dol_include_once ('/'.$origintype.'/class/'.$origintype.'.class.php'); - $classname = ucfirst($origintype); - $origin = new $classname($this->db); + $result=dol_include_once('/'.$origintype.'/class/'.$origintype.'.class.php'); + if ($result) + { + $classname = ucfirst($origintype); + $origin = new $classname($this->db); + } } - else - return ''; break; } + if (empty($origin) || ! is_object($origin)) return ''; + $origin->fetch($fk_origin); return $origin->getNomUrl(1); }