From d592e776fd579ff62b66c4482685f2225383aa9e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Salvador?= Date: Tue, 3 Sep 2013 11:36:56 +0200 Subject: [PATCH 1/2] hide purchase price unless the user has the appropriate rights Conflicts: htdocs/product/liste.php --- htdocs/product/liste.php | 42 +++++++++++++++++++++++----------------- 1 file changed, 24 insertions(+), 18 deletions(-) diff --git a/htdocs/product/liste.php b/htdocs/product/liste.php index 9680a1346b2..6b3b74789b4 100644 --- a/htdocs/product/liste.php +++ b/htdocs/product/liste.php @@ -303,7 +303,9 @@ else print_liste_field_titre($langs->trans("DateModification"), $_SERVER["PHP_SELF"], "p.tms",$param,"",'align="center"',$sortfield,$sortorder); if (! empty($conf->service->enabled) && $type != 0) print_liste_field_titre($langs->trans("Duration"), $_SERVER["PHP_SELF"], "p.duration",$param,"",'align="center"',$sortfield,$sortorder); if (empty($conf->global->PRODUIT_MULTIPRICES)) print_liste_field_titre($langs->trans("SellingPrice"), $_SERVER["PHP_SELF"], "p.price",$param,"",'align="right"',$sortfield,$sortorder); - print ''.$langs->trans("BuyingPriceMinShort").''; + if ($user->rights->produit->creer) { + print ''.$langs->trans("BuyingPriceMinShort").''; + } if (! empty($conf->stock->enabled) && $user->rights->stock->lire && $type != 1) print ''.$langs->trans("DesiredStock").''; if (! empty($conf->stock->enabled) && $user->rights->stock->lire && $type != 1) print ''.$langs->trans("PhysicalStock").''; print_liste_field_titre($langs->trans("Sell"), $_SERVER["PHP_SELF"], "p.tosell",$param,"",'align="right"',$sortfield,$sortorder); @@ -345,9 +347,11 @@ else } // Minimum buying Price - print ''; - print ' '; - print ''; + if ($user->rights->produit->creer) { + print ''; + print ' '; + print ''; + } // Stock if (! empty($conf->stock->enabled) && $user->rights->stock->lire && $type != 1) @@ -442,21 +446,23 @@ else } // Better buy price - print ''; - if ($objp->minsellprice != '') - { - //print price($objp->minsellprice).' '.$langs->trans("HT"); - if ($product_fourn->find_min_price_product_fournisseur($objp->rowid) > 0) - { - if ($product_fourn->product_fourn_price_id > 0) - { - $htmltext=$product_fourn->display_price_product_fournisseur(); - if (! empty($conf->fournisseur->enabled) && $user->rights->fournisseur->lire) print $form->textwithpicto(price($product_fourn->fourn_unitprice).' '.$langs->trans("HT"),$htmltext); - else print price($product_fourn->fourn_unitprice).' '.$langs->trans("HT"); - } - } + if ($user->rights->produit->creer) { + print ''; + if ($objp->minsellprice != '') + { + //print price($objp->minsellprice).' '.$langs->trans("HT"); + if ($product_fourn->find_min_price_product_fournisseur($objp->rowid) > 0) + { + if ($product_fourn->product_fourn_price_id > 0) + { + $htmltext=$product_fourn->display_price_product_fournisseur(); + if (! empty($conf->fournisseur->enabled) && $user->rights->fournisseur->lire) print $form->textwithpicto(price($product_fourn->fourn_unitprice).' '.$langs->trans("HT"),$htmltext); + else print price($product_fourn->fourn_unitprice).' '.$langs->trans("HT"); + } + } + } + print ''; } - print ''; // Show stock if (! empty($conf->stock->enabled) && $user->rights->stock->lire && $type != 1) From 4454bc16deccb8c3c5342d8ec55f2fff22bd6675 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Salvador?= Date: Fri, 6 Sep 2013 10:49:18 +0200 Subject: [PATCH 2/2] indentation --- htdocs/product/liste.php | 48 ++++++++++++++++++++-------------------- 1 file changed, 24 insertions(+), 24 deletions(-) diff --git a/htdocs/product/liste.php b/htdocs/product/liste.php index 6b3b74789b4..703177d9398 100644 --- a/htdocs/product/liste.php +++ b/htdocs/product/liste.php @@ -304,8 +304,8 @@ else if (! empty($conf->service->enabled) && $type != 0) print_liste_field_titre($langs->trans("Duration"), $_SERVER["PHP_SELF"], "p.duration",$param,"",'align="center"',$sortfield,$sortorder); if (empty($conf->global->PRODUIT_MULTIPRICES)) print_liste_field_titre($langs->trans("SellingPrice"), $_SERVER["PHP_SELF"], "p.price",$param,"",'align="right"',$sortfield,$sortorder); if ($user->rights->produit->creer) { - print ''.$langs->trans("BuyingPriceMinShort").''; - } + print ''.$langs->trans("BuyingPriceMinShort").''; + } if (! empty($conf->stock->enabled) && $user->rights->stock->lire && $type != 1) print ''.$langs->trans("DesiredStock").''; if (! empty($conf->stock->enabled) && $user->rights->stock->lire && $type != 1) print ''.$langs->trans("PhysicalStock").''; print_liste_field_titre($langs->trans("Sell"), $_SERVER["PHP_SELF"], "p.tosell",$param,"",'align="right"',$sortfield,$sortorder); @@ -347,11 +347,11 @@ else } // Minimum buying Price - if ($user->rights->produit->creer) { - print ''; - print ' '; - print ''; - } + if ($user->rights->produit->creer) { + print ''; + print ' '; + print ''; + } // Stock if (! empty($conf->stock->enabled) && $user->rights->stock->lire && $type != 1) @@ -446,23 +446,23 @@ else } // Better buy price - if ($user->rights->produit->creer) { - print ''; - if ($objp->minsellprice != '') - { - //print price($objp->minsellprice).' '.$langs->trans("HT"); - if ($product_fourn->find_min_price_product_fournisseur($objp->rowid) > 0) - { - if ($product_fourn->product_fourn_price_id > 0) - { - $htmltext=$product_fourn->display_price_product_fournisseur(); - if (! empty($conf->fournisseur->enabled) && $user->rights->fournisseur->lire) print $form->textwithpicto(price($product_fourn->fourn_unitprice).' '.$langs->trans("HT"),$htmltext); - else print price($product_fourn->fourn_unitprice).' '.$langs->trans("HT"); - } - } - } - print ''; - } + if ($user->rights->produit->creer) { + print ''; + if ($objp->minsellprice != '') + { + //print price($objp->minsellprice).' '.$langs->trans("HT"); + if ($product_fourn->find_min_price_product_fournisseur($objp->rowid) > 0) + { + if ($product_fourn->product_fourn_price_id > 0) + { + $htmltext=$product_fourn->display_price_product_fournisseur(); + if (! empty($conf->fournisseur->enabled) && $user->rights->fournisseur->lire) print $form->textwithpicto(price($product_fourn->fourn_unitprice).' '.$langs->trans("HT"),$htmltext); + else print price($product_fourn->fourn_unitprice).' '.$langs->trans("HT"); + } + } + } + print ''; + } // Show stock if (! empty($conf->stock->enabled) && $user->rights->stock->lire && $type != 1)