diff --git a/htdocs/commande/fiche.php b/htdocs/commande/fiche.php index df8f513f46eaf79b21b3bf8fbd3799ae18d98b31..8babc2a2dddfd3c4c079fa55b2a86a4c1f724480 100644 --- a/htdocs/commande/fiche.php +++ b/htdocs/commande/fiche.php @@ -25,7 +25,7 @@ * \file htdocs/commande/fiche.php * \ingroup commande * \brief Page to show customer order - * \version $Id: fiche.php,v 1.533 2011/08/10 22:47:34 eldy Exp $ + * \version $Id: fiche.php,v 1.534 2011/08/11 15:14:51 hregis Exp $ */ require("../main.inc.php"); @@ -1392,7 +1392,7 @@ if ($action == 'create' && $user->rights->commande->creer) print '<table class="noborder" width="100%">'; - $objectsrc->printOriginLinesList(); + $objectsrc->printOriginLinesList($hookmanager); print '</table>'; } @@ -2070,5 +2070,5 @@ else $db->close(); -llxFooter('$Date: 2011/08/10 22:47:34 $ - $Revision: 1.533 $'); +llxFooter('$Date: 2011/08/11 15:14:51 $ - $Revision: 1.534 $'); ?> diff --git a/htdocs/compta/facture.php b/htdocs/compta/facture.php index ac7695e965baf2f6d25d044b83bd5b04b6eded52..be1791c2464e3b0ef6f1a4eb9570877de605695b 100644 --- a/htdocs/compta/facture.php +++ b/htdocs/compta/facture.php @@ -25,7 +25,7 @@ * \file htdocs/compta/facture.php * \ingroup facture * \brief Page to create/see an invoice - * \version $Id: facture.php,v 1.854 2011/08/10 22:47:34 eldy Exp $ + * \version $Id: facture.php,v 1.855 2011/08/11 15:14:50 hregis Exp $ */ require('../main.inc.php'); @@ -782,7 +782,7 @@ if ($action == 'add' && $user->rights->facture->creer) } // Hooks - $parameters=array('srcobject'=>$srcobject); + $parameters=array('objFrom'=>$srcobject); $reshook=$hookmanager->executeHooks('createfrom',$parameters,$object,$action); // Note that $action and $object may have been modified by hook if ($reshook < 0) $error++; } @@ -1835,7 +1835,7 @@ if ($action == 'create') print '<table class="noborder" width="100%">'; - $objectsrc->printOriginLinesList($object); + $objectsrc->printOriginLinesList($hookmanager); print '</table>'; } @@ -3185,5 +3185,5 @@ else $db->close(); -llxFooter('$Date: 2011/08/10 22:47:34 $ - $Revision: 1.854 $'); +llxFooter('$Date: 2011/08/11 15:14:50 $ - $Revision: 1.855 $'); ?> diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index 26168ccf1320f6add4d95a2717766eb15579824e..3e6d3cb15ef037b8f9d014a1bb9b8fd2c0c23495 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -27,7 +27,7 @@ * \file htdocs/compta/facture/class/facture.class.php * \ingroup facture * \brief Fichier de la classe des factures clients - * \version $Id: facture.class.php,v 1.126 2011/08/10 22:47:33 eldy Exp $ + * \version $Id: facture.class.php,v 1.127 2011/08/11 15:14:50 hregis Exp $ */ require_once(DOL_DOCUMENT_ROOT ."/core/class/commonobject.class.php"); @@ -661,8 +661,8 @@ class Facture extends CommonObject // Hook of thirdparty module if (is_object($hookmanager)) { - $parameters=array('objFrom'=>$objFrom); - $reshook=$hookmanager->executeHooks('createfrom',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks + $parameters=array('objFrom'=>$object); + $reshook=$hookmanager->executeHooks('createfrom',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks if ($reshook < 0) $error++; } diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index aebbc059ce5a3d4564cb434eeb5ce8f30df96870..e29058ef0193c681132543beaeb48a36fe172808 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -21,7 +21,7 @@ * \file htdocs/core/class/commonobject.class.php * \ingroup core * \brief File of parent class of all other business classes (invoices, contracts, proposals, orders, ...) - * \version $Id: commonobject.class.php,v 1.154 2011/08/10 22:47:34 eldy Exp $ + * \version $Id: commonobject.class.php,v 1.155 2011/08/11 15:14:51 hregis Exp $ */ @@ -1800,7 +1800,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() + function printOriginLinesList($hookmanager=false) { global $langs; @@ -1820,14 +1820,12 @@ class CommonObject { $var=!$var; - if (! empty($this->hooks) && ( ($line->product_type == 9 && ! empty($line->special_code)) || ! empty($line->fk_parent_line) ) ) + if (is_object($hookmanager) && ( ($line->product_type == 9 && ! empty($line->special_code)) || ! empty($line->fk_parent_line) ) ) { if (empty($line->fk_parent_line)) { - foreach($this->hooks as $hook) - { - if (method_exists($hook['modules'][$line->special_code],'printOriginObjectLine')) $hook['modules'][$line->special_code]->printOriginObjectLine($this,$line,$var,$i); - } + $parameters=array('line'=>$line,'var'=>$var,'i'=>$i); + $reshook=$hookmanager->executeHooks('printOriginObjectLine',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks } } else