Fix bad error management

This commit is contained in:
Laurent Destailleur 2015-09-01 12:36:43 +02:00
parent 2754d7dbec
commit 03435d7d90

View File

@ -634,7 +634,7 @@ class MouvementStock extends CommonObject
* *
* @param variant $fk_origin id of origin * @param variant $fk_origin id of origin
* @param int $origintype origin type * @param int $origintype origin type
* @return string name url * @return string Url link to object
*/ */
function get_origin($fk_origin, $origintype) function get_origin($fk_origin, $origintype)
{ {
@ -664,15 +664,18 @@ class MouvementStock extends CommonObject
default: default:
if ($origintype) if ($origintype)
{ {
dol_include_once ('/'.$origintype.'/class/'.$origintype.'.class.php'); $result=dol_include_once('/'.$origintype.'/class/'.$origintype.'.class.php');
$classname = ucfirst($origintype); if ($result)
$origin = new $classname($this->db); {
$classname = ucfirst($origintype);
$origin = new $classname($this->db);
}
} }
else
return '';
break; break;
} }
if (empty($origin) || ! is_object($origin)) return '';
$origin->fetch($fk_origin); $origin->fetch($fk_origin);
return $origin->getNomUrl(1); return $origin->getNomUrl(1);
} }