diff --git a/htdocs/comm/propal.php b/htdocs/comm/propal.php
index a55bdb2d530..27251fbc322 100644
--- a/htdocs/comm/propal.php
+++ b/htdocs/comm/propal.php
@@ -27,7 +27,7 @@
* \file htdocs/comm/propal.php
* \ingroup propale
* \brief Page of commercial proposals card and list
- * \version $Id: propal.php,v 1.605 2011/06/29 22:29:51 eldy Exp $
+ * \version $Id: propal.php,v 1.606 2011/06/30 13:27:21 hregis Exp $
*/
require("../main.inc.php");
@@ -82,7 +82,7 @@ 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))
+if (is_array($conf->hooks_modules) && ! empty($conf->hooks_modules))
{
$object->callHooks('propalcard');
}
@@ -92,18 +92,27 @@ if (is_array($conf->hooks_modules) && !empty($conf->hooks_modules))
/* Actions */
/******************************************************************************/
-// Hook of thirdparty module
-if (! empty($object->hooks['propalcard']))
+// Hook of actions
+if (! empty($object->hooks))
{
- foreach($object->hooks['propalcard'] as $module)
+ foreach($object->hooks as $hook)
{
- $reshook+=$module->doActions($object);
- if (! empty($module->error) || (! empty($module->errors) && sizeof($module->errors) > 0))
- {
- $error=$module->error; $errors[]=$module->errors;
- if ($action=='add') $action='create';
- if ($action=='update') $action='edit';
- }
+ 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';
+ }
+ }
+ }
+ }
}
}
@@ -1012,12 +1021,8 @@ if ($id > 0 || ! empty($ref))
/*
* Show object in view mode
*/
-
- if ($mesg)
- {
- if (! preg_match('/div class=/',$mesg)) print '
'.$mesg.'
';
- else print $mesg."
";
- }
+
+ dol_htmloutput_mesg($mesg,$mesgs);
$object->fetch($id,$ref);
@@ -1087,12 +1092,21 @@ if ($id > 0 || ! empty($ref))
$formconfirm=$html->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('ValidateProp'), $text, 'confirm_validate','',0,1);
}
- // Hook of thirdparty module
- if (empty($formconfirm) && ! empty($object->hooks['objectcard']))
+ // Hook for external modules
+ if (empty($formconfirm) && ! empty($object->hooks))
{
- foreach($object->hooks['objectcard'] as $module)
+ foreach($object->hooks as $hook)
{
- if (empty($formconfirm)) $formconfirm = $module->formconfirm($action,$object,$lineid);
+ if (! empty($hook['modules']))
+ {
+ foreach($hook['modules'] as $module)
+ {
+ if (empty($formconfirm) && method_exists($module,'formconfirm'))
+ {
+ $formconfirm = $module->formconfirm($action,$object,$lineid);
+ }
+ }
+ }
}
}
@@ -1496,13 +1510,19 @@ if ($id > 0 || ! empty($ref))
$object->formAddPredefinedProduct(0,$mysoc,$soc);
}
- // Hook of thirdparty module
- if (! empty($object->hooks['objectcard']))
+ // Hook for external modules
+ foreach($object->hooks as $hook)
{
- foreach($object->hooks['objectcard'] as $module)
+ if (! empty($hook['modules']))
{
- $var=!$var;
- $module->formAddObject($object);
+ foreach($hook['modules'] as $module)
+ {
+ if (method_exists($module,'formAddObject'))
+ {
+ $var=!$var;
+ $module->formAddObject($object);
+ }
+ }
}
}
}
@@ -1649,7 +1669,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['objectcard']);
+ $somethingshown=$formfile->show_documents('propal',$filename,$filedir,$urlsource,$genallowed,$delallowed,$object->modelpdf,1,0,0,28,0,'',0,'',$soc->default_lang,$object->hooks);
/*
@@ -1955,6 +1975,6 @@ else
}
$db->close();
-llxFooter('$Date: 2011/06/29 22:29:51 $ - $Revision: 1.605 $');
+llxFooter('$Date: 2011/06/30 13:27:21 $ - $Revision: 1.606 $');
?>
diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php
index 0cdf75d01c9..0928f2d0ca3 100644
--- a/htdocs/comm/propal/class/propal.class.php
+++ b/htdocs/comm/propal/class/propal.class.php
@@ -30,7 +30,7 @@
* \author Rodolphe Qiedeville
* \author Eric Seigne
* \author Laurent Destailleur
- * \version $Id$
+ * \version $Id: propal.class.php,v 1.109 2011/06/30 13:27:21 hregis Exp $
*/
require_once(DOL_DOCUMENT_ROOT ."/core/class/commonobject.class.php");
@@ -838,7 +838,7 @@ class Propal extends CommonObject
// Instantiate hooks of thirdparty module
if (is_array($conf->hooks_modules) && !empty($conf->hooks_modules))
{
- $object->callHooks('objectcard');
+ $object->callHooks('propalcard');
}
$this->db->begin();
@@ -905,15 +905,24 @@ class Propal extends CommonObject
if (! $error)
{
- // Hook of thirdparty module
- if (! empty($object->hooks['objectcard']))
- {
- foreach($object->hooks['objectcard'] as $module)
- {
- $result = $module->createfrom($objFrom,$result,$object->element);
- if ($result < 0) $error++;
- }
- }
+ // Hook for external modules
+ if (! empty($object->hooks))
+ {
+ foreach($object->hooks as $hook)
+ {
+ if (! empty($hook['modules']))
+ {
+ foreach($hook['modules'] as $module)
+ {
+ if (method_exists($module,'createfrom'))
+ {
+ $result = $module->createfrom($objFrom,$result,$object->element);
+ if ($result < 0) $error++;
+ }
+ }
+ }
+ }
+ }
// Appel des triggers
include_once(DOL_DOCUMENT_ROOT . "/core/class/interfaces.class.php");
diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php
index dd75a84f24b..db86760da57 100644
--- a/htdocs/commande/class/commande.class.php
+++ b/htdocs/commande/class/commande.class.php
@@ -25,7 +25,7 @@
* \file htdocs/commande/class/commande.class.php
* \ingroup commande
* \brief Fichier des classes de commandes
- * \version $Id$
+ * \version $Id: commande.class.php,v 1.116 2011/06/30 13:27:20 hregis Exp $
*/
require_once(DOL_DOCUMENT_ROOT."/core/class/commonobject.class.php");
require_once(DOL_DOCUMENT_ROOT."/product/class/product.class.php");
@@ -776,7 +776,7 @@ class Commande extends CommonObject
// Instantiate hooks of thirdparty module
if (is_array($conf->hooks_modules) && !empty($conf->hooks_modules))
{
- $object->callHooks('objectcard');
+ $object->callHooks('ordercard');
}
$this->db->begin();
@@ -825,14 +825,23 @@ class Commande extends CommonObject
if (! $error)
{
// Hook of thirdparty module
- if (! empty($object->hooks['objectcard']))
- {
- foreach($object->hooks['objectcard'] as $module)
- {
- $result = $module->createfrom($objFrom,$result,$object->element);
- if ($result < 0) $error++;
- }
- }
+ if (! empty($object->hooks))
+ {
+ foreach($object->hooks as $hook)
+ {
+ if (! empty($hook['modules']))
+ {
+ foreach($hook['modules'] as $module)
+ {
+ if (method_exists($module,'createfrom'))
+ {
+ $result = $module->createfrom($objFrom,$result,$object->element);
+ if ($result < 0) $error++;
+ }
+ }
+ }
+ }
+ }
// Appel des triggers
include_once(DOL_DOCUMENT_ROOT . "/core/class/interfaces.class.php");
@@ -918,15 +927,24 @@ class Commande extends CommonObject
if ($ret > 0)
{
- // Hooks
- if (! empty($object->hooks['objectcard']))
- {
- foreach($object->hooks['objectcard'] as $module)
- {
- $result = $module->createfrom($object,$ret,$this->element);
- if ($result < 0) $error++;
- }
- }
+ // Hook of thirdparty module
+ if (! empty($object->hooks))
+ {
+ foreach($object->hooks as $hook)
+ {
+ if (! empty($hook['modules']))
+ {
+ foreach($hook['modules'] as $module)
+ {
+ if (method_exists($module,'createfrom'))
+ {
+ $result = $module->createfrom($object,$ret,$this->element);
+ if ($result < 0) $error++;
+ }
+ }
+ }
+ }
+ }
if (! $error)
{
@@ -2770,6 +2788,8 @@ class OrderLine
{
var $db;
var $error;
+
+ var $oldline;
// From llx_commandedet
var $rowid;
diff --git a/htdocs/commande/fiche.php b/htdocs/commande/fiche.php
index a2cc4ef68a5..c7fbc9163a3 100644
--- a/htdocs/commande/fiche.php
+++ b/htdocs/commande/fiche.php
@@ -26,7 +26,7 @@
* \file htdocs/commande/fiche.php
* \ingroup commande
* \brief Page to show customer order
- * \version $Id: fiche.php,v 1.520 2011/06/29 22:29:51 eldy Exp $
+ * \version $Id: fiche.php,v 1.521 2011/06/30 13:27:21 hregis Exp $
*/
require("../main.inc.php");
@@ -77,18 +77,27 @@ if (is_array($conf->hooks_modules) && !empty($conf->hooks_modules))
/******************************************************************************/
// Hook of actions
-if (! empty($object->hooks['ordercard']))
+if (! empty($object->hooks))
{
- foreach($object->hooks['ordercard'] as $module)
- {
- $reshook+=$module->doActions($object);
- if (! empty($module->error) || (! empty($module->errors) && sizeof($module->errors) > 0))
- {
- $error=$module->error; $errors[]=$module->errors;
- if ($action=='add') $action='create';
- if ($action=='update') $action='edit';
- }
- }
+ 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';
+ }
+ }
+ }
+ }
+ }
}
// Action clone object
@@ -309,13 +318,22 @@ if ($action == 'add' && $user->rights->commande->creer)
}
// Hooks
- if (! empty($object->hooks['objectcard']))
+ if (! empty($object->hooks))
{
- foreach($object->hooks['objectcard'] as $module)
- {
- $res = $module->createfrom($srcobject,$object_id,$object->element);
- if ($res < 0) $error++;
- }
+ foreach($object->hooks as $hook)
+ {
+ if (! empty($hook['modules']))
+ {
+ foreach($hook['modules'] as $module)
+ {
+ if (method_exists($module,'createfrom'))
+ {
+ $res = $module->createfrom($srcobject,$object_id,$object->element);
+ if ($res < 0) $error++;
+ }
+ }
+ }
+ }
}
}
else
@@ -1411,7 +1429,7 @@ if ($action == 'create' && $user->rights->commande->creer)
print '';
- $objectsrc->printOriginLinesList($object);
+ $objectsrc->printOriginLinesList();
print '
';
}
@@ -1519,13 +1537,19 @@ else
$formconfirm=$html->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id,$langs->trans('CloneOrder'),$langs->trans('ConfirmCloneOrder',$object->ref),'confirm_clone',$formquestion,'yes',1);
}
- // Hook of thirdparty module
- if (empty($formconfirm) && ! empty($object->hooks['objectcard']))
+ // Hook for external modules
+ if (empty($formconfirm) && ! empty($object->hooks))
{
- foreach($object->hooks['objectcard'] as $module)
- {
- if (empty($formconfirm)) $formconfirm = $module->formconfirm($action,$object,$lineid);
- }
+ 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);
+ }
+ }
+ }
}
// Print form confirm
@@ -1877,14 +1901,23 @@ else
$object->formAddPredefinedProduct(1,$mysoc,$soc);
}
- // Hook of thirdparty module
- if (! empty($object->hooks['objectcard']))
+ // Hook for external modules
+ if (! empty($object->hooks))
{
- foreach($object->hooks['objectcard'] as $module)
- {
- $var=!$var;
- $module->formAddObject($object);
- }
+ foreach($object->hooks as $hook)
+ {
+ if (! empty($hook['modules']))
+ {
+ foreach($hook['modules'] as $module)
+ {
+ if (method_exists($module,'formAddObject'))
+ {
+ $var=!$var;
+ $module->formAddObject($object);
+ }
+ }
+ }
+ }
}
}
}
@@ -2021,7 +2054,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['objectcard']);
+ $somethingshown=$formfile->show_documents('commande',$comref,$filedir,$urlsource,$genallowed,$delallowed,$object->modelpdf,1,0,0,28,0,'','','',$soc->default_lang,$object->hooks);
/*
* Linked object block
@@ -2101,5 +2134,5 @@ else
$db->close();
-llxFooter('$Date: 2011/06/29 22:29:51 $ - $Revision: 1.520 $');
+llxFooter('$Date: 2011/06/30 13:27:21 $ - $Revision: 1.521 $');
?>
diff --git a/htdocs/compta/facture.php b/htdocs/compta/facture.php
index c59ed2f9e6d..38d3851f5cf 100644
--- a/htdocs/compta/facture.php
+++ b/htdocs/compta/facture.php
@@ -26,7 +26,7 @@
* \file htdocs/compta/facture.php
* \ingroup facture
* \brief Page to create/see an invoice
- * \version $Id: facture.php,v 1.840 2011/06/29 22:29:50 eldy Exp $
+ * \version $Id: facture.php,v 1.841 2011/06/30 13:27:21 hregis Exp $
*/
require('../main.inc.php');
@@ -87,18 +87,27 @@ if (is_array($conf->hooks_modules) && !empty($conf->hooks_modules))
/******************************************************************************/
// Hook of actions
-if (! empty($object->hooks['invoicecard']))
+if (! empty($object->hooks))
{
- foreach($object->hooks['invoicecard'] as $module)
- {
- $reshook+=$module->doActions($object);
- if (! empty($module->error) || (! empty($module->errors) && sizeof($module->errors) > 0))
- {
- $error=$module->error; $errors[]=$module->errors;
- if ($action=='add') $action='create';
- if ($action=='update') $action='edit';
- }
- }
+ 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';
+ }
+ }
+ }
+ }
+ }
}
// Action clone object
@@ -783,13 +792,22 @@ if ($action == 'add' && $user->rights->facture->creer)
}
// Hooks
- if (! empty($object->hooks['objectcard']))
+ if (! empty($object->hooks))
{
- foreach($object->hooks['objectcard'] as $module)
- {
- $res = $module->createfrom($srcobject,$id,$object->element);
- if ($res < 0) $error++;
- }
+ foreach($object->hooks as $hook)
+ {
+ if (! empty($hook['modules']))
+ {
+ foreach($hook['modules'] as $module)
+ {
+ if (method_exists($module,'createfrom'))
+ {
+ $res = $module->createfrom($srcobject,$id,$object->element);
+ if ($res < 0) $error++;
+ }
+ }
+ }
+ }
}
}
else
@@ -2041,13 +2059,19 @@ else
$formconfirm=$html->formconfirm($_SERVER["PHP_SELF"].'?facid='.$object->id,$langs->trans('CloneInvoice'),$langs->trans('ConfirmCloneInvoice',$object->ref),'confirm_clone',$formquestion,'yes',1);
}
- // Hook of thirdparty module
- if (empty($formconfirm) && ! empty($object->hooks['objectcard']))
+ // Hook for external modules
+ if (empty($formconfirm) && ! empty($object->hooks))
{
- foreach($object->hooks['objectcard'] as $module)
- {
- if (empty($formconfirm)) $formconfirm = $module->formconfirm($action,$object,$lineid);
- }
+ 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);
+ }
+ }
+ }
}
// Print form confirm
@@ -2584,14 +2608,23 @@ else
$object->formAddPredefinedProduct(1,$mysoc,$soc);
}
- // Hook of thirdparty module
- if (! empty($object->hooks['objectcard']))
+ // Hook for external modules
+ if (! empty($object->hooks))
{
- foreach($object->hooks['objectcard'] as $module)
- {
- $var=!$var;
- $module->formAddObject($object);
- }
+ foreach($object->hooks as $hook)
+ {
+ if (! empty($hook['modules']))
+ {
+ foreach($hook['modules'] as $module)
+ {
+ if (method_exists($module,'formAddObject'))
+ {
+ $var=!$var;
+ $module->formAddObject($object);
+ }
+ }
+ }
+ }
}
}
@@ -2828,7 +2861,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['objectcard']);
+ $somethingshown=$formfile->show_documents('facture',$filename,$filedir,$urlsource,$genallowed,$delallowed,$object->modelpdf,1,0,0,28,0,'','','',$soc->default_lang,$object->hooks);
/*
* Linked object block
@@ -3201,5 +3234,5 @@ else
$db->close();
-llxFooter('$Date: 2011/06/29 22:29:50 $ - $Revision: 1.840 $');
+llxFooter('$Date: 2011/06/30 13:27:21 $ - $Revision: 1.841 $');
?>
diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php
index 175b455bc2e..f8f946d3065 100644
--- a/htdocs/compta/facture/class/facture.class.php
+++ b/htdocs/compta/facture/class/facture.class.php
@@ -28,7 +28,7 @@
* \file htdocs/compta/facture/class/facture.class.php
* \ingroup facture
* \brief Fichier de la classe des factures clients
- * \version $Id$
+ * \version $Id: facture.class.php,v 1.122 2011/06/30 13:27:20 hregis Exp $
*/
require_once(DOL_DOCUMENT_ROOT ."/core/class/commonobject.class.php");
@@ -534,9 +534,9 @@ class Facture extends CommonObject
$object->fetch($fromid);
// Instantiate hooks of thirdparty module
- if (is_array($conf->hooks_modules) && !empty($conf->hooks_modules))
+ if (is_array($conf->hooks_modules) && ! empty($conf->hooks_modules))
{
- $object->callHooks('objectcard');
+ $object->callHooks('invoicecard');
}
$this->db->begin();
@@ -577,14 +577,23 @@ class Facture extends CommonObject
if (! $error)
{
- // Hook of thirdparty module
- if (! empty($object->hooks['objectcard']))
+ // Hook for external modules
+ if (! empty($object->hooks))
{
- foreach($object->hooks['objectcard'] as $module)
- {
- $result = $module->createfrom($objFrom,$result,$object->element);
- if ($result < 0) $error++;
- }
+ foreach($object->hooks as $hook)
+ {
+ if (! empty($hook['modules']))
+ {
+ foreach($hook['modules'] as $module)
+ {
+ if (method_exists($module,'createfrom'))
+ {
+ $result = $module->createfrom($objFrom,$result,$object->element);
+ if ($result < 0) $error++;
+ }
+ }
+ }
+ }
}
// Appel des triggers
@@ -667,14 +676,23 @@ class Facture extends CommonObject
if ($ret > 0)
{
- // Hooks
- if (! empty($object->hooks['objectcard']))
+ // Hook for external modules
+ if (! empty($object->hooks))
{
- foreach($object->hooks['objectcard'] as $module)
- {
- $result = $module->createfrom($object,$ret,$this->element);
- if ($result < 0) $error++;
- }
+ foreach($object->hooks as $hook)
+ {
+ if (! empty($hook['modules']))
+ {
+ foreach($hook['modules'] as $module)
+ {
+ if (method_exists($module,'createfrom'))
+ {
+ $result = $module->createfrom($objFrom,$result,$object->element);
+ if ($result < 0) $error++;
+ }
+ }
+ }
+ }
}
if (! $error)
@@ -2002,9 +2020,13 @@ class Facture extends CommonObject
// Update line into database
$this->line=new FactureLigne($this->db);
- $this->line->rowid=$rowid;
- $this->line->fetch($rowid);
-
+
+ // Stock previous line records
+ $staticline=new FactureLigne($this->db);
+ $staticline->fetch($rowid);
+ $this->line->oldline = $staticline;
+
+ $this->line->rowid = $rowid;
$this->line->desc = $desc;
$this->line->qty = $qty;
$this->line->tva_tx = $txtva;
@@ -3250,6 +3272,8 @@ class FactureLigne
{
var $db;
var $error;
+
+ var $oldline;
//! From llx_facturedet
var $rowid;
diff --git a/htdocs/compta/facture/fiche-rec.php b/htdocs/compta/facture/fiche-rec.php
index e869addf1cd..9fe60087f10 100644
--- a/htdocs/compta/facture/fiche-rec.php
+++ b/htdocs/compta/facture/fiche-rec.php
@@ -22,7 +22,7 @@
* \file htdocs/compta/facture/fiche-rec.php
* \ingroup facture
* \brief Page to show predefined invoice
- * \version $Id$
+ * \version $Id: fiche-rec.php,v 1.74 2011/06/30 13:27:21 hregis Exp $
*/
require("../../main.inc.php");
@@ -113,7 +113,7 @@ if ($_GET["action"] == 'create')
// Instantiate hooks of thirdparty module
if (is_array($conf->hooks_modules) && !empty($conf->hooks_modules))
{
- $facture->callHooks('objectcard');
+ $facture->callHooks('invoicecard');
}
if ($facture->fetch($_GET["facid"]) > 0)
@@ -576,5 +576,5 @@ else
$db->close();
-llxFooter('$Date$ - $Revision$');
+llxFooter('$Date: 2011/06/30 13:27:21 $ - $Revision: 1.74 $');
?>
diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php
index 6aa5b25a18f..dba9a784f4d 100644
--- a/htdocs/core/class/commonobject.class.php
+++ b/htdocs/core/class/commonobject.class.php
@@ -22,7 +22,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.139 2011/06/29 19:29:27 hregis Exp $
+ * \version $Id: commonobject.class.php,v 1.140 2011/06/30 13:27:20 hregis Exp $
*/
@@ -1438,6 +1438,8 @@ class CommonObject
global $conf;
if (! is_array($arraytype)) $arraytype=array($arraytype);
+
+ $i=0;
foreach($conf->hooks_modules as $module => $hooks)
{
@@ -1451,6 +1453,8 @@ class CommonObject
$actionfile = 'actions_'.$module.'.class.php';
$daofile = 'dao_'.$module.'.class.php';
$pathroot = '';
+
+ $this->hooks[$i]['type']=$type;
// Include actions class (controller)
$resaction=dol_include_once($path.$actionfile);
@@ -1463,15 +1467,17 @@ class CommonObject
{
$controlclassname = 'Actions'.ucfirst($module);
$objModule = new $controlclassname($this->db);
- $this->hooks[$type][$objModule->module_number] = $objModule;
+ $this->hooks[$i]['modules'][$objModule->module_number] = $objModule;
}
if ($resdao)
{
// Instantiate dataservice class (model)
$modelclassname = 'Dao'.ucfirst($module);
- $this->hooks[$type][$objModule->module_number]->object = new $modelclassname($this->db);
+ $this->hooks[$i]['modules'][$objModule->module_number]->object = new $modelclassname($this->db);
}
+
+ $i++;
}
}
}
@@ -1737,9 +1743,18 @@ class CommonObject
{
$var=!$var;
- if (($line->product_type == 9 && ! empty($line->special_code)) || ! empty($line->fk_parent_line))
+ if (! empty($this->hooks) && ( ($line->product_type == 9 && ! empty($line->special_code)) || ! empty($line->fk_parent_line) ) )
{
- if (empty($line->fk_parent_line)) $this->hooks['objectcard'][$line->special_code]->printObjectLine($action,$this,$line,$var,$num,$i,$dateSelector,$seller,$buyer,$selected);
+ if (empty($line->fk_parent_line))
+ {
+ foreach($this->hooks as $hook)
+ {
+ if (method_exists($hook['modules'][$line->special_code],'printObjectLine'))
+ {
+ $hook['modules'][$line->special_code]->printObjectLine($action,$this,$line,$var,$num,$i,$dateSelector,$seller,$buyer,$selected);
+ }
+ }
+ }
}
else
{
@@ -1835,7 +1850,7 @@ class CommonObject
* If lines are into a template, title must also be into a template
* But for the moment we don't know if it's possible as we keep a method available on overloaded objects.
*/
- function printOriginLinesList($object)
+ function printOriginLinesList()
{
global $langs;
@@ -1855,9 +1870,15 @@ class CommonObject
{
$var=!$var;
- if (($line->product_type == 9 && ! empty($line->special_code)) || ! empty($line->fk_parent_line))
+ if (! empty($this->hooks) && ( ($line->product_type == 9 && ! empty($line->special_code)) || ! empty($line->fk_parent_line) ) )
{
- if (empty($line->fk_parent_line)) $object->hooks['objectcard'][$line->special_code]->printOriginObjectLine($this,$line,$var,$i);
+ if (empty($line->fk_parent_line))
+ {
+ foreach($this->hooks as $hook)
+ {
+ if (method_exists($hook['modules'][$line->special_code],'printOriginObjectLine')) $hook['modules'][$line->special_code]->printOriginObjectLine($this,$line,$var,$i);
+ }
+ }
}
else
{
diff --git a/htdocs/core/class/html.formfile.class.php b/htdocs/core/class/html.formfile.class.php
index 959080b1379..7c054b43622 100644
--- a/htdocs/core/class/html.formfile.class.php
+++ b/htdocs/core/class/html.formfile.class.php
@@ -1,6 +1,7 @@
- * Copyright (c) 2010 Juanjo Menent
+/* Copyright (c) 2008-2010 Laurent Destailleur
+ * Copyright (C) 2010-2011 Regis Houssin
+ * Copyright (c) 2010 Juanjo Menent
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -21,7 +22,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$
+ * \version $Id: html.formfile.class.php,v 1.34 2011/06/30 13:27:20 hregis Exp $
*/
@@ -446,12 +447,17 @@ class FormFile
$out.= '';
// Execute hooks
- // $hooks must be array('key'=>$instanceofclass)
if (! empty($hooks) && is_array($hooks))
{
- foreach($hooks as $module)
+ foreach($hooks as $hook)
{
- if (method_exists($module,'formBuilddocOptions')) $out.= $module->formBuilddocOptions();
+ if (! empty($hook['modules']))
+ {
+ foreach($hook['modules'] as $module)
+ {
+ if (method_exists($module,'formBuilddocOptions')) $out.= $module->formBuilddocOptions();
+ }
+ }
}
}
}
diff --git a/htdocs/core/tpl/freeproductline_create.tpl.php b/htdocs/core/tpl/freeproductline_create.tpl.php
index 9e8747584c8..44635256716 100644
--- a/htdocs/core/tpl/freeproductline_create.tpl.php
+++ b/htdocs/core/tpl/freeproductline_create.tpl.php
@@ -16,7 +16,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
- * $Id$
+ * $Id: freeproductline_create.tpl.php,v 1.14 2011/06/30 13:27:20 hregis Exp $
*
* Need to have following variables defined:
* $conf
@@ -48,11 +48,17 @@
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['objectcard'])) {
- foreach($object->hooks['objectcard'] as $module) {
- $module->formCreateProductOptions($object);
+ 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 '
';
+ }
+ }
+ }
}
- echo '
';
}
// Editor wysiwyg
diff --git a/htdocs/core/tpl/freeproductline_edit.tpl.php b/htdocs/core/tpl/freeproductline_edit.tpl.php
index 5933e1eebce..01b53f44bc7 100644
--- a/htdocs/core/tpl/freeproductline_edit.tpl.php
+++ b/htdocs/core/tpl/freeproductline_edit.tpl.php
@@ -16,7 +16,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
- * $Id$
+ * $Id: freeproductline_edit.tpl.php,v 1.14 2011/06/30 13:27:20 hregis Exp $
*
* Need to have following variables defined:
* $conf
@@ -40,10 +40,16 @@
hooks['objectcard'])) {
- foreach($this->hooks['objectcard'] as $module) {
- $module->formEditProductOptions($this,$line->fk_parent_line);
- 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 '
';
+ }
+ }
+ }
}
}
diff --git a/htdocs/core/tpl/predefinedproductline_create.tpl.php b/htdocs/core/tpl/predefinedproductline_create.tpl.php
index 678fdf2a374..6c0de741b24 100644
--- a/htdocs/core/tpl/predefinedproductline_create.tpl.php
+++ b/htdocs/core/tpl/predefinedproductline_create.tpl.php
@@ -16,7 +16,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
- * $Id$
+ * $Id: predefinedproductline_create.tpl.php,v 1.13 2011/06/30 13:27:20 hregis Exp $
*
* Need to have following variables defined:
* $conf
@@ -60,11 +60,17 @@
if (! $conf->global->PRODUIT_USE_SEARCH_TO_SELECT) echo '
';
- if (! empty($object->hooks['objectcard'])) {
- foreach($object->hooks['objectcard'] as $module) {
- $module->formCreateProductOptions($object);
+ 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 '
';
+ }
+ }
+ }
}
- echo '
';
}
// Editor wysiwyg
diff --git a/htdocs/core/tpl/predefinedproductline_edit.tpl.php b/htdocs/core/tpl/predefinedproductline_edit.tpl.php
index a75e2b65203..7531b7d6cd8 100644
--- a/htdocs/core/tpl/predefinedproductline_edit.tpl.php
+++ b/htdocs/core/tpl/predefinedproductline_edit.tpl.php
@@ -16,7 +16,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
- * $Id$
+ * $Id: predefinedproductline_edit.tpl.php,v 1.13 2011/06/30 13:27:20 hregis Exp $
*
* Need to have following variables defined:
* $conf
@@ -48,10 +48,16 @@
echo ' - '.nl2br($line->product_label);
echo '
';
- if (! empty($this->hooks['objectcard'])) {
- foreach($this->hooks['objectcard'] as $module) {
- $module->formEditProductOptions($this,$line->fk_parent_line);
- 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 '
';
+ }
+ }
+ }
}
}
diff --git a/htdocs/includes/modules/modSociete.class.php b/htdocs/includes/modules/modSociete.class.php
index 3cca6b58316..90b55773f9f 100644
--- a/htdocs/includes/modules/modSociete.class.php
+++ b/htdocs/includes/modules/modSociete.class.php
@@ -3,7 +3,7 @@
* Copyright (C) 2004-2011 Laurent Destailleur
* Copyright (C) 2004 Sebastien Di Cintio
* Copyright (C) 2004 Benoit Mortier
- * Copyright (C) 2005-2010 Regis Houssin
+ * Copyright (C) 2005-2011 Regis Houssin
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -23,7 +23,7 @@
/**
* \defgroup societe Module societe
* \brief Module to manage third parties (customers, prospects)
- * \version $Id$
+ * \version $Id: modSociete.class.php,v 1.117 2011/06/30 13:27:21 hregis Exp $
*/
/**
@@ -106,6 +106,15 @@ class modSociete extends DolibarrModules
$this->const[$r][3] = "";
$this->const[$r][4] = 0;
$r++;
+
+ $this->const[$r][0] = "MAIN_MODULE_SOCIETE_HOOKS";
+ $this->const[$r][1] = "chaine";
+ $this->const[$r][2] = "thirdpartycard:contactcard";
+ $this->const[$r][3] = "";
+ $this->const[$r][4] = 0;
+ $this->const[$r][4] = 'current';
+ $this->const[$r][4] = 1;
+ $r++;
// Boxes
$this->boxes = array();
diff --git a/htdocs/lib/pdf.lib.php b/htdocs/lib/pdf.lib.php
index a48c665a72d..9560c981840 100644
--- a/htdocs/lib/pdf.lib.php
+++ b/htdocs/lib/pdf.lib.php
@@ -25,7 +25,7 @@
* \file htdocs/lib/pdf.lib.php
* \brief Set of functions used for PDF generation
* \ingroup core
- * \version $Id$
+ * \version $Id: pdf.lib.php,v 1.95 2011/06/30 13:27:21 hregis Exp $
*/
@@ -658,11 +658,14 @@ function pdf_writelinedesc(&$pdf,$object,$i,$outputlangs,$w,$h,$posx,$posy,$hide
{
global $db, $conf, $langs;
- if (! empty($object->hooks['objectcard']) && ( ($object->lines[$i]->product_type == 9 && ! empty($object->lines[$i]->special_code) ) || ! empty($object->lines[$i]->fk_parent_line) ) )
+ if (! empty($object->hooks) && ( ($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['objectcard'][$special_code]->pdf_writelinedesc($pdf,$object,$i,$outputlangs,$w,$h,$posx,$posy,$hideref,$hidedesc,$issupplierline);
+ foreach($object->hooks as $hook)
+ {
+ if (method_exists($hook['modules'][$special_code],'pdf_writelinedesc')) return $hook['modules'][$special_code]->pdf_writelinedesc($pdf,$object,$i,$outputlangs,$w,$h,$posx,$posy,$hideref,$hidedesc,$issupplierline);
+ }
}
else
{
@@ -815,7 +818,7 @@ function pdf_getlinedesc($object,$i,$outputlangs,$hideref=0,$hidedesc=0,$issuppl
*/
function pdf_getlinenum($object,$i,$outputlangs)
{
- if (! empty($object->hooks['objectcard']) && ( ($object->lines[$i]->product_type == 9 && !empty($object->lines[$i]->special_code) ) || ! empty($object->lines[$i]->fk_parent_line) ) )
+ if (! empty($object->hooks) && ( ($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);
@@ -836,7 +839,7 @@ function pdf_getlinenum($object,$i,$outputlangs)
*/
function pdf_getlineref($object,$i,$outputlangs)
{
- if (! empty($object->hooks['objectcard']) && ( ($object->lines[$i]->product_type == 9 && !empty($object->lines[$i]->special_code) ) || ! empty($object->lines[$i]->fk_parent_line) ) )
+ if (! empty($object->hooks) && ( ($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);
@@ -856,7 +859,7 @@ function pdf_getlineref($object,$i,$outputlangs)
*/
function pdf_getlineref_supplier($object,$i,$outputlangs)
{
- if (! empty($object->hooks['objectcard']) && ( ($object->lines[$i]->product_type == 9 && !empty($object->lines[$i]->special_code) ) || ! empty($object->lines[$i]->fk_parent_line) ) )
+ if (! empty($object->hooks) && ( ($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);
@@ -880,11 +883,14 @@ function pdf_getlineref_supplier($object,$i,$outputlangs)
*/
function pdf_getlinevatrate($object,$i,$outputlangs,$hidedetails=0)
{
- if (! empty($object->hooks['objectcard']) && ( ($object->lines[$i]->product_type == 9 && !empty($object->lines[$i]->special_code) ) || ! empty($object->lines[$i]->fk_parent_line) ) )
+ if (! empty($object->hooks) && ( ($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['objectcard'][$special_code]->pdf_getlinevatrate($object,$i,$outputlangs,$hidedetails);
+ foreach($object->hooks as $hook)
+ {
+ if (method_exists($hook['modules'][$special_code],'pdf_getlinevatrate')) return $hook['modules'][$special_code]->pdf_getlinevatrate($object,$i,$outputlangs,$hidedetails);
+ }
}
else
{
@@ -904,11 +910,14 @@ function pdf_getlinevatrate($object,$i,$outputlangs,$hidedetails=0)
*/
function pdf_getlineupexcltax($object,$i,$outputlangs,$hidedetails=0)
{
- if (! empty($object->hooks['objectcard']) && ( ($object->lines[$i]->product_type == 9 && !empty($object->lines[$i]->special_code) ) || ! empty($object->lines[$i]->fk_parent_line) ) )
+ if (! empty($object->hooks) && ( ($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['objectcard'][$special_code]->pdf_getlineupexcltax($object,$i,$outputlangs,$hidedetails);
+ foreach($object->hooks as $hook)
+ {
+ if (method_exists($hook['modules'][$special_code],'pdf_getlineupexcltax')) return $hook['modules'][$special_code]->pdf_getlineupexcltax($object,$i,$outputlangs,$hidedetails);
+ }
}
else
{
@@ -930,11 +939,14 @@ function pdf_getlineqty($object,$i,$outputlangs,$hidedetails=0)
{
if ($object->lines[$i]->special_code != 3)
{
- if (! empty($object->hooks['objectcard']) && (( $object->lines[$i]->product_type == 9 && !empty($object->lines[$i]->special_code) ) || ! empty($object->lines[$i]->fk_parent_line) ) )
+ if (! empty($object->hooks) && (( $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['objectcard'][$special_code]->pdf_getlineqty($object,$i,$outputlangs,$hidedetails);
+ foreach($object->hooks as $hook)
+ {
+ if (method_exists($hook['modules'][$special_code],'pdf_getlineqty')) return $hook['modules'][$special_code]->pdf_getlineqty($object,$i,$outputlangs,$hidedetails);
+ }
}
else
{
@@ -957,11 +969,14 @@ function pdf_getlineqty_asked($object,$i,$outputlangs,$hidedetails=0)
{
if ($object->lines[$i]->special_code != 3)
{
- if (! empty($object->hooks['objectcard']) && (( $object->lines[$i]->product_type == 9 && !empty($object->lines[$i]->special_code) ) || ! empty($object->lines[$i]->fk_parent_line) ) )
+ if (! empty($object->hooks) && (( $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['objectcard'][$special_code]->pdf_getlineqty_asked($object,$i,$outputlangs,$hidedetails);
+ foreach($object->hooks as $hook)
+ {
+ if (method_exists($hook['modules'][$special_code],'pdf_getlineqty_asked')) return $hook['modules'][$special_code]->pdf_getlineqty_asked($object,$i,$outputlangs,$hidedetails);
+ }
}
else
{
@@ -984,11 +999,14 @@ function pdf_getlineqty_shipped($object,$i,$outputlangs,$hidedetails=0)
{
if ($object->lines[$i]->special_code != 3)
{
- if (! empty($object->hooks['objectcard']) && (( $object->lines[$i]->product_type == 9 && !empty($object->lines[$i]->special_code) ) || ! empty($object->lines[$i]->fk_parent_line) ) )
+ if (! empty($object->hooks) && (( $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['objectcard'][$special_code]->pdf_getlineqty_shipped($object,$i,$outputlangs,$hidedetails);
+ foreach($object->hooks as $hook)
+ {
+ if (method_exists($hook['modules'][$special_code],'pdf_getlineqty_shipped')) return $hook['modules'][$special_code]->pdf_getlineqty_shipped($object,$i,$outputlangs,$hidedetails);
+ }
}
else
{
@@ -1011,11 +1029,14 @@ function pdf_getlineqty_keeptoship($object,$i,$outputlangs,$hidedetails=0)
{
if ($object->lines[$i]->special_code != 3)
{
- if (! empty($object->hooks['objectcard']) && (( $object->lines[$i]->product_type == 9 && !empty($object->lines[$i]->special_code) ) || ! empty($object->lines[$i]->fk_parent_line) ) )
+ if (! empty($object->hooks) && (( $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['objectcard'][$special_code]->pdf_getlineqty_keeptoship($object,$i,$outputlangs,$hidedetails);
+ foreach($object->hooks as $hook)
+ {
+ if (method_exists($hook['modules'][$special_code],'pdf_getlineqty_keeptoship')) return $hook['modules'][$special_code]->pdf_getlineqty_keeptoship($object,$i,$outputlangs,$hidedetails);
+ }
}
else
{
@@ -1040,11 +1061,14 @@ function pdf_getlineremisepercent($object,$i,$outputlangs,$hidedetails=0)
if ($object->lines[$i]->special_code != 3)
{
- if (! empty($object->hooks['objectcard']) && ( ($object->lines[$i]->product_type == 9 && !empty($object->lines[$i]->special_code) ) || ! empty($object->lines[$i]->fk_parent_line) ) )
+ if (! empty($object->hooks) && ( ($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['objectcard'][$special_code]->pdf_getlineremisepercent($object,$i,$outputlangs,$hidedetails);
+ foreach($object->hooks as $hook)
+ {
+ if (method_exists($hook['modules'][$special_code],'pdf_getlineremisepercent')) return $hook['modules'][$special_code]->pdf_getlineremisepercent($object,$i,$outputlangs,$hidedetails);
+ }
}
else
{
@@ -1071,11 +1095,14 @@ function pdf_getlinetotalexcltax($object,$i,$outputlangs,$hidedetails=0)
}
else
{
- if (! empty($object->hooks['objectcard']) && ( ($object->lines[$i]->product_type == 9 && ! empty($object->lines[$i]->special_code) ) || ! empty($object->lines[$i]->fk_parent_line) ) )
+ if (! empty($object->hooks) && ( ($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['objectcard'][$special_code]->pdf_getlinetotalexcltax($object,$i,$outputlangs,$hidedetails);
+ foreach($object->hooks as $hook)
+ {
+ if (method_exists($hook['modules'][$special_code],'pdf_getlinetotalexcltax')) return $hook['modules'][$special_code]->pdf_getlinetotalexcltax($object,$i,$outputlangs,$hidedetails);
+ }
}
else
{
@@ -1104,7 +1131,7 @@ function pdf_getTotalQty($object,$type='',$outputlangs)
{
$total += $object->lines[$i]->qty;
}
- 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) ) )
+ 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) ) )
{
$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);