diff --git a/htdocs/comm/propal.php b/htdocs/comm/propal.php
index b2d68660cf7..206d325be13 100644
--- a/htdocs/comm/propal.php
+++ b/htdocs/comm/propal.php
@@ -93,9 +93,9 @@ if (is_array($conf->hooks_modules) && !empty($conf->hooks_modules))
/******************************************************************************/
// Hook of thirdparty module
-if (! empty($object->hooks))
+if (! empty($object->hooks['objectcard']))
{
- foreach($object->hooks as $module)
+ foreach($object->hooks['objectcard'] as $module)
{
$module->doActions($object);
$mesg = $module->error;
@@ -1082,9 +1082,9 @@ if ($id > 0 || ! empty($ref))
}
// Hook of thirdparty module
- if (empty($formconfirm) && ! empty($object->hooks))
+ if (empty($formconfirm) && ! empty($object->hooks['objectcard']))
{
- foreach($object->hooks as $module)
+ foreach($object->hooks['objectcard'] as $module)
{
if (empty($formconfirm)) $formconfirm = $module->formconfirm($action,$object,$lineid);
}
@@ -1491,9 +1491,9 @@ if ($id > 0 || ! empty($ref))
}
// Hook of thirdparty module
- if (! empty($object->hooks))
+ if (! empty($object->hooks['objectcard']))
{
- foreach($object->hooks as $module)
+ foreach($object->hooks['objectcard'] as $module)
{
$var=!$var;
$module->formAddObject($object);
@@ -1643,7 +1643,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,$object->hooks['objectcard']);
/*
diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php
index 825dd16edec..4eca267b20f 100644
--- a/htdocs/comm/propal/class/propal.class.php
+++ b/htdocs/comm/propal/class/propal.class.php
@@ -906,9 +906,9 @@ class Propal extends CommonObject
if (! $error)
{
// Hook of thirdparty module
- if (! empty($object->hooks))
+ if (! empty($object->hooks['objectcard']))
{
- foreach($object->hooks as $module)
+ foreach($object->hooks['objectcard'] as $module)
{
$result = $module->createfrom($objFrom,$result,$object->element);
if ($result < 0) $error++;
diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php
index 624bbc500fa..240d094c171 100644
--- a/htdocs/commande/class/commande.class.php
+++ b/htdocs/commande/class/commande.class.php
@@ -808,9 +808,9 @@ class Commande extends CommonObject
if (! $error)
{
// Hook of thirdparty module
- if (! empty($object->hooks))
+ if (! empty($object->hooks['objectcard']))
{
- foreach($object->hooks as $module)
+ foreach($object->hooks['objectcard'] as $module)
{
$result = $module->createfrom($objFrom,$result,$object->element);
if ($result < 0) $error++;
@@ -902,9 +902,9 @@ class Commande extends CommonObject
if ($ret > 0)
{
// Hooks
- if (! empty($object->hooks))
+ if (! empty($object->hooks['objectcard']))
{
- foreach($object->hooks as $module)
+ foreach($object->hooks['objectcard'] as $module)
{
$result = $module->createfrom($object,$ret,$this->element);
if ($result < 0) $error++;
diff --git a/htdocs/commande/fiche.php b/htdocs/commande/fiche.php
index 7bbda87d30d..68dc1b2aa0b 100644
--- a/htdocs/commande/fiche.php
+++ b/htdocs/commande/fiche.php
@@ -78,9 +78,9 @@ if (is_array($conf->hooks_modules) && !empty($conf->hooks_modules))
/******************************************************************************/
// Hook of thirdparty module
-if (! empty($object->hooks))
+if (! empty($object->hooks['objectcard']))
{
- foreach($object->hooks as $module)
+ foreach($object->hooks['objectcard'] as $module)
{
$module->doActions($object);
$mesg = $module->error;
@@ -305,9 +305,9 @@ if ($action == 'add' && $user->rights->commande->creer)
}
// Hooks
- if (! empty($object->hooks))
+ if (! empty($object->hooks['objectcard']))
{
- foreach($object->hooks as $module)
+ foreach($object->hooks['objectcard'] as $module)
{
$res = $module->createfrom($srcobject,$object_id,$object->element);
if ($res < 0) $error++;
@@ -1516,9 +1516,9 @@ else
}
// Hook of thirdparty module
- if (empty($formconfirm) && ! empty($object->hooks))
+ if (empty($formconfirm) && ! empty($object->hooks['objectcard']))
{
- foreach($object->hooks as $module)
+ foreach($object->hooks['objectcard'] as $module)
{
if (empty($formconfirm)) $formconfirm = $module->formconfirm($action,$object,$lineid);
}
@@ -1874,9 +1874,9 @@ else
}
// Hook of thirdparty module
- if (! empty($object->hooks))
+ if (! empty($object->hooks['objectcard']))
{
- foreach($object->hooks as $module)
+ foreach($object->hooks['objectcard'] as $module)
{
$var=!$var;
$module->formAddObject($object);
@@ -2017,7 +2017,7 @@ else
$genallowed=$user->rights->commande->creer;
$delallowed=$user->rights->commande->supprimer;
- $somethingshown=$formfile->show_documents('commande',$comref,$filedir,$urlsource,$genallowed,$delallowed,$object->modelpdf,1,0,0,28,0,'','','',$soc->default_lang,$object->hooks);
+ $somethingshown=$formfile->show_documents('commande',$comref,$filedir,$urlsource,$genallowed,$delallowed,$object->modelpdf,1,0,0,28,0,'','','',$soc->default_lang,$object->hooks['objectcard']);
/*
* Linked object block
diff --git a/htdocs/compta/facture.php b/htdocs/compta/facture.php
index 209befd462f..de6faf6e3b0 100644
--- a/htdocs/compta/facture.php
+++ b/htdocs/compta/facture.php
@@ -86,9 +86,9 @@ if (is_array($conf->hooks_modules) && !empty($conf->hooks_modules))
/******************************************************************************/
// Hook of thirdparty module
-if (! empty($object->hooks))
+if (! empty($object->hooks['objectcard']))
{
- foreach($object->hooks as $module)
+ foreach($object->hooks['objectcard'] as $module)
{
$module->doActions($object);
$mesg = $module->error;
@@ -768,9 +768,9 @@ if ($action == 'add' && $user->rights->facture->creer)
}
// Hooks
- if (! empty($object->hooks))
+ if (! empty($object->hooks['objectcard']))
{
- foreach($object->hooks as $module)
+ foreach($object->hooks['objectcard'] as $module)
{
$res = $module->createfrom($srcobject,$id,$object->element);
if ($res < 0) $error++;
@@ -2026,9 +2026,9 @@ else
}
// Hook of thirdparty module
- if (empty($formconfirm) && ! empty($object->hooks))
+ if (empty($formconfirm) && ! empty($object->hooks['objectcard']))
{
- foreach($object->hooks as $module)
+ foreach($object->hooks['objectcard'] as $module)
{
if (empty($formconfirm)) $formconfirm = $module->formconfirm($action,$object,$lineid);
}
@@ -2555,9 +2555,9 @@ else
}
// Hook of thirdparty module
- if (! empty($object->hooks))
+ if (! empty($object->hooks['objectcard']))
{
- foreach($object->hooks as $module)
+ foreach($object->hooks['objectcard'] as $module)
{
$var=!$var;
$module->formAddObject($object);
@@ -2798,7 +2798,7 @@ else
$delallowed=$user->rights->facture->supprimer;
print '
';
- $somethingshown=$formfile->show_documents('facture',$filename,$filedir,$urlsource,$genallowed,$delallowed,$object->modelpdf,1,0,0,28,0,'','','',$soc->default_lang,$object->hooks);
+ $somethingshown=$formfile->show_documents('facture',$filename,$filedir,$urlsource,$genallowed,$delallowed,$object->modelpdf,1,0,0,28,0,'','','',$soc->default_lang,$object->hooks['objectcard']);
/*
* Linked object block
diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php
index acf4a47d0e3..bfb9843379c 100644
--- a/htdocs/compta/facture/class/facture.class.php
+++ b/htdocs/compta/facture/class/facture.class.php
@@ -572,9 +572,9 @@ class Facture extends CommonObject
if (! $error)
{
// Hook of thirdparty module
- if (! empty($object->hooks))
+ if (! empty($object->hooks['objectcard']))
{
- foreach($object->hooks as $module)
+ foreach($object->hooks['objectcard'] as $module)
{
$result = $module->createfrom($objFrom,$result,$object->element);
if ($result < 0) $error++;
diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php
index 31b419215e1..6643f6e674a 100644
--- a/htdocs/core/class/commonobject.class.php
+++ b/htdocs/core/class/commonobject.class.php
@@ -1404,37 +1404,41 @@ class CommonObject
* Instantiate hooks of thirdparty module
* @param $type Type of hook
*/
- function callHooks($type='objectcard')
+ function callHooks($arraytype)
{
global $conf;
+
+ if (! is_array($arraytype)) $arraytype=array($arraytype);
foreach($conf->hooks_modules as $module => $hooks)
{
- if ($conf->$module->enabled && in_array($type,$hooks))
+ if ($conf->$module->enabled)
{
- $path = '/'.$module.'/class/';
- $actionfile = 'actions_'.$module.'.class.php';
- $daofile = 'dao_'.$module.'.class.php';
- $pathroot = '';
-
- // Include actions class (controller)
- dol_include_once($path.$actionfile);
-
- // Include dataservice class (model)
- dol_include_once($path.$daofile);
-
- // Instantiate actions class (controller)
- $controlclassname = 'Actions'.ucfirst($module);
- $objModule = new $controlclassname($this->db);
- $this->hooks[$objModule->module_number] = $objModule;
-
- // Instantiate dataservice class (model)
- $modelclassname = 'Dao'.ucfirst($module);
- $this->hooks[$objModule->module_number]->object = new $modelclassname($this->db);
-
- // We comment this because library must be included into file that need it,
- // so include should be done into actions_ and/or dao file
- // dol_include_once('/'.$module.'/lib/'.$module.'.lib.php');
+ foreach($arraytype as $type)
+ {
+ if (in_array($type,$hooks))
+ {
+ $path = '/'.$module.'/class/';
+ $actionfile = 'actions_'.$module.'.class.php';
+ $daofile = 'dao_'.$module.'.class.php';
+ $pathroot = '';
+
+ // Include actions class (controller)
+ dol_include_once($path.$actionfile);
+
+ // Include dataservice class (model)
+ dol_include_once($path.$daofile);
+
+ // Instantiate actions class (controller)
+ $controlclassname = 'Actions'.ucfirst($module);
+ $objModule = new $controlclassname($this->db);
+ $this->hooks[$type][$objModule->module_number] = $objModule;
+
+ // Instantiate dataservice class (model)
+ $modelclassname = 'Dao'.ucfirst($module);
+ $this->hooks[$type][$objModule->module_number]->object = new $modelclassname($this->db);
+ }
+ }
}
}
}
@@ -1597,7 +1601,7 @@ class CommonObject
if (($line->product_type == 9 && ! empty($line->special_code)) || ! empty($line->fk_parent_line))
{
- if (empty($line->fk_parent_line)) $this->hooks[$line->special_code]->printObjectLine($action,$this,$line,$var,$num,$i,$dateSelector,$seller,$buyer,$selected);
+ if (empty($line->fk_parent_line)) $this->hooks['objectcard'][$line->special_code]->printObjectLine($action,$this,$line,$var,$num,$i,$dateSelector,$seller,$buyer,$selected);
}
else
{
@@ -1715,7 +1719,7 @@ class CommonObject
if (($line->product_type == 9 && ! empty($line->special_code)) || ! empty($line->fk_parent_line))
{
- if (empty($line->fk_parent_line)) $object->hooks[$line->special_code]->printOriginObjectLine($this,$line,$var,$i);
+ if (empty($line->fk_parent_line)) $object->hooks['objectcard'][$line->special_code]->printOriginObjectLine($this,$line,$var,$i);
}
else
{
diff --git a/htdocs/core/tpl/freeproductline_create.tpl.php b/htdocs/core/tpl/freeproductline_create.tpl.php
index adbe70e596a..9e8747584c8 100644
--- a/htdocs/core/tpl/freeproductline_create.tpl.php
+++ b/htdocs/core/tpl/freeproductline_create.tpl.php
@@ -48,8 +48,8 @@
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($object->hooks)) {
- foreach($object->hooks as $module) {
+ if (! empty($object->hooks['objectcard'])) {
+ foreach($object->hooks['objectcard'] as $module) {
$module->formCreateProductOptions($object);
}
echo '
';
diff --git a/htdocs/core/tpl/predefinedproductline_create.tpl.php b/htdocs/core/tpl/predefinedproductline_create.tpl.php
index 727b84b68af..678fdf2a374 100644
--- a/htdocs/core/tpl/predefinedproductline_create.tpl.php
+++ b/htdocs/core/tpl/predefinedproductline_create.tpl.php
@@ -60,8 +60,8 @@
if (! $conf->global->PRODUIT_USE_SEARCH_TO_SELECT) echo '
';
- if (! empty($object->hooks)) {
- foreach($object->hooks as $module) {
+ if (! empty($object->hooks['objectcard'])) {
+ foreach($object->hooks['objectcard'] as $module) {
$module->formCreateProductOptions($object);
}
echo '
';
diff --git a/htdocs/lib/pdf.lib.php b/htdocs/lib/pdf.lib.php
index 702329aade4..1df2aed55ab 100644
--- a/htdocs/lib/pdf.lib.php
+++ b/htdocs/lib/pdf.lib.php
@@ -653,11 +653,11 @@ function pdf_writelinedesc(&$pdf,$object,$i,$outputlangs,$w,$h,$posx,$posy,$hide
{
global $db, $conf, $langs;
- if (! empty($object->hooks) && ( ($object->lines[$i]->product_type == 9 && ! empty($object->lines[$i]->special_code) ) || ! empty($object->lines[$i]->fk_parent_line) ) )
+ if (! empty($object->hooks['objectcard']) && ( ($object->lines[$i]->product_type == 9 && ! empty($object->lines[$i]->special_code) ) || ! empty($object->lines[$i]->fk_parent_line) ) )
{
$special_code = $object->lines[$i]->special_code;
if (! empty($object->lines[$i]->fk_parent_line)) $special_code = $object->getSpecialCode($object->lines[$i]->fk_parent_line);
- return $object->hooks[$special_code]->pdf_writelinedesc($pdf,$object,$i,$outputlangs,$w,$h,$posx,$posy,$hideref,$hidedesc,$issupplierline);
+ return $object->hooks['objectcard'][$special_code]->pdf_writelinedesc($pdf,$object,$i,$outputlangs,$w,$h,$posx,$posy,$hideref,$hidedesc,$issupplierline);
}
else
{
@@ -810,7 +810,7 @@ function pdf_getlinedesc($object,$i,$outputlangs,$hideref=0,$hidedesc=0,$issuppl
*/
function pdf_getlinenum($object,$i,$outputlangs)
{
- if (! empty($object->hooks) && ( ($object->lines[$i]->product_type == 9 && !empty($object->lines[$i]->special_code) ) || ! empty($object->lines[$i]->fk_parent_line) ) )
+ if (! empty($object->hooks['objectcard']) && ( ($object->lines[$i]->product_type == 9 && !empty($object->lines[$i]->special_code) ) || ! empty($object->lines[$i]->fk_parent_line) ) )
{
$special_code = $object->lines[$i]->special_code;
if (! empty($object->lines[$i]->fk_parent_line)) $special_code = $object->getSpecialCode($object->lines[$i]->fk_parent_line);
@@ -831,7 +831,7 @@ function pdf_getlinenum($object,$i,$outputlangs)
*/
function pdf_getlineref($object,$i,$outputlangs)
{
- if (! empty($object->hooks) && ( ($object->lines[$i]->product_type == 9 && !empty($object->lines[$i]->special_code) ) || ! empty($object->lines[$i]->fk_parent_line) ) )
+ if (! empty($object->hooks['objectcard']) && ( ($object->lines[$i]->product_type == 9 && !empty($object->lines[$i]->special_code) ) || ! empty($object->lines[$i]->fk_parent_line) ) )
{
$special_code = $object->lines[$i]->special_code;
if (! empty($object->lines[$i]->fk_parent_line)) $special_code = $object->getSpecialCode($object->lines[$i]->fk_parent_line);
@@ -851,7 +851,7 @@ function pdf_getlineref($object,$i,$outputlangs)
*/
function pdf_getlineref_supplier($object,$i,$outputlangs)
{
- if (! empty($object->hooks) && ( ($object->lines[$i]->product_type == 9 && !empty($object->lines[$i]->special_code) ) || ! empty($object->lines[$i]->fk_parent_line) ) )
+ if (! empty($object->hooks['objectcard']) && ( ($object->lines[$i]->product_type == 9 && !empty($object->lines[$i]->special_code) ) || ! empty($object->lines[$i]->fk_parent_line) ) )
{
$special_code = $object->lines[$i]->special_code;
if (! empty($object->lines[$i]->fk_parent_line)) $special_code = $object->getSpecialCode($object->lines[$i]->fk_parent_line);
@@ -875,11 +875,11 @@ function pdf_getlineref_supplier($object,$i,$outputlangs)
*/
function pdf_getlinevatrate($object,$i,$outputlangs,$hidedetails=0)
{
- if (! empty($object->hooks) && ( ($object->lines[$i]->product_type == 9 && !empty($object->lines[$i]->special_code) ) || ! empty($object->lines[$i]->fk_parent_line) ) )
+ if (! empty($object->hooks['objectcard']) && ( ($object->lines[$i]->product_type == 9 && !empty($object->lines[$i]->special_code) ) || ! empty($object->lines[$i]->fk_parent_line) ) )
{
$special_code = $object->lines[$i]->special_code;
if (! empty($object->lines[$i]->fk_parent_line)) $special_code = $object->getSpecialCode($object->lines[$i]->fk_parent_line);
- return $object->hooks[$special_code]->pdf_getlinevatrate($object,$i,$outputlangs,$hidedetails);
+ return $object->hooks['objectcard'][$special_code]->pdf_getlinevatrate($object,$i,$outputlangs,$hidedetails);
}
else
{
@@ -899,11 +899,11 @@ function pdf_getlinevatrate($object,$i,$outputlangs,$hidedetails=0)
*/
function pdf_getlineupexcltax($object,$i,$outputlangs,$hidedetails=0)
{
- if (! empty($object->hooks) && ( ($object->lines[$i]->product_type == 9 && !empty($object->lines[$i]->special_code) ) || ! empty($object->lines[$i]->fk_parent_line) ) )
+ if (! empty($object->hooks['objectcard']) && ( ($object->lines[$i]->product_type == 9 && !empty($object->lines[$i]->special_code) ) || ! empty($object->lines[$i]->fk_parent_line) ) )
{
$special_code = $object->lines[$i]->special_code;
if (! empty($object->lines[$i]->fk_parent_line)) $special_code = $object->getSpecialCode($object->lines[$i]->fk_parent_line);
- return $object->hooks[$special_code]->pdf_getlineupexcltax($object,$i,$outputlangs,$hidedetails);
+ return $object->hooks['objectcard'][$special_code]->pdf_getlineupexcltax($object,$i,$outputlangs,$hidedetails);
}
else
{
@@ -925,11 +925,11 @@ function pdf_getlineqty($object,$i,$outputlangs,$hidedetails=0)
{
if ($object->lines[$i]->special_code != 3)
{
- if (! empty($object->hooks) && (( $object->lines[$i]->product_type == 9 && !empty($object->lines[$i]->special_code) ) || ! empty($object->lines[$i]->fk_parent_line) ) )
+ if (! empty($object->hooks['objectcard']) && (( $object->lines[$i]->product_type == 9 && !empty($object->lines[$i]->special_code) ) || ! empty($object->lines[$i]->fk_parent_line) ) )
{
$special_code = $object->lines[$i]->special_code;
if (! empty($object->lines[$i]->fk_parent_line)) $special_code = $object->getSpecialCode($object->lines[$i]->fk_parent_line);
- return $object->hooks[$special_code]->pdf_getlineqty($object,$i,$outputlangs,$hidedetails);
+ return $object->hooks['objectcard'][$special_code]->pdf_getlineqty($object,$i,$outputlangs,$hidedetails);
}
else
{
@@ -952,11 +952,11 @@ function pdf_getlineqty_asked($object,$i,$outputlangs,$hidedetails=0)
{
if ($object->lines[$i]->special_code != 3)
{
- if (! empty($object->hooks) && (( $object->lines[$i]->product_type == 9 && !empty($object->lines[$i]->special_code) ) || ! empty($object->lines[$i]->fk_parent_line) ) )
+ if (! empty($object->hooks['objectcard']) && (( $object->lines[$i]->product_type == 9 && !empty($object->lines[$i]->special_code) ) || ! empty($object->lines[$i]->fk_parent_line) ) )
{
$special_code = $object->lines[$i]->special_code;
if (! empty($object->lines[$i]->fk_parent_line)) $special_code = $object->getSpecialCode($object->lines[$i]->fk_parent_line);
- return $object->hooks[$special_code]->pdf_getlineqty_asked($object,$i,$outputlangs,$hidedetails);
+ return $object->hooks['objectcard'][$special_code]->pdf_getlineqty_asked($object,$i,$outputlangs,$hidedetails);
}
else
{
@@ -979,11 +979,11 @@ function pdf_getlineqty_shipped($object,$i,$outputlangs,$hidedetails=0)
{
if ($object->lines[$i]->special_code != 3)
{
- if (! empty($object->hooks) && (( $object->lines[$i]->product_type == 9 && !empty($object->lines[$i]->special_code) ) || ! empty($object->lines[$i]->fk_parent_line) ) )
+ if (! empty($object->hooks['objectcard']) && (( $object->lines[$i]->product_type == 9 && !empty($object->lines[$i]->special_code) ) || ! empty($object->lines[$i]->fk_parent_line) ) )
{
$special_code = $object->lines[$i]->special_code;
if (! empty($object->lines[$i]->fk_parent_line)) $special_code = $object->getSpecialCode($object->lines[$i]->fk_parent_line);
- return $object->hooks[$special_code]->pdf_getlineqty_shipped($object,$i,$outputlangs,$hidedetails);
+ return $object->hooks['objectcard'][$special_code]->pdf_getlineqty_shipped($object,$i,$outputlangs,$hidedetails);
}
else
{
@@ -1006,11 +1006,11 @@ function pdf_getlineqty_keeptoship($object,$i,$outputlangs,$hidedetails=0)
{
if ($object->lines[$i]->special_code != 3)
{
- if (! empty($object->hooks) && (( $object->lines[$i]->product_type == 9 && !empty($object->lines[$i]->special_code) ) || ! empty($object->lines[$i]->fk_parent_line) ) )
+ if (! empty($object->hooks['objectcard']) && (( $object->lines[$i]->product_type == 9 && !empty($object->lines[$i]->special_code) ) || ! empty($object->lines[$i]->fk_parent_line) ) )
{
$special_code = $object->lines[$i]->special_code;
if (! empty($object->lines[$i]->fk_parent_line)) $special_code = $object->getSpecialCode($object->lines[$i]->fk_parent_line);
- return $object->hooks[$special_code]->pdf_getlineqty_keeptoship($object,$i,$outputlangs,$hidedetails);
+ return $object->hooks['objectcard'][$special_code]->pdf_getlineqty_keeptoship($object,$i,$outputlangs,$hidedetails);
}
else
{
@@ -1035,11 +1035,11 @@ function pdf_getlineremisepercent($object,$i,$outputlangs,$hidedetails=0)
if ($object->lines[$i]->special_code != 3)
{
- if (! empty($object->hooks) && ( ($object->lines[$i]->product_type == 9 && !empty($object->lines[$i]->special_code) ) || ! empty($object->lines[$i]->fk_parent_line) ) )
+ if (! empty($object->hooks['objectcard']) && ( ($object->lines[$i]->product_type == 9 && !empty($object->lines[$i]->special_code) ) || ! empty($object->lines[$i]->fk_parent_line) ) )
{
$special_code = $object->lines[$i]->special_code;
if (! empty($object->lines[$i]->fk_parent_line)) $special_code = $object->getSpecialCode($object->lines[$i]->fk_parent_line);
- return $object->hooks[$special_code]->pdf_getlineremisepercent($object,$i,$outputlangs,$hidedetails);
+ return $object->hooks['objectcard'][$special_code]->pdf_getlineremisepercent($object,$i,$outputlangs,$hidedetails);
}
else
{
@@ -1066,11 +1066,11 @@ function pdf_getlinetotalexcltax($object,$i,$outputlangs,$hidedetails=0)
}
else
{
- if (! empty($object->hooks) && ( ($object->lines[$i]->product_type == 9 && ! empty($object->lines[$i]->special_code) ) || ! empty($object->lines[$i]->fk_parent_line) ) )
+ if (! empty($object->hooks['objectcard']) && ( ($object->lines[$i]->product_type == 9 && ! empty($object->lines[$i]->special_code) ) || ! empty($object->lines[$i]->fk_parent_line) ) )
{
$special_code = $object->lines[$i]->special_code;
if (! empty($object->lines[$i]->fk_parent_line)) $special_code = $object->getSpecialCode($object->lines[$i]->fk_parent_line);
- return $object->hooks[$special_code]->pdf_getlinetotalexcltax($object,$i,$outputlangs,$hidedetails);
+ return $object->hooks['objectcard'][$special_code]->pdf_getlinetotalexcltax($object,$i,$outputlangs,$hidedetails);
}
else
{
@@ -1099,7 +1099,7 @@ function pdf_getTotalQty($object,$type='',$outputlangs)
{
$total += $object->lines[$i]->qty;
}
- else if ($type==9 && ! empty($object->hooks) && ( ($object->lines[$i]->product_type == 9 && ! empty($object->lines[$i]->special_code) ) || ! empty($object->lines[$i]->fk_parent_line) ) )
+ else if ($type==9 && ! empty($object->hooks['objectcard']) && ( ($object->lines[$i]->product_type == 9 && ! empty($object->lines[$i]->special_code) ) || ! empty($object->lines[$i]->fk_parent_line) ) )
{
$special_code = $object->lines[$i]->special_code;
if (! empty($object->lines[$i]->fk_parent_line)) $special_code = $object->getSpecialCode($object->lines[$i]->fk_parent_line);
diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php
index 86ba359b028..c83120d7194 100644
--- a/htdocs/main.inc.php
+++ b/htdocs/main.inc.php
@@ -1331,7 +1331,14 @@ function left_menu($menu_array_before, $helppagename='', $moresearchform='', $me
else print '