Merge pull request #3802 from olsesacl/develop-hook
hooks correctly implemented , printObjectLine, printObjectSubLine
This commit is contained in:
commit
465ad6b3a7
@ -3108,20 +3108,21 @@ abstract class CommonObject
|
|||||||
|
|
||||||
$var=!$var;
|
$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))
|
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);
|
$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
|
else
|
||||||
{
|
{
|
||||||
$parameters = array('line'=>$line,'var'=>$var,'num'=>$num,'i'=>$i,'dateSelector'=>$dateSelector,'seller'=>$seller,'buyer'=>$buyer,'selected'=>$selected, 'extrafieldsline'=>$extrafieldsline);
|
$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);
|
$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 = new Product($this->db);
|
||||||
$product_static->fetch($line->fk_product);
|
$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);
|
$text=$product_static->getNomUrl(1);
|
||||||
|
|
||||||
// Define output language and label
|
// Define output language and label
|
||||||
|
|||||||
@ -163,7 +163,9 @@ class HookManager
|
|||||||
'printAddress',
|
'printAddress',
|
||||||
'printSearchForm',
|
'printSearchForm',
|
||||||
'formatEvent',
|
'formatEvent',
|
||||||
'addCalendarChoice'
|
'addCalendarChoice',
|
||||||
|
'printObjectLine',
|
||||||
|
'printObjectSubLine'
|
||||||
)
|
)
|
||||||
)) $hooktype='addreplace';
|
)) $hooktype='addreplace';
|
||||||
// Deprecated hook types ('returnvalue')
|
// Deprecated hook types ('returnvalue')
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user