From e3615d43bd762a206ee2a5968edf886ceb4de0fa Mon Sep 17 00:00:00 2001 From: Christophe Battarel Date: Fri, 17 May 2013 15:02:27 +0200 Subject: [PATCH 1/5] fix bug : external users should not see costprice and margin infos --- htdocs/core/class/commonobject.class.php | 7 ++++--- htdocs/core/tpl/objectline_view.tpl.php | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 1b1466a664c09..8b9e210b4f99f 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -2632,7 +2632,7 @@ function formAddObjectLine($dateSelector,$seller,$buyer,$hookmanager=false) */ function printObjectLines($action, $seller, $buyer, $selected=0, $dateSelector=0, $hookmanager=false) { - global $conf,$langs; + global $conf,$langs,$user; print ''; if (! empty($conf->global->MAIN_VIEW_LINE_NUMBER)) @@ -2646,7 +2646,7 @@ function printObjectLines($action, $seller, $buyer, $selected=0, $dateSelector=0 print ' '; print ''.$langs->trans('Qty').''; print ''.$langs->trans('ReductionShort').''; - if (! empty($conf->margin->enabled)) { + if (! empty($conf->margin->enabled) && empty($user->societe_id)) { if ($conf->global->MARGIN_TYPE == "1") print ''.$langs->trans('BuyingPrice').''; else @@ -3044,7 +3044,8 @@ function getMarginInfos($force_price=false) { } function displayMarginInfos($force_price=false) { - global $langs, $conf; + global $langs, $conf,$user; + if (! empty($user->societe_id)) return; $marginInfo = $this->getMarginInfos($force_price); print ''; print ''; diff --git a/htdocs/core/tpl/objectline_view.tpl.php b/htdocs/core/tpl/objectline_view.tpl.php index abaef7a191084..75620334a08cb 100644 --- a/htdocs/core/tpl/objectline_view.tpl.php +++ b/htdocs/core/tpl/objectline_view.tpl.php @@ -117,7 +117,7 @@ margin->enabled)) { + if (! empty($conf->margin->enabled) && empty($user->societe_id)) { ?> global->DISPLAY_MARGIN_RATES)) {?> From 7efe39495a0d5ec0416f515c1460d00117811940 Mon Sep 17 00:00:00 2001 From: Christophe Battarel Date: Fri, 17 May 2013 15:18:50 +0200 Subject: [PATCH 2/5] french translation for CostPrice --- htdocs/langs/fr_FR/margins.lang | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/langs/fr_FR/margins.lang b/htdocs/langs/fr_FR/margins.lang index b30e79a3e7bb4..0ab270891b307 100644 --- a/htdocs/langs/fr_FR/margins.lang +++ b/htdocs/langs/fr_FR/margins.lang @@ -45,8 +45,8 @@ MargeBrute=Marge brute MargeNette=Marge nette MARGIN_TYPE_DETAILS=Marge brute : Prix de vente HT - Prix d'achat HT
Marge nette : Prix de vente HT - Coût de revient -CostPrice=Prix ​​d'achat -BuyingCost=Coût de revient +BuyingPrice=Prix ​​d'achat +CostPrice=Prix de revient UnitCharges=Charge unitaire Charges=Charges From 347fc6d714cdf12b0abdd5b95f09c9fb8a86ee2f Mon Sep 17 00:00:00 2001 From: Christophe Battarel Date: Sun, 19 May 2013 14:04:21 +0200 Subject: [PATCH 3/5] fix unauthorized access to margins for external user --- htdocs/core/modules/modMargin.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/modules/modMargin.class.php b/htdocs/core/modules/modMargin.class.php index 4baa4f5168016..34e6ba322dbc1 100644 --- a/htdocs/core/modules/modMargin.class.php +++ b/htdocs/core/modules/modMargin.class.php @@ -80,7 +80,7 @@ function __construct($db) // New pages on tabs $this->tabs = array( 'product:+margin:Margins:margins:$conf->margin->enabled:/margin/tabs/productMargins.php?id=__ID__', - 'thirdparty:+margin:Margins:margins:$conf->margin->enabled:/margin/tabs/thirdpartyMargins.php?socid=__ID__' + 'thirdparty:+margin:Margins:margins:$conf->margin->enabled && empty($user->societe_id)s:/margin/tabs/thirdpartyMargins.php?socid=__ID__' ); From fea0e6de54077d46c6ec6e31f788c6dc6551772a Mon Sep 17 00:00:00 2001 From: Christophe Battarel Date: Sun, 19 May 2013 14:06:51 +0200 Subject: [PATCH 4/5] Fix - external users should not see costprice and margin infos --- ChangeLog | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 9ceddc61d1a5a..df8af03efeab2 100644 --- a/ChangeLog +++ b/ChangeLog @@ -32,7 +32,7 @@ English Dolibarr ChangeLog - Fix: [ bug #865 ] Dolibarr navigation array in project/task do not work - Fix: [ bug #866 ] Standing order from an invoice suggests invoice total amount instead of remaining to pay - Fix: [ bug #788 ] Date of linked interventions are not shown - +- Fix: external users should not see costprice and margin infos ***** ChangeLog for 3.3.1 compared to 3.3 ***** From f8ca8426856c341dbcde7add82580bf74864a46d Mon Sep 17 00:00:00 2001 From: Christophe Battarel Date: Mon, 20 May 2013 10:10:34 +0200 Subject: [PATCH 5/5] fix typo error --- htdocs/core/modules/modMargin.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/modules/modMargin.class.php b/htdocs/core/modules/modMargin.class.php index 34e6ba322dbc1..cc5eb01ffa310 100644 --- a/htdocs/core/modules/modMargin.class.php +++ b/htdocs/core/modules/modMargin.class.php @@ -80,7 +80,7 @@ function __construct($db) // New pages on tabs $this->tabs = array( 'product:+margin:Margins:margins:$conf->margin->enabled:/margin/tabs/productMargins.php?id=__ID__', - 'thirdparty:+margin:Margins:margins:$conf->margin->enabled && empty($user->societe_id)s:/margin/tabs/thirdpartyMargins.php?socid=__ID__' + 'thirdparty:+margin:Margins:margins:$conf->margin->enabled && empty($user->societe_id):/margin/tabs/thirdpartyMargins.php?socid=__ID__' );
  pa_ht); ?>