2
0
forked from Wavyzz/dolibarr

Fix : bad usage of this

This commit is contained in:
Jean-François Ferry
2014-03-24 00:31:49 +01:00
committed by jfefe
parent a76fef5f35
commit b3f7e9f99b

View File

@@ -1755,25 +1755,26 @@ function getElementProperties($element_type)
* Fetch an object with element_type and its id * Fetch an object with element_type and its id
* Inclusion classes is automatic * Inclusion classes is automatic
* *
* @param int $element_id * @param int $element_id Element id
* @param string $element_type * @param string $element_type Element type
* @return object || 0 || -1 if error * @return object || 0 || -1 if error
*/ */
function fetchObjectByElement($element_id,$element_type) { function fetchObjectByElement($element_id,$element_type) {
global $conf; global $conf;
global $db,$conf;
$element_prop = getElementProperties($element_type); $element_prop = getElementProperties($element_type);
if (is_array($element_prop) && $conf->$element_prop['module']->enabled) if (is_array($element_prop) && $conf->$element_prop['module']->enabled)
{ {
dol_include_once('/'.$element_prop['classpath'].'/'.$element_prop['classfile'].'.class.php'); dol_include_once('/'.$element_prop['classpath'].'/'.$element_prop['classfile'].'.class.php');
$objectstat = new $element_prop['classname']($this->db); $objectstat = new $element_prop['classname']($db);
$ret = $objectstat->fetch($element_id); $ret = $objectstat->fetch($element_id);
if ($ret >= 0) if ($ret >= 0)
{ {
return $objectstat; return $objectstat;
} }
} }
return 0; return 0;
} }