Avoir errors if hooks only on dao xor action

This commit is contained in:
Laurent Destailleur 2011-06-17 21:40:10 +00:00
parent d97109f53b
commit 9d5ddb19e9

View File

@ -1424,19 +1424,25 @@ class CommonObject
$pathroot = ''; $pathroot = '';
// Include actions class (controller) // Include actions class (controller)
dol_include_once($path.$actionfile); $resaction=dol_include_once($path.$actionfile);
// Include dataservice class (model) // Include dataservice class (model)
dol_include_once($path.$daofile); $resdao=dol_include_once($path.$daofile);
// Instantiate actions class (controller) // Instantiate actions class (controller)
$controlclassname = 'Actions'.ucfirst($module); if ($resaction)
$objModule = new $controlclassname($this->db); {
$this->hooks[$type][$objModule->module_number] = $objModule; $controlclassname = 'Actions'.ucfirst($module);
$objModule = new $controlclassname($this->db);
$this->hooks[$type][$objModule->module_number] = $objModule;
}
// Instantiate dataservice class (model) if ($resdao)
$modelclassname = 'Dao'.ucfirst($module); {
$this->hooks[$type][$objModule->module_number]->object = new $modelclassname($this->db); // Instantiate dataservice class (model)
$modelclassname = 'Dao'.ucfirst($module);
$this->hooks[$type][$objModule->module_number]->object = new $modelclassname($this->db);
}
} }
} }
} }