diff --git a/htdocs/adherents/class/adherent.class.php b/htdocs/adherents/class/adherent.class.php
index 5e5b83301cc..452805d1e2c 100644
--- a/htdocs/adherents/class/adherent.class.php
+++ b/htdocs/adherents/class/adherent.class.php
@@ -24,7 +24,7 @@
* \file htdocs/adherents/class/adherent.class.php
* \ingroup member
* \brief File of class to manage members of a foundation
- * \version $Id: adherent.class.php,v 1.47 2011/08/10 00:50:17 eldy Exp $
+ * \version $Id: adherent.class.php,v 1.48 2011/08/10 10:55:38 hregis Exp $
*/
require_once(DOL_DOCUMENT_ROOT."/core/class/commonobject.class.php");
@@ -423,7 +423,7 @@ class Adherent extends CommonObject
// Actions on extra fields (by external module or standard code)
include_once(DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php');
- $hookmanager=new HookManager($db);
+ $hookmanager=new HookManager($this->db);
$hookmanager->callHooks(array('member_extrafields'));
$reshook=$hookmanager->executeHooks('insertExtraFields',$action,$this,$socid); // Note that $action and $object may have been modified by some hooks
if (empty($reshook))
diff --git a/htdocs/comm/propal.php b/htdocs/comm/propal.php
index dfb3f6e15aa..2a7243652fc 100644
--- a/htdocs/comm/propal.php
+++ b/htdocs/comm/propal.php
@@ -26,7 +26,7 @@
* \file htdocs/comm/propal.php
* \ingroup propale
* \brief Page of commercial proposals card and list
- * \version $Id: propal.php,v 1.615 2011/08/08 01:53:26 eldy Exp $
+ * \version $Id: propal.php,v 1.616 2011/08/10 10:55:40 hregis Exp $
*/
require("../main.inc.php");
@@ -80,40 +80,17 @@ else if (isset($id) && $id > 0)
if ($user->societe_id) $socid=$user->societe_id;
$result = restrictedArea($user, $module, $objectid, $dbtable);
-// Instantiate hooks of thirdparty module
-if (is_array($conf->hooks_modules) && ! empty($conf->hooks_modules))
-{
- $object->callHooks('propalcard');
-}
+// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array
+include_once(DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php');
+$hookmanager=new HookManager($db);
+$hookmanager->callHooks(array('propalcard'));
/******************************************************************************/
/* Actions */
/******************************************************************************/
-// Hook of actions
-if (! empty($object->hooks))
-{
- foreach($object->hooks as $hook)
- {
- if (! empty($hook['modules']))
- {
- foreach($hook['modules'] as $module)
- {
- if (method_exists($module,'doActions'))
- {
- $reshook+=$module->doActions($object);
- if (! empty($module->error) || (! empty($module->errors) && sizeof($module->errors) > 0))
- {
- $mesg=$module->error; $mesgs[]=$module->errors;
- if ($action=='add') $action='create';
- if ($action=='update') $action='edit';
- }
- }
- }
- }
- }
-}
+$reshook=$hookmanager->executeHooks('doActions',$action,$object,$socid); // Note that $action and $object may have been modified by some hooks
// Action clone object
if ($action == 'confirm_clone' && $confirm == 'yes')
@@ -1094,24 +1071,8 @@ if ($id > 0 || ! empty($ref))
$formconfirm=$html->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('ValidateProp'), $text, 'confirm_validate','',0,1);
}
-
- // Hook for external modules
- if (empty($formconfirm) && ! empty($object->hooks))
- {
- foreach($object->hooks as $hook)
- {
- if (! empty($hook['modules']))
- {
- foreach($hook['modules'] as $module)
- {
- if (empty($formconfirm) && method_exists($module,'formconfirm'))
- {
- $formconfirm = $module->formconfirm($action,$object,$lineid);
- }
- }
- }
- }
- }
+
+ $formconfirm=$hookmanager->executeHooks('formconfirm',$action,$object,$lineid); // Note that $action and $object may have been modified by hook
// Print form confirm
print $formconfirm;
@@ -1473,7 +1434,6 @@ if ($id > 0 || ! empty($ref))
/*
* Lines
*/
- $result = $object->getLinesArray();
if ($conf->use_javascript_ajax && $object->statut == 0)
{
@@ -1485,7 +1445,8 @@ if ($id > 0 || ! empty($ref))
print '
';
// Show object lines
- if (! empty($object->lines)) $object->printObjectLines($action,$mysoc,$soc,$lineid);
+ $result = $object->getLinesArray();
+ if (! empty($object->lines)) $object->printObjectLines($action,$mysoc,$soc,$lineid,0,$hookmanager);
//print '';
@@ -1499,30 +1460,16 @@ if ($id > 0 || ! empty($ref))
$var=true;
// Add free products/services
- $object->formAddFreeProduct(0,$mysoc,$soc);
+ $object->formAddFreeProduct(0,$mysoc,$soc,$hookmanager);
// Add predefined products/services
if ($conf->product->enabled || $conf->service->enabled)
{
$var=!$var;
- $object->formAddPredefinedProduct(0,$mysoc,$soc);
+ $object->formAddPredefinedProduct(0,$mysoc,$soc,$hookmanager);
}
- // Hook for external modules
- foreach($object->hooks as $hook)
- {
- if (! empty($hook['modules']))
- {
- foreach($hook['modules'] as $module)
- {
- if (method_exists($module,'formAddObject'))
- {
- $var=!$var;
- $module->formAddObject($object);
- }
- }
- }
- }
+ $reshook=$hookmanager->executeHooks('formAddObject',$action,$object); // Note that $action and $object may have been modified by hook
}
}
@@ -1667,7 +1614,7 @@ if ($id > 0 || ! empty($ref))
$var=true;
- $somethingshown=$formfile->show_documents('propal',$filename,$filedir,$urlsource,$genallowed,$delallowed,$object->modelpdf,1,0,0,28,0,'',0,'',$soc->default_lang,$object->hooks);
+ $somethingshown=$formfile->show_documents('propal',$filename,$filedir,$urlsource,$genallowed,$delallowed,$object->modelpdf,1,0,0,28,0,'',0,'',$soc->default_lang,$hookmanager);
/*
@@ -1979,6 +1926,6 @@ else
}
$db->close();
-llxFooter('$Date: 2011/08/08 01:53:26 $ - $Revision: 1.615 $');
+llxFooter('$Date: 2011/08/10 10:55:40 $ - $Revision: 1.616 $');
?>
diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php
index 45820894f8b..e1e9031aa82 100644
--- a/htdocs/core/class/commonobject.class.php
+++ b/htdocs/core/class/commonobject.class.php
@@ -21,7 +21,7 @@
* \file htdocs/core/class/commonobject.class.php
* \ingroup core
* \brief File of parent class of all other business classes (invoices, contracts, proposals, orders, ...)
- * \version $Id: commonobject.class.php,v 1.151 2011/08/10 00:50:17 eldy Exp $
+ * \version $Id: commonobject.class.php,v 1.152 2011/08/10 10:55:37 hregis Exp $
*/
@@ -1615,7 +1615,7 @@ class CommonObject
* @param $seller Object thirdparty who sell
* @param $buyer Object thirdparty who buy
*/
- function formAddPredefinedProduct($dateSelector,$seller,$buyer)
+ function formAddPredefinedProduct($dateSelector,$seller,$buyer,$hookmanager=false)
{
global $conf,$langs,$object;
global $html,$bcnd,$var;
@@ -1630,7 +1630,7 @@ class CommonObject
* But for the moment we don't know if it'st possible as we keep a method available on overloaded objects.
* @param $dateSelector 1=Show also date range input fields
*/
- function formAddFreeProduct($dateSelector,$seller,$buyer)
+ function formAddFreeProduct($dateSelector,$seller,$buyer,$hookmanager=false)
{
global $conf,$langs,$object;
global $html,$bcnd,$var;
@@ -1655,7 +1655,7 @@ class CommonObject
* @param $selected Object line selected
* @param $dateSelector 1=Show also date range input fields
*/
- function printObjectLines($action='viewline',$seller,$buyer,$selected=0,$dateSelector=0)
+ function printObjectLines($action='viewline',$seller,$buyer,$selected=0,$dateSelector=0,$hookmanager='')
{
global $conf,$langs;
@@ -1698,10 +1698,13 @@ class CommonObject
{
$var=!$var;
- if (! empty($this->hooks) && ( ($line->product_type == 9 && ! empty($line->special_code)) || ! empty($line->fk_parent_line) ) )
+ if (is_object($hookmanager) && ( ($line->product_type == 9 && ! empty($line->special_code)) || ! empty($line->fk_parent_line) ) )
{
if (empty($line->fk_parent_line))
{
+ $parameters = array('line'=>$line,'var'=>$var,'num'=>$num,'i'=>$i,'dateSelector'=>$dateSelector,'seller'=>$seller,'buyer'=>$buyer,'selected'=>$selected);
+ $reshook=$hookmanager->executeHooks('printObjectLine',$action,$this,'',$parameters); // Note that $action and $object may have been modified by some hooks
+ /*
foreach($this->hooks as $hook)
{
if (method_exists($hook['modules'][$line->special_code],'printObjectLine'))
@@ -1709,11 +1712,12 @@ class CommonObject
$hook['modules'][$line->special_code]->printObjectLine($action,$this,$line,$var,$num,$i,$dateSelector,$seller,$buyer,$selected);
}
}
+ */
}
}
else
{
- $this->printLine($action,$line,$var,$num,$i,$dateSelector,$seller,$buyer,$selected);
+ $this->printLine($action,$line,$var,$num,$i,$dateSelector,$seller,$buyer,$selected,$hookmanager);
}
$i++;
@@ -1737,7 +1741,7 @@ class CommonObject
* @param $buyer Object of buyer third party
* @param $selected Object line selected
*/
- function printLine($action='viewline',$line,$var=true,$num=0,$i=0,$dateSelector=0,$seller,$buyer,$selected=0)
+ function printLine($action='viewline',$line,$var=true,$num=0,$i=0,$dateSelector=0,$seller,$buyer,$selected=0,$hookmanager=false)
{
global $conf,$langs,$user;
global $html,$bc,$bcdd;
diff --git a/htdocs/core/class/hookmanager.class.php b/htdocs/core/class/hookmanager.class.php
index 028bfea891f..e5bf5a208d4 100755
--- a/htdocs/core/class/hookmanager.class.php
+++ b/htdocs/core/class/hookmanager.class.php
@@ -21,7 +21,7 @@
* \file htdocs/core/class/hookmanager.class.php
* \ingroup core
* \brief File of class to manage hooks
- * \version $Id: hookmanager.class.php,v 1.1 2011/08/10 00:50:16 eldy Exp $
+ * \version $Id: hookmanager.class.php,v 1.2 2011/08/10 10:55:36 hregis Exp $
*/
@@ -78,7 +78,6 @@ class HookManager
if ($module == 'adherent') $path = 'adherents';
$path = '/'.$path.'/class/';
$actionfile = 'actions_'.$module.'.class.php';
- //$daofile = 'dao_'.$module.'.class.php';
$pathroot = '';
$this->hooks[$i]['type']=$type;
@@ -91,6 +90,17 @@ class HookManager
$objModule = new $controlclassname($this->db);
$this->hooks[$i]['modules'][$objModule->module_number] = $objModule;
}
+
+ // Include dataservice class (model)
+ // TODO storing dao is useless here. It's goal of controller to known which dao to manage
+ $daofile = 'dao_'.$module.'.class.php';
+ $resdao=dol_include_once($path.$daofile);
+ if ($resdao)
+ {
+ // Instantiate dataservice class (model)
+ $modelclassname = 'Dao'.ucfirst($module);
+ $this->hooks[$i]['modules'][$objModule->module_number]->object = new $modelclassname($this->db);
+ }
$i++;
}
@@ -105,23 +115,27 @@ class HookManager
* @param method Method name to hook ('doActions', 'printSearchForm', ...)
* @param action Action code ('create', 'edit', 'view', 'add', 'update', 'delete'...)
* @param object Object to use hooks on
- * @param socid Soc Id.
+ * @param id Id.
* @param string For doActions,showInputField,showOutputField: Return 0 if we want to keep doing standard actions, >0 if if want to stop standard actions, >0 means KO.
* For printSearchForm,printLeftBlock: Return HTML string.
* $this->error or this->errors are also defined with hooks errors.
*/
- function executeHooks($method, &$action='', &$object='', $id='')
+ function executeHooks($method, &$action='', &$object='', $id='', $parameters=false)
{
+ global $var;
+
if (! is_array($this->hooks) || empty($this->hooks)) return '';
// Loop on each hook
$resaction=0; $resprint='';
foreach($this->hooks as $hook)
{
- if (! empty($this->hook['modules']))
+ if (! empty($hook['modules']))
{
- foreach($this->hook['modules'] as $module)
+ foreach($hook['modules'] as $module)
{
+ $var=!$var;
+
// Hooks that return int
if ($method == 'doActions' && method_exists($module,$method))
{
@@ -137,7 +151,7 @@ class HookManager
$resaction+=$restmp;
}
}
- if ($method == 'showInputFields' && method_exists($module,$method))
+ else if ($method == 'showInputFields' && method_exists($module,$method))
{
$restmp+=$module->showInputFields($object, $action, $id); // action can be changed by method (to go back to other action for example), socid can be changed/set by method (during creation for example)
if ($restmp < 0 || ! empty($module->error) || (! empty($module->errors) && sizeof($module->errors) > 0))
@@ -149,7 +163,7 @@ class HookManager
$resaction+=$restmp;
}
}
- if ($method == 'showOutputFields' && method_exists($module,$method))
+ else if ($method == 'showOutputFields' && method_exists($module,$method))
{
$restmp+=$module->showOutputFields($object, $id); // action can be changed by method (to go back to other action for example), socid can be changed/set by method (during creation for example)
if ($restmp < 0 || ! empty($module->error) || (! empty($module->errors) && sizeof($module->errors) > 0))
@@ -162,18 +176,23 @@ class HookManager
}
}
// Hooks that return a string
- if ($method == 'printSearchForm' && method_exists($module,$method))
+ else if ($method == 'printSearchForm' && method_exists($module,$method))
{
$resprint.=''."\n";
$resprint.=$module->printSearchForm($object, $action, $id); // action can be changed by method (to go back to other action for example), socid can be changed/set by method (during creation for example)
$resprint.="\n".''."\n";
}
- if ($method == 'printLeftBlock' && method_exists($module,$method))
+ else if ($method == 'printLeftBlock' && method_exists($module,$method))
{
$resprint.=''."\n";
$resprint.=$module->printLeftBlock($object, $action, $id); // action can be changed by method (to go back to other action for example), socid can be changed/set by method (during creation for example)
$resprint.="\n".''."\n";
}
+ // Hook generic
+ else if (method_exists($module,$method))
+ {
+ $resprint.=$module->$method($object, $action, $id, $parameters, $this);
+ }
}
}
}
diff --git a/htdocs/core/class/html.formfile.class.php b/htdocs/core/class/html.formfile.class.php
index fc5dbe8206a..8f540c134ad 100644
--- a/htdocs/core/class/html.formfile.class.php
+++ b/htdocs/core/class/html.formfile.class.php
@@ -21,7 +21,7 @@
* \file htdocs/core/class/html.formfile.class.php
* \ingroup core
* \brief File of class to offer components to list and upload files
- * \version $Id: html.formfile.class.php,v 1.51 2011/07/31 23:45:14 eldy Exp $
+ * \version $Id: html.formfile.class.php,v 1.52 2011/08/10 10:55:37 hregis Exp $
*/
@@ -149,10 +149,10 @@ class FormFile
* @param hooks Object hook of external modules
* @return int <0 if KO, number of shown files if OK
*/
- function show_documents($modulepart,$filename,$filedir,$urlsource,$genallowed,$delallowed=0,$modelselected='',$allowgenifempty=1,$forcenomultilang=0,$iconPDF=0,$maxfilenamelength=28,$noform=0,$param='',$title='',$buttonlabel='',$codelang='',$hooks='')
+ function show_documents($modulepart,$filename,$filedir,$urlsource,$genallowed,$delallowed=0,$modelselected='',$allowgenifempty=1,$forcenomultilang=0,$iconPDF=0,$maxfilenamelength=28,$noform=0,$param='',$title='',$buttonlabel='',$codelang='',$hookmanager=false)
{
$this->numoffiles=0;
- print $this->showdocuments($modulepart,$filename,$filedir,$urlsource,$genallowed,$delallowed,$modelselected,$allowgenifempty,$forcenomultilang,$iconPDF,$maxfilenamelength,$noform,$param,$title,$buttonlabel,$codelang,$hooks);
+ print $this->showdocuments($modulepart,$filename,$filedir,$urlsource,$genallowed,$delallowed,$modelselected,$allowgenifempty,$forcenomultilang,$iconPDF,$maxfilenamelength,$noform,$param,$title,$buttonlabel,$codelang,$hookmanager);
return $this->numoffiles;
}
@@ -178,7 +178,7 @@ class FormFile
* @param hooks Object hook of external modules
* @return string Output string.
*/
- function showdocuments($modulepart,$filename,$filedir,$urlsource,$genallowed,$delallowed=0,$modelselected='',$allowgenifempty=1,$forcenomultilang=0,$iconPDF=0,$maxfilenamelength=28,$noform=0,$param='',$title='',$buttonlabel='',$codelang='',$hooks='')
+ function showdocuments($modulepart,$filename,$filedir,$urlsource,$genallowed,$delallowed=0,$modelselected='',$allowgenifempty=1,$forcenomultilang=0,$iconPDF=0,$maxfilenamelength=28,$noform=0,$param='',$title='',$buttonlabel='',$codelang='',$hookmanager=false)
{
// filedir = conf->...dir_ouput."/".get_exdir(id)
include_once(DOL_DOCUMENT_ROOT.'/lib/files.lib.php');
@@ -451,19 +451,7 @@ class FormFile
$out.= '';
// Execute hooks
- if (! empty($hooks) && is_array($hooks))
- {
- foreach($hooks as $hook)
- {
- if (! empty($hook['modules']))
- {
- foreach($hook['modules'] as $module)
- {
- if (method_exists($module,'formBuilddocOptions')) $out.= $module->formBuilddocOptions();
- }
- }
- }
- }
+ if (is_object($hookmanager)) $out.= $hookmanager->executeHooks('formBuilddocOptions');
}
// Get list of files
diff --git a/htdocs/core/tpl/freeproductline_create.tpl.php b/htdocs/core/tpl/freeproductline_create.tpl.php
index a9f84fe4ee1..bb694ac6229 100644
--- a/htdocs/core/tpl/freeproductline_create.tpl.php
+++ b/htdocs/core/tpl/freeproductline_create.tpl.php
@@ -15,7 +15,7 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see .
*
- * $Id: freeproductline_create.tpl.php,v 1.16 2011/08/04 21:46:50 eldy Exp $
+ * $Id: freeproductline_create.tpl.php,v 1.17 2011/08/10 10:55:36 hregis Exp $
*
* Need to have following variables defined:
* $conf
@@ -47,18 +47,7 @@
echo $html->select_type_of_lines(isset($_POST["type"])?$_POST["type"]:-1,'type',1);
if (($conf->product->enabled && $conf->service->enabled) || (empty($conf->product->enabled) && empty($conf->service->enabled))) echo '
';
- if (! empty($this->hooks)) {
- foreach($this->hooks as $hook) {
- if (! empty($hook['modules'])) {
- foreach($hook['modules'] as $module) {
- if (method_exists($module,'formCreateProductOptions')) {
- $module->formCreateProductOptions($object);
- echo '
';
- }
- }
- }
- }
- }
+ if (is_object($hookmanager)) $hookmanager->executeHooks('formCreateProductOptions',$action,$object);
// Editor wysiwyg
require_once(DOL_DOCUMENT_ROOT."/lib/doleditor.class.php");
diff --git a/htdocs/core/tpl/freeproductline_edit.tpl.php b/htdocs/core/tpl/freeproductline_edit.tpl.php
index 701d5c2c52d..b44b1931c6b 100644
--- a/htdocs/core/tpl/freeproductline_edit.tpl.php
+++ b/htdocs/core/tpl/freeproductline_edit.tpl.php
@@ -15,7 +15,7 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see .
*
- * $Id: freeproductline_edit.tpl.php,v 1.16 2011/08/04 21:46:50 eldy Exp $
+ * $Id: freeproductline_edit.tpl.php,v 1.17 2011/08/10 10:55:34 hregis Exp $
*
* Need to have following variables defined:
* $conf
@@ -39,18 +39,7 @@
hooks)) {
- foreach($this->hooks as $hook) {
- if (! empty($hook['modules'])) {
- foreach($hook['modules'] as $module) {
- if (method_exists($module,'formEditProductOptions')) {
- $module->formEditProductOptions($this,$line->fk_parent_line);
- echo '
';
- }
- }
- }
- }
- }
+ if (is_object($hookmanager)) $hookmanager->executeHooks('formEditProductOptions',$action,$this,$line->fk_parent_line);
// editeur wysiwyg
$nbrows=ROWS_2;
diff --git a/htdocs/core/tpl/predefinedproductline_create.tpl.php b/htdocs/core/tpl/predefinedproductline_create.tpl.php
index 86244251479..e139c9ea45d 100644
--- a/htdocs/core/tpl/predefinedproductline_create.tpl.php
+++ b/htdocs/core/tpl/predefinedproductline_create.tpl.php
@@ -15,7 +15,7 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see .
*
- * $Id: predefinedproductline_create.tpl.php,v 1.14 2011/07/31 23:45:12 eldy Exp $
+ * $Id: predefinedproductline_create.tpl.php,v 1.15 2011/08/10 10:55:35 hregis Exp $
*
* Need to have following variables defined:
* $conf
@@ -59,18 +59,7 @@
if (! $conf->global->PRODUIT_USE_SEARCH_TO_SELECT) echo '
';
- if (! empty($this->hooks)) {
- foreach($this->hooks as $hook) {
- if (! empty($hook['modules'])) {
- foreach($hook['modules'] as $module) {
- if (method_exists($module,'formCreateProductOptions')) {
- $module->formCreateProductOptions($object);
- echo '
';
- }
- }
- }
- }
- }
+ if (is_object($hookmanager)) $hookmanager->executeHooks('formCreateProductOptions',$action,$object);
// Editor wysiwyg
require_once(DOL_DOCUMENT_ROOT."/lib/doleditor.class.php");
diff --git a/htdocs/core/tpl/predefinedproductline_edit.tpl.php b/htdocs/core/tpl/predefinedproductline_edit.tpl.php
index 09b7d7dd81e..637dc4f1191 100644
--- a/htdocs/core/tpl/predefinedproductline_edit.tpl.php
+++ b/htdocs/core/tpl/predefinedproductline_edit.tpl.php
@@ -15,7 +15,7 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see .
*
- * $Id: predefinedproductline_edit.tpl.php,v 1.15 2011/08/04 21:46:50 eldy Exp $
+ * $Id: predefinedproductline_edit.tpl.php,v 1.16 2011/08/10 10:55:34 hregis Exp $
*
* Need to have following variables defined:
* $conf
@@ -47,18 +47,7 @@
echo ' - '.nl2br($line->product_label);
echo '
';
- if (! empty($this->hooks)) {
- foreach($this->hooks as $hook) {
- if (! empty($hook['modules'])) {
- foreach($hook['modules'] as $module) {
- if (method_exists($module,'formEditProductOptions')) {
- $module->formEditProductOptions($this,$line->fk_parent_line);
- echo '
';
- }
- }
- }
- }
- }
+ if (is_object($hookmanager)) $hookmanager->executeHooks('formEditProductOptions',$action,$this,$line->fk_parent_line);
// editeur wysiwyg
$nbrows=ROWS_2;
diff --git a/htdocs/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php
index 3aa32189562..882e4ef1232 100644
--- a/htdocs/societe/class/societe.class.php
+++ b/htdocs/societe/class/societe.class.php
@@ -26,7 +26,7 @@
* \file htdocs/societe/class/societe.class.php
* \ingroup societe
* \brief File for third party class
- * \version $Id: societe.class.php,v 1.94 2011/08/10 00:50:16 eldy Exp $
+ * \version $Id: societe.class.php,v 1.95 2011/08/10 10:55:39 hregis Exp $
*/
require_once(DOL_DOCUMENT_ROOT."/core/class/commonobject.class.php");
@@ -535,7 +535,7 @@ class Societe extends CommonObject
// Actions on extra fields (by external module or standard code)
include_once(DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php');
- $hookmanager=new HookManager($db);
+ $hookmanager=new HookManager($this->db);
$hookmanager->callHooks(array('thirdparty_extrafields'));
$reshook=$hookmanager->executeHooks('insertExtraFields',$action,$this,$socid); // Note that $action and $object may have been modified by some hooks
if (empty($reshook))