Fix: works on repair broken features

This commit is contained in:
Regis Houssin 2011-08-11 15:14:50 +00:00
parent dcd3ab435d
commit 00aaaac8aa
4 changed files with 15 additions and 17 deletions

View File

@ -25,7 +25,7 @@
* \file htdocs/commande/fiche.php * \file htdocs/commande/fiche.php
* \ingroup commande * \ingroup commande
* \brief Page to show customer order * \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"); require("../main.inc.php");
@ -1392,7 +1392,7 @@ if ($action == 'create' && $user->rights->commande->creer)
print '<table class="noborder" width="100%">'; print '<table class="noborder" width="100%">';
$objectsrc->printOriginLinesList(); $objectsrc->printOriginLinesList($hookmanager);
print '</table>'; print '</table>';
} }
@ -2070,5 +2070,5 @@ else
$db->close(); $db->close();
llxFooter('$Date: 2011/08/10 22:47:34 $ - $Revision: 1.533 $'); llxFooter('$Date: 2011/08/11 15:14:51 $ - $Revision: 1.534 $');
?> ?>

View File

@ -25,7 +25,7 @@
* \file htdocs/compta/facture.php * \file htdocs/compta/facture.php
* \ingroup facture * \ingroup facture
* \brief Page to create/see an invoice * \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'); require('../main.inc.php');
@ -782,7 +782,7 @@ if ($action == 'add' && $user->rights->facture->creer)
} }
// Hooks // 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 $reshook=$hookmanager->executeHooks('createfrom',$parameters,$object,$action); // Note that $action and $object may have been modified by hook
if ($reshook < 0) $error++; if ($reshook < 0) $error++;
} }
@ -1835,7 +1835,7 @@ if ($action == 'create')
print '<table class="noborder" width="100%">'; print '<table class="noborder" width="100%">';
$objectsrc->printOriginLinesList($object); $objectsrc->printOriginLinesList($hookmanager);
print '</table>'; print '</table>';
} }
@ -3185,5 +3185,5 @@ else
$db->close(); $db->close();
llxFooter('$Date: 2011/08/10 22:47:34 $ - $Revision: 1.854 $'); llxFooter('$Date: 2011/08/11 15:14:50 $ - $Revision: 1.855 $');
?> ?>

View File

@ -27,7 +27,7 @@
* \file htdocs/compta/facture/class/facture.class.php * \file htdocs/compta/facture/class/facture.class.php
* \ingroup facture * \ingroup facture
* \brief Fichier de la classe des factures clients * \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"); require_once(DOL_DOCUMENT_ROOT ."/core/class/commonobject.class.php");
@ -661,8 +661,8 @@ class Facture extends CommonObject
// Hook of thirdparty module // Hook of thirdparty module
if (is_object($hookmanager)) if (is_object($hookmanager))
{ {
$parameters=array('objFrom'=>$objFrom); $parameters=array('objFrom'=>$object);
$reshook=$hookmanager->executeHooks('createfrom',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks $reshook=$hookmanager->executeHooks('createfrom',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks
if ($reshook < 0) $error++; if ($reshook < 0) $error++;
} }

View File

@ -21,7 +21,7 @@
* \file htdocs/core/class/commonobject.class.php * \file htdocs/core/class/commonobject.class.php
* \ingroup core * \ingroup core
* \brief File of parent class of all other business classes (invoices, contracts, proposals, orders, ...) * \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 * 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. * 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; global $langs;
@ -1820,14 +1820,12 @@ class CommonObject
{ {
$var=!$var; $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)) if (empty($line->fk_parent_line))
{ {
foreach($this->hooks as $hook) $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
if (method_exists($hook['modules'][$line->special_code],'printOriginObjectLine')) $hook['modules'][$line->special_code]->printOriginObjectLine($this,$line,$var,$i);
}
} }
} }
else else