Fix duplicated code

This commit is contained in:
John BOTELLA 2021-11-29 14:30:04 +01:00
parent 1fa3e9f37d
commit 5bdaab8dcb

View File

@ -4872,13 +4872,9 @@ abstract class CommonObject
$reshook = 0;
//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, 'i'=>$i, 'restrictlist'=>$restrictlist, 'selectedLines'=> $selectedLines);
$reshook = $hookmanager->executeHooks('printOriginObjectLine', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
} else {
$parameters = array('line'=>$line, 'i'=>$i, 'restrictlist'=>$restrictlist, 'selectedLines'=> $selectedLines, 'fk_parent_line'=>$line->fk_parent_line);
$reshook = $hookmanager->executeHooks('printOriginObjectSubLine', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
}
$parameters = array('line'=>$line, 'i'=>$i, 'restrictlist'=>$restrictlist, 'selectedLines'=> $selectedLines);
if (!empty($line->fk_parent_line)) { $parameters['fk_parent_line'] = $line->fk_parent_line; }
$reshook = $hookmanager->executeHooks('printOriginObjectSubLine', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
}
if (empty($reshook)) {
$this->printOriginLine($line, '', $restrictlist, '/core/tpl', $selectedLines);