2
0
forked from Wavyzz/dolibarr

More comments

This commit is contained in:
Laurent Destailleur
2011-07-01 23:05:39 +00:00
parent 795cb3c899
commit 5c1a13f95e
2 changed files with 12 additions and 9 deletions

View File

@@ -22,7 +22,7 @@
* \file htdocs/core/class/commonobject.class.php * \file htdocs/core/class/commonobject.class.php
* \ingroup core * \ingroup core
* \brief File of parent class of all other business classes (invoices, contracts, proposals, orders, ...) * \brief File of parent class of all other business classes (invoices, contracts, proposals, orders, ...)
* \version $Id: commonobject.class.php,v 1.142 2011/07/01 16:58:09 hregis Exp $ * \version $Id: commonobject.class.php,v 1.143 2011/07/01 23:05:39 eldy Exp $
*/ */
@@ -1287,7 +1287,7 @@ class CommonObject
if ($objecttype == 'delivery') { $classpath = 'livraison/class'; $subelement = 'livraison'; $module = 'livraison_bon'; } if ($objecttype == 'delivery') { $classpath = 'livraison/class'; $subelement = 'livraison'; $module = 'livraison_bon'; }
if ($objecttype == 'invoice_supplier') { $classpath = 'fourn/class'; } if ($objecttype == 'invoice_supplier') { $classpath = 'fourn/class'; }
if ($objecttype == 'order_supplier') { $classpath = 'fourn/class'; } if ($objecttype == 'order_supplier') { $classpath = 'fourn/class'; }
if ($objecttype == 'fichinter') { $classpath = 'fichinter/class'; $subelement ='fichinter'; $module ='ficheinter'; } if ($objecttype == 'fichinter') { $classpath = 'fichinter/class'; $subelement ='fichinter'; $module ='ficheinter'; }
$classfile = strtolower($subelement); $classname = ucfirst($subelement); $classfile = strtolower($subelement); $classname = ucfirst($subelement);
if ($objecttype == 'invoice_supplier') { $classfile = 'fournisseur.facture'; $classname='FactureFournisseur'; } if ($objecttype == 'invoice_supplier') { $classfile = 'fournisseur.facture'; $classname='FactureFournisseur'; }
@@ -1431,15 +1431,15 @@ class CommonObject
/** /**
* Instantiate hooks of thirdparty module * Init array this->hooks with instantiated controler and/or dao
* @param $type Type of hook * @param arraytype Array list of hooked tab/features. For example: thirdpartytab, ...
*/ */
function callHooks($arraytype) function callHooks($arraytype)
{ {
global $conf; global $conf;
if (! is_array($arraytype)) $arraytype=array($arraytype); if (! is_array($arraytype)) $arraytype=array($arraytype);
$i=0; $i=0;
foreach($conf->hooks_modules as $module => $hooks) foreach($conf->hooks_modules as $module => $hooks)
@@ -1454,13 +1454,15 @@ class CommonObject
$actionfile = 'actions_'.$module.'.class.php'; $actionfile = 'actions_'.$module.'.class.php';
$daofile = 'dao_'.$module.'.class.php'; $daofile = 'dao_'.$module.'.class.php';
$pathroot = ''; $pathroot = '';
$this->hooks[$i]['type']=$type; $this->hooks[$i]['type']=$type;
// Include actions class (controller) // Include actions class (controller)
//print 'include '.$path.$actionfile."\n";
$resaction=dol_include_once($path.$actionfile); $resaction=dol_include_once($path.$actionfile);
// Include dataservice class (model) // Include dataservice class (model)
//print 'include '.$path.$daofile."\n";
$resdao=dol_include_once($path.$daofile); $resdao=dol_include_once($path.$daofile);
// Instantiate actions class (controller) // Instantiate actions class (controller)
@@ -1471,13 +1473,14 @@ class CommonObject
$this->hooks[$i]['modules'][$objModule->module_number] = $objModule; $this->hooks[$i]['modules'][$objModule->module_number] = $objModule;
} }
// FIXME storing dao is useless here. It's goal of controller to known which dao to manage
if ($resdao) if ($resdao)
{ {
// Instantiate dataservice class (model) // Instantiate dataservice class (model)
$modelclassname = 'Dao'.ucfirst($module); $modelclassname = 'Dao'.ucfirst($module);
$this->hooks[$i]['modules'][$objModule->module_number]->object = new $modelclassname($this->db); $this->hooks[$i]['modules'][$objModule->module_number]->object = new $modelclassname($this->db);
} }
$i++; $i++;
} }
} }

View File

@@ -25,7 +25,7 @@
* \ingroup core * \ingroup core
* \brief Fichier de la classe de stockage de la config courante * \brief Fichier de la classe de stockage de la config courante
* \remarks La config est stockee dans le fichier conf/conf.php * \remarks La config est stockee dans le fichier conf/conf.php
* \version $Id$ * \version $Id: conf.class.php,v 1.59 2011/07/01 23:06:06 eldy Exp $
*/ */
@@ -153,7 +153,7 @@ class Conf
$modulename = strtolower($reg[1]); $modulename = strtolower($reg[1]);
$this->login_method_modules[] = DOL_DOCUMENT_ROOT.'/'.$modulename.'/inc/login/'; $this->login_method_modules[] = DOL_DOCUMENT_ROOT.'/'.$modulename.'/inc/login/';
} }
// If this is constant for hook activated by a module // If this is constant for hook activated by a module. Value is list of hooked tabs separated with :
elseif (preg_match('/^MAIN_MODULE_([A-Z_]+)_HOOKS$/i',$key,$reg)) elseif (preg_match('/^MAIN_MODULE_([A-Z_]+)_HOOKS$/i',$key,$reg))
{ {
$modulename = strtolower($reg[1]); $modulename = strtolower($reg[1]);