From 4c7741f5f0cd1da3a14853130307dd889914eed8 Mon Sep 17 00:00:00 2001 From: Christophe Battarel Date: Tue, 20 Aug 2013 12:11:19 +0200 Subject: [PATCH] manage user permissions for margin display --- htdocs/core/class/commonobject.class.php | 6 ++++-- htdocs/core/tpl/objectline_view.tpl.php | 4 ++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 8e6970f754d..06635189ce6 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -2732,9 +2732,9 @@ abstract class CommonObject else print ''.$langs->trans('CostPrice').''; - if (! empty($conf->global->DISPLAY_MARGIN_RATES)) + if (! empty($conf->global->DISPLAY_MARGIN_RATES) && $user->rights->margins->liretous) print ''.$langs->trans('MarginRate').''; - if (! empty($conf->global->DISPLAY_MARK_RATES)) + if (! empty($conf->global->DISPLAY_MARK_RATES) && $user->rights->margins->liretous) print ''.$langs->trans('MarkRate').''; } @@ -3170,6 +3170,8 @@ abstract class CommonObject global $langs, $conf, $user; if (! empty($user->societe_id)) return; + + if (! $user->rights->margins->liretous) return; $marginInfo = $this->getMarginInfos($force_price); diff --git a/htdocs/core/tpl/objectline_view.tpl.php b/htdocs/core/tpl/objectline_view.tpl.php index 3e6f4dc9a49..681b37f3890 100644 --- a/htdocs/core/tpl/objectline_view.tpl.php +++ b/htdocs/core/tpl/objectline_view.tpl.php @@ -123,11 +123,11 @@ if (! empty($conf->margin->enabled) && empty($user->societe_id)) { ?> pa_ht); ?> - global->DISPLAY_MARGIN_RATES)) {?> + global->DISPLAY_MARGIN_RATES) && $user->rights->margins->liretous) {?> pa_ht == 0)?'n/a':price($line->marge_tx).'%'); ?> global->DISPLAY_MARK_RATES)) {?> + if (! empty($conf->global->DISPLAY_MARK_RATES) && $user->rights->margins->liretous) {?> marque_tx).'%'; ?>