Sorry @ariffidaali
it seems i couldn’t explain my question.
after editing product.php, all users even administrators cannot see best buying, AWP).
My question was is there any way to allow administrators to see those data under the product and keep them hidden for a selected user?
Thank you
Hi @mmamin ,
It’s possible to hide if the user has supplier/vendor permission disabled.
// Cost price. Can be used for margin module for option "calculate margin on explicit cost price
if (!empty($user->rights->fournisseur->lire)) {
print '<tr><td>';
$textdesc = $langs->trans("CostPriceDescription");
$textdesc .= "<br>".$langs->trans("CostPriceUsage");
$text = $form->textwithpicto($langs->trans("CostPrice"), $textdesc, 1, 'help', '');
print $form->editfieldkey($text, 'cost_price', $object->cost_price, $object, $usercancreate, 'amount:6');
print '</td><td>';
print $form->editfieldval($text, 'cost_price', $object->cost_price, $object, $usercancreate, 'amount:6');
print '</td></tr>'; }
// AWP
if (!empty($user->rights->fournisseur->lire)) {
print '<tr><td class="titlefield">';
print $form->textwithpicto($langs->trans("AverageUnitPricePMPShort"), $langs->trans("AverageUnitPricePMPDesc"));
print '</td>';
print '<td>';
if ($object->pmp > 0) {
print price($object->pmp).' '.$langs->trans("HT");
}
print '</td>';
print '</tr>'; }
// Minimum Price
if (!empty($user->rights->fournisseur->lire)) {
print '<tr><td>'.$langs->trans("BuyingPriceMin").'</td>';
print '<td>';
$product_fourn = new ProductFournisseur($db);
if ($product_fourn->find_min_price_product_fournisseur($object->id) > 0) {
if ($product_fourn->product_fourn_price_id > 0) {
print $product_fourn->display_price_product_fournisseur();
} else {
print $langs->trans("NotDefined");
}
}
print '</td></tr>'; }
/*
* Stock detail (by warehouse). May go down into batch details.
*/
print '<div class="div-table-responsive">';
print '<table class="noborder centpercent">';
print '<tr class="liste_titre">';
print '<td colspan="4">'.$langs->trans("Warehouse").'</td>';
print '<td class="right">'.$langs->trans("NumberOfUnit").'</td>';
// Hide Weighted average price and Input Stock
if (!empty($user->rights->fournisseur->lire)) {
print '<td class="right">'.$form->textwithpicto($langs->trans("AverageUnitPricePMPShort"), $langs->trans("AverageUnitPricePMPDesc")).'</td>';
print '<td class="right">'.$langs->trans("EstimatedStockValueShort").'</td>'; }
print '<td class="right">'.$langs->trans("SellPriceMin").'</td>';
print '<td class="right">'.$langs->trans("EstimatedStockValueSellShort").'</td>';
print '<td></td>';
print '<td></td>';
print '</tr>';
if (!empty($user->rights->fournisseur->lire))
Hides from users who don't have suppliers/vendors permission
3 Likes
Hi
WOW !! This is a better way to hide informations . I learn a lot .
Thanks for your kind solution .
1 Like
Do you know where could i do the same thing to hide weighted average price pop out box in propal line as below ?