From 51b9802de40318908a310c5e06054475aa7925b6 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 7 Jan 2017 20:42:35 +0100 Subject: [PATCH] NEW Hook to allow inserting custom product head #6001 --- htdocs/core/class/commonobject.class.php | 154 ++++++++++++----------- 1 file changed, 80 insertions(+), 74 deletions(-) diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 98bf53743ba..89795e7df5d 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -3299,84 +3299,90 @@ abstract class CommonObject $usemargins=0; if (! empty($conf->margin->enabled) && ! empty($this->element) && in_array($this->element,array('facture','propal','commande'))) $usemargins=1; - print ''; - - if (! empty($conf->global->MAIN_VIEW_LINE_NUMBER)) print ' '; - - // Description - print ''.$langs->trans('Description').''; - - if ($this->element == 'supplier_proposal') - { - print ''.$langs->trans("SupplierProposalRefFourn").''; - } - - // VAT - print ''.$langs->trans('VAT').''; - - // Price HT - print ''.$langs->trans('PriceUHT').''; - - // Multicurrency - if (!empty($conf->multicurrency->enabled)) print ''.$langs->trans('PriceUHTCurrency', $this->multicurrency_code).''; - - if ($inputalsopricewithtax) print ''.$langs->trans('PriceUTTC').''; - - // Qty - print ''.$langs->trans('Qty').''; - - if($conf->global->PRODUCT_USE_UNITS) - { - print ''.$langs->trans('Unit').''; - } - - // Reduction short - print ''.$langs->trans('ReductionShort').''; - - if ($this->situation_cycle_ref) { - print '' . $langs->trans('Progress') . ''; - } - - if ($usemargins && ! empty($conf->margin->enabled) && empty($user->societe_id)) - { - if (!empty($user->rights->margins->creer)) - { - if ($conf->global->MARGIN_TYPE == "1") - print ''.$langs->trans('BuyingPrice').''; - else - print ''.$langs->trans('CostPrice').''; - } - - if (! empty($conf->global->DISPLAY_MARGIN_RATES) && $user->rights->margins->liretous) - print ''.$langs->trans('MarginRate').''; - if (! empty($conf->global->DISPLAY_MARK_RATES) && $user->rights->margins->liretous) - print ''.$langs->trans('MarkRate').''; - } - - // Total HT - print ''.$langs->trans('TotalHTShort').''; - - // Multicurrency - if (!empty($conf->multicurrency->enabled)) print ''.$langs->trans('TotalHTShortCurrency', $this->multicurrency_code).''; - - if ($outputalsopricetotalwithtax) print ''.$langs->trans('TotalTTCShort').''; - - print ''; // No width to allow autodim - - print ''; - - print ''; - - print "\n"; - $num = count($this->lines); - $var = true; - $i = 0; - + //Line extrafield require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; $extrafieldsline = new ExtraFields($this->db); $extralabelslines=$extrafieldsline->fetch_name_optionals_label($this->table_element_line); + + $parameters = array('num'=>$num,'i'=>$i,'dateSelector'=>$dateSelector,'seller'=>$seller,'buyer'=>$buyer,'selected'=>$selected, 'extrafieldsline'=>$extrafieldsline); + $reshook = $hookmanager->executeHooks('printObjectLineTitle', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks + if (empty($reshook)) + { + print ''; + + if (! empty($conf->global->MAIN_VIEW_LINE_NUMBER)) print ' '; + + // Description + print ''.$langs->trans('Description').''; + + if ($this->element == 'supplier_proposal') + { + print ''.$langs->trans("SupplierProposalRefFourn").''; + } + + // VAT + print ''.$langs->trans('VAT').''; + + // Price HT + print ''.$langs->trans('PriceUHT').''; + + // Multicurrency + if (!empty($conf->multicurrency->enabled)) print ''.$langs->trans('PriceUHTCurrency', $this->multicurrency_code).''; + + if ($inputalsopricewithtax) print ''.$langs->trans('PriceUTTC').''; + + // Qty + print ''.$langs->trans('Qty').''; + + if($conf->global->PRODUCT_USE_UNITS) + { + print ''.$langs->trans('Unit').''; + } + + // Reduction short + print ''.$langs->trans('ReductionShort').''; + + if ($this->situation_cycle_ref) { + print '' . $langs->trans('Progress') . ''; + } + + if ($usemargins && ! empty($conf->margin->enabled) && empty($user->societe_id)) + { + if (!empty($user->rights->margins->creer)) + { + if ($conf->global->MARGIN_TYPE == "1") + print ''.$langs->trans('BuyingPrice').''; + else + print ''.$langs->trans('CostPrice').''; + } + + if (! empty($conf->global->DISPLAY_MARGIN_RATES) && $user->rights->margins->liretous) + print ''.$langs->trans('MarginRate').''; + if (! empty($conf->global->DISPLAY_MARK_RATES) && $user->rights->margins->liretous) + print ''.$langs->trans('MarkRate').''; + } + + // Total HT + print ''.$langs->trans('TotalHTShort').''; + + // Multicurrency + if (!empty($conf->multicurrency->enabled)) print ''.$langs->trans('TotalHTShortCurrency', $this->multicurrency_code).''; + + if ($outputalsopricetotalwithtax) print ''.$langs->trans('TotalTTCShort').''; + + print ''; // No width to allow autodim + + print ''; + + print ''; + + print "\n"; + } + + $var = true; + $i = 0; foreach ($this->lines as $line) { @@ -3395,7 +3401,7 @@ abstract class CommonObject } 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, 'fk_parent_line'=>$line->fk_parent_line); $reshook = $hookmanager->executeHooks('printObjectSubLine', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks } }