diff --git a/htdocs/comm/propal.php b/htdocs/comm/propal.php index b2d68660cf7baaae003bc65cd5ddb2c6f3e01c46..206d325be13b904690a07edc1dc9674e635229cd 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 825dd16edece5c3d080bf4e5bc8fee21bf54d8f7..4eca267b20f82e76c52112ecf20f4b75d219c69e 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 624bbc500fac43701853d031c45492f38201d030..240d094c171197c810ddc7022afda1fe35c7f117 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 7bbda87d30daface4e67178b61712fa0da1162a0..68dc1b2aa0bd3b4720c745f00a3b7fd2205be870 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 209befd462f099c8891d5dc6cbdfcb7b6e950220..de6faf6e3b081418370cbf9c6943ee3ce4c653f5 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 '<br>'; - $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 acf4a47d0e32727a469f9703db056304dbd358f8..bfb9843379c0431a4d02f149211e9a1313734e79 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 31b419215e1e20c25f42e10ce7236e0a2e5a6718..6643f6e674a175c3cd797078e5e4c4cd2cbd72e5 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 adbe70e596a0670b440d2100f3f10a0d7142b0cd..9e8747584c88c4ee79ff8d7720fbb169118f83c7 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 '<br>'; - if (! empty($object->hooks)) { - foreach($object->hooks as $module) { + if (! empty($object->hooks['objectcard'])) { + foreach($object->hooks['objectcard'] as $module) { $module->formCreateProductOptions($object); } echo '<br>'; diff --git a/htdocs/core/tpl/predefinedproductline_create.tpl.php b/htdocs/core/tpl/predefinedproductline_create.tpl.php index 727b84b68afba14caf4d613114b1c8da10450f13..678fdf2a374b42d9dc256e8d34ee76cd8f26c078 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 '<br>'; - if (! empty($object->hooks)) { - foreach($object->hooks as $module) { + if (! empty($object->hooks['objectcard'])) { + foreach($object->hooks['objectcard'] as $module) { $module->formCreateProductOptions($object); } echo '<br>'; diff --git a/htdocs/lib/pdf.lib.php b/htdocs/lib/pdf.lib.php index 702329aade43614e033d524065db45ca6637758a..1df2aed55ab12a742c10724df4ae36634a7142a2 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 86ba359b02804dfbd7785f1aabad524c2058db04..c83120d719403e46433385cb13a52b5c2e56f503 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 '<td class="vmenu" valign="top">'; print "\n"; - + + // Instantiate hooks of thirdparty module + if (is_array($conf->hooks_modules) && !empty($conf->hooks_modules)) + { + require_once(DOL_DOCUMENT_ROOT.'/core/class/commonobject.class.php'); + $object = new CommonObject($db); + $object->callHooks(array('searchform','leftblock')); + } // Define $searchform if ($conf->societe->enabled && $conf->global->MAIN_SEARCHFORM_SOCIETE && $user->rights->societe->lire) @@ -1362,6 +1369,15 @@ function left_menu($menu_array_before, $helppagename='', $moresearchform='', $me $searchform.=printSearchForm(DOL_URL_ROOT.'/adherents/liste.php', DOL_URL_ROOT.'/adherents/liste.php', img_object('','user').' '.$langs->trans("Members"), 'member', 'sall'); } + + // Search form hook of thirdparty module + if (! empty($object->hooks['searchform'])) + { + foreach($object->hooks['searchform'] as $module) + { + $searchform.=$module->printSearchForm(); + } + } // Define $bookmarks if ($conf->bookmark->enabled && $user->rights->bookmark->lire) @@ -1372,8 +1388,6 @@ function left_menu($menu_array_before, $helppagename='', $moresearchform='', $me $bookmarks=printBookmarksList($db, $langs); } - - $left_menu=isset($conf->browser->phone)?$conf->smart_menu:$conf->top_menu; if (GETPOST('menu')) $left_menu=GETPOST('menu'); // menu=eldy_backoffice.php @@ -1467,6 +1481,16 @@ function left_menu($menu_array_before, $helppagename='', $moresearchform='', $me print '<div class="help"><a class="help" target="_blank" href="'.$bugbaseurl.'">'.$langs->trans("FindBug").'</a></div>'; } print "\n"; + + // Left block hook of thirdparty module + if (! empty($object->hooks['leftblock'])) + { + foreach($object->hooks['leftblock'] as $module) + { + $module->printLeftBlock(); + } + } + print "</div>\n"; print "<!-- End left vertical menu -->\n";