Skip to content

Commit

Permalink
Add hook
Browse files Browse the repository at this point in the history
  • Loading branch information
thersane-john committed Dec 20, 2024
1 parent 7cf1a05 commit 41309e3
Showing 1 changed file with 33 additions and 13 deletions.
46 changes: 33 additions & 13 deletions htdocs/core/tpl/objectline_view.tpl.php
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,12 @@
<?php } ?>
<td class="linecoldescription minwidth300imp"><?php $coldisplay++; ?><div id="line_<?php print $line->id; ?>"></div>
<?php


$parameters = ['line' => $line, 'i' =>& $i, 'coldisplay' =>& $coldisplay];
$reshook = $hookmanager->executeHooks('objectLineView_BeforeProduct', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;

if (($line->info_bits & 2) == 2) {
print '<a href="'.DOL_URL_ROOT.'/comm/remx.php?id='.$this->socid.'">';
$txt = '';
Expand Down Expand Up @@ -265,8 +271,12 @@
}
}


$parameters = ['line' => $line, 'i' =>& $i, 'coldisplay' =>& $coldisplay];
$reshook = $hookmanager->executeHooks('objectLineView_BeforeProductExtrafield', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
// Line extrafield
if (!empty($extrafields)) {
if (!empty($extrafields) && empty($reshook)) {
$temps = $line->showOptionals($extrafields, 'view', array(), '', '', 1, 'line');
if (!empty($temps)) {
print '<div style="padding-top: 10px" id="extrafield_lines_area_'.$line->id.'" name="extrafield_lines_area_'.$line->id.'">';
Expand All @@ -276,19 +286,29 @@
}
}

if ($user->hasRight('fournisseur', 'lire') && isset($line->fk_fournprice) && $line->fk_fournprice > 0 && !getDolGlobalString('SUPPLIER_HIDE_SUPPLIER_OBJECTLINES')) {
require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.product.class.php';
$productfourn = new ProductFournisseur($this->db);
$productfourn->fetch_product_fournisseur_price($line->fk_fournprice);
print '<div class="clearboth"></div>';
print '<span class="opacitymedium">'.$langs->trans('Supplier').' : </span>'.$productfourn->getSocNomUrl(1, 'supplier').' - <span class="opacitymedium">'.$langs->trans('Ref').' : </span>';
// Supplier ref
if ($user->hasRight('produit', 'creer') || $user->hasRight('service', 'creer')) { // change required right here
print $productfourn->getNomUrl();
} else {
print $productfourn->ref_supplier;


$parameters = ['line' => $line, 'i' =>& $i, 'coldisplay' =>& $coldisplay];
$reshook = $hookmanager->executeHooks('objectLineView_ProductSupplier', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
if (empty($reshook)) {

Check failure on line 294 in htdocs/core/tpl/objectline_view.tpl.php

View workflow job for this annotation

GitHub Actions / pre-commit / pre-commit

Line indented incorrectly; expected 0 tabs, found 1
if ($user->hasRight('fournisseur', 'lire') && isset($line->fk_fournprice) && $line->fk_fournprice > 0 && !getDolGlobalString('SUPPLIER_HIDE_SUPPLIER_OBJECTLINES')) {

Check failure on line 295 in htdocs/core/tpl/objectline_view.tpl.php

View workflow job for this annotation

GitHub Actions / pre-commit / pre-commit

Line indented incorrectly; expected 1 tabs, found 2
require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.product.class.php';
$productfourn = new ProductFournisseur($this->db);
$productfourn->fetch_product_fournisseur_price($line->fk_fournprice);
print '<div class="clearboth"></div>';
print '<span class="opacitymedium">'.$langs->trans('Supplier').' : </span>'.$productfourn->getSocNomUrl(1, 'supplier').' - <span class="opacitymedium">'.$langs->trans('Ref').' : </span>';
// Supplier ref
if ($user->hasRight('produit', 'creer') || $user->hasRight('service', 'creer')) { // change required right here

Check failure on line 302 in htdocs/core/tpl/objectline_view.tpl.php

View workflow job for this annotation

GitHub Actions / pre-commit / pre-commit

Line indented incorrectly; expected 2 tabs, found 3
print $productfourn->getNomUrl();
} else {

Check failure on line 304 in htdocs/core/tpl/objectline_view.tpl.php

View workflow job for this annotation

GitHub Actions / pre-commit / pre-commit

Line indented incorrectly; expected 2 tabs, found 3
print $productfourn->ref_supplier;
}

Check failure on line 306 in htdocs/core/tpl/objectline_view.tpl.php

View workflow job for this annotation

GitHub Actions / pre-commit / pre-commit

Line indented incorrectly; expected 2 tabs, found 3
}

Check failure on line 307 in htdocs/core/tpl/objectline_view.tpl.php

View workflow job for this annotation

GitHub Actions / pre-commit / pre-commit

Line indented incorrectly; expected 1 tabs, found 2
}

Check failure on line 308 in htdocs/core/tpl/objectline_view.tpl.php

View workflow job for this annotation

GitHub Actions / pre-commit / pre-commit

Line indented incorrectly; expected 0 tabs, found 1
}




if (isModEnabled('accounting') && !empty($line->fk_accounting_account) && $line->fk_accounting_account > 0) {
$accountingaccount = new AccountingAccount($this->db);
Expand Down

0 comments on commit 41309e3

Please sign in to comment.