Skip to content

Commit

Permalink
FIX with no perm on supplier, must not see supplier of the best price
Browse files Browse the repository at this point in the history
  • Loading branch information
eldy committed Nov 30, 2024
1 parent b56ac12 commit ac231f4
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions htdocs/fourn/class/fournisseur.product.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -1128,12 +1128,12 @@ public function getSocNomUrl($withpicto = 0, $option = 'supplier', $maxlen = 0,
public function display_price_product_fournisseur($showunitprice = 1, $showsuptitle = 1, $maxlen = 0, $notooltip = 0, $productFournList = array())
{
// phpcs:enable
global $conf, $langs;
global $conf, $langs, $user;

$out = '';
$langs->load("suppliers");
if (count($productFournList) > 0) {
$out .= '<table class="nobordernopadding" width="100%">';
$out .= '<table class="nobordernopadding centpercent">';
$out .= '<tr><td class="liste_titre right">'.($showunitprice ? $langs->trans("Price").' '.$langs->trans("HT") : '').'</td>';
$out .= '<td class="liste_titre right">'.($showunitprice ? $langs->trans("QtyMin") : '').'</td>';
$out .= '<td class="liste_titre">'.$langs->trans("Supplier").'</td>';
Expand All @@ -1146,9 +1146,12 @@ public function display_price_product_fournisseur($showunitprice = 1, $showsupti
}
$out .= '</table>';
} else {
$out = ($showunitprice ? price($this->fourn_unitprice * (1 - $this->fourn_remise_percent / 100) + $this->fourn_remise, 0, $langs, 1, -1, -1, $conf->currency).' '.$langs->trans("HT").' &nbsp; <span class="opacitymedium">(</span>' : '');
$out .= ($showsuptitle ? '<span class="opacitymedium">'.$langs->trans("Supplier").'</span>: ' : '').$this->getSocNomUrl(1, 'supplier', $maxlen, $notooltip).' / <span class="opacitymedium">'.$langs->trans("SupplierRef").'</span>: '.$this->ref_supplier;
$out .= ($showunitprice ? '<span class="opacitymedium">)</span>' : '');
$out = ($showunitprice ? price($this->fourn_unitprice * (1 - $this->fourn_remise_percent / 100) + $this->fourn_remise, 0, $langs, 1, -1, -1, $conf->currency).' '.$langs->trans("HT") : '');
if ($user->hasRight("fournisseur", "read")) { // Without permission, never show the best supplier seller
$out .= ($showunitprice ? ' &nbsp; <span class="opacitymedium">(</span>' : '');
$out .= ($showsuptitle ? '<span class="opacitymedium">'.$langs->trans("Supplier").'</span>: ' : '').$this->getSocNomUrl(1, 'supplier', $maxlen, $notooltip).' / <span class="opacitymedium">'.$langs->trans("SupplierRef").'</span>: '.$this->ref_supplier;
$out .= ($showunitprice ? '<span class="opacitymedium">)</span>' : '');
}
}
return $out;
}
Expand Down

0 comments on commit ac231f4

Please sign in to comment.