From 49e74b07fe2de6b59db4e70568b7134060f1a4e8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Charl=C3=A8ne=20Benke?= <1179011+defrance@users.noreply.github.com> Date: Mon, 3 Nov 2025 10:21:40 +0100 Subject: [PATCH] NEW : add conditional supplier price display (#35900) * add conditional supplier price display conditional display of supplier price information based on advanced user permissions. * Remove unnecessary blank lines in card.php --- htdocs/product/stock/card.php | 33 +++++++++++++++++---------------- 1 file changed, 17 insertions(+), 16 deletions(-) diff --git a/htdocs/product/stock/card.php b/htdocs/product/stock/card.php index ac02d5c95dc..836b6b058ea 100644 --- a/htdocs/product/stock/card.php +++ b/htdocs/product/stock/card.php @@ -6,7 +6,7 @@ * Copyright (C) 2016 Francis Appels * Copyright (C) 2021 Noé Cendrier * Copyright (C) 2021-2025 Frédéric France - * Copyright (C) 2022-2023 Charlene Benke + * Copyright (C) 2022-2025 Charlene Benke * Copyright (C) 2023 Christian Foellmann * Copyright (C) 2024-2025 MDW * @@ -661,15 +661,16 @@ if ($action == 'create') { $totalarray['pos'][$totalarray['nbfield']] = 'units'; $totalarray['type'][$totalarray['nbfield']] = 'string'; } + $usercancreadsupplierprice = getDolGlobalString('MAIN_USE_ADVANCED_PERMS') ? $user->hasRight('product', 'product_advance', 'read_supplier_prices') : $user->hasRight('product', 'read'); + if ($usercancreadsupplierprice) { + print_liste_field_titre($form->textwithpicto($langs->trans("AverageUnitPricePMPShort"), $langs->trans("AverageUnitPricePMPDesc")), "", "p.pmp", "&id=".$id, "", '', $sortfield, $sortorder, 'right '); + $totalarray['nbfield']++; - print_liste_field_titre($form->textwithpicto($langs->trans("AverageUnitPricePMPShort"), $langs->trans("AverageUnitPricePMPDesc")), "", "p.pmp", "&id=".$id, "", '', $sortfield, $sortorder, 'right '); - $totalarray['nbfield']++; - - print_liste_field_titre("EstimatedStockValueShort", "", "svalue", "&id=".$id, "", '', $sortfield, $sortorder, 'right '); - $totalarray['nbfield']++; - $totalarray['pos'][$totalarray['nbfield']] = 'totalvalue'; - $totalarray['type'][$totalarray['nbfield']] = ''; - + print_liste_field_titre("EstimatedStockValueShort", "", "svalue", "&id=".$id, "", '', $sortfield, $sortorder, 'right '); + $totalarray['nbfield']++; + $totalarray['pos'][$totalarray['nbfield']] = 'totalvalue'; + $totalarray['type'][$totalarray['nbfield']] = ''; + } if (!getDolGlobalString('PRODUIT_MULTIPRICES')) { print_liste_field_titre("SellPriceMin", "", "p.price", "&id=".$id, "", '', $sortfield, $sortorder, 'right '); @@ -832,14 +833,14 @@ if ($action == 'create') { print $productstatic->getLabelOfUnit('long', $langs); print ''; } + if ($usercancreadsupplierprice) { + // Price buy PMP + print ''.price(price2num($objp->ppmp, 'MU')).''; - // Price buy PMP - print ''.price(price2num($objp->ppmp, 'MU')).''; - - // Total PMP - print ''.price(price2num($objp->ppmp * $objp->value, 'MT')).''; - $totalvalue += price2num($objp->ppmp * $objp->value, 'MT'); - + // Total PMP + print ''.price(price2num($objp->ppmp * $objp->value, 'MT')).''; + $totalvalue += price2num($objp->ppmp * $objp->value, 'MT'); + } $pricemin = 0; // Price sell min if (!getDolGlobalString('PRODUIT_MULTIPRICES')) {