Merge pull request #3802 from olsesacl/develop-hook

hooks correctly implemented , printObjectLine, printObjectSubLine
This commit is contained in:
Laurent Destailleur 2015-11-02 10:44:59 +01:00
commit 465ad6b3a7
2 changed files with 11 additions and 5 deletions

View File

@ -3108,20 +3108,21 @@ abstract class CommonObject
$var=!$var;
if (is_object($hookmanager) && (($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 (is_object($hookmanager)) // Old code is commented on preceding line.
{
if (empty($line->fk_parent_line))
{
$parameters = array('line'=>$line,'var'=>$var,'num'=>$num,'i'=>$i,'dateSelector'=>$dateSelector,'seller'=>$seller,'buyer'=>$buyer,'selected'=>$selected, 'extrafieldsline'=>$extrafieldsline);
$hookmanager->executeHooks('printObjectLine', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
$reshook = $hookmanager->executeHooks('printObjectLine', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
}
else
{
$parameters = array('line'=>$line,'var'=>$var,'num'=>$num,'i'=>$i,'dateSelector'=>$dateSelector,'seller'=>$seller,'buyer'=>$buyer,'selected'=>$selected, 'extrafieldsline'=>$extrafieldsline);
$hookmanager->executeHooks('printObjectSubLine', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
$reshook = $hookmanager->executeHooks('printObjectSubLine', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
}
}
else
if (empty($reshook))
{
$this->printObjectLine($action,$line,$var,$num,$i,$dateSelector,$seller,$buyer,$selected,$extrafieldsline);
}
@ -3171,6 +3172,9 @@ abstract class CommonObject
{
$product_static = new Product($this->db);
$product_static->fetch($line->fk_product);
$product_static->ref = $line->ref; //can change ref in hook
$product_static->label = $line->label; //can change label in hook
$text=$product_static->getNomUrl(1);
// Define output language and label

View File

@ -163,7 +163,9 @@ class HookManager
'printAddress',
'printSearchForm',
'formatEvent',
'addCalendarChoice'
'addCalendarChoice',
'printObjectLine',
'printObjectSubLine'
)
)) $hooktype='addreplace';
// Deprecated hook types ('returnvalue')