From 06b8e939bd070ec6e28869ac86d0743196aba2a2 Mon Sep 17 00:00:00 2001 From: Christophe Battarel Date: Tue, 20 Aug 2013 12:04:01 +0200 Subject: [PATCH] manage user permissions for margin rate --- .../core/tpl/freeproductline_create.tpl.php | 34 +++++++++-- .../tpl/predefinedproductline_create.tpl.php | 59 ++++++++++++++----- 2 files changed, 73 insertions(+), 20 deletions(-) diff --git a/htdocs/core/tpl/freeproductline_create.tpl.php b/htdocs/core/tpl/freeproductline_create.tpl.php index 85d310c39c7..2bf8a55a3d0 100644 --- a/htdocs/core/tpl/freeproductline_create.tpl.php +++ b/htdocs/core/tpl/freeproductline_create.tpl.php @@ -61,13 +61,21 @@ if (! empty($conf->margin->enabled) && ! empty($object->element) && in_array($ob ?> global->DISPLAY_MARGIN_RATES)) + if ($user->rights->margins->creer) { - echo ''.$langs->trans('MarginRate').''; + if(! empty($conf->global->DISPLAY_MARGIN_RATES)) + { + echo ''.$langs->trans('MarginRate').''; + } + if(! empty($conf->global->DISPLAY_MARK_RATES)) + { + echo ''.$langs->trans('MarkRate').''; + } } - if(! empty($conf->global->DISPLAY_MARK_RATES)) + else { - echo ''.$langs->trans('MarkRate').''; + if (! empty($conf->global->DISPLAY_MARGIN_RATES)) $colspan++; + if (! empty($conf->global->DISPLAY_MARK_RATES)) $colspan++; } } ?> @@ -125,12 +133,26 @@ if (! empty($conf->margin->enabled) && ! empty($object->element) && in_array($ob value=""> rights->margins->creer) + { if (! empty($conf->global->DISPLAY_MARGIN_RATES)) { echo '%'; } elseif (! empty($conf->global->DISPLAY_MARK_RATES)) { echo '%'; } + } + else + { + if (! empty($conf->global->DISPLAY_MARGIN_RATES)) { + $colspan++; + $coldisplay++; + } + if (! empty($conf->global->DISPLAY_MARK_RATES)) { + $colspan++; + $coldisplay++; + } + } } ?> @@ -190,7 +212,9 @@ if (! empty($conf->service->enabled) && $dateSelector) -margin->enabled) { ?> +margin->enabled && $user->rights->margins->creer) +{ +?>