diff --git a/ChangeLog b/ChangeLog
index 9ceddc61d1a..df8af03efea 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 *****
diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php
index 1b1466a664c..8b9e210b4f9 100644
--- a/htdocs/core/class/commonobject.class.php
+++ b/htdocs/core/class/commonobject.class.php
@@ -2632,7 +2632,7 @@ abstract class CommonObject
*/
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 @@ abstract class CommonObject
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 @@ abstract class CommonObject
}
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/modules/modMargin.class.php b/htdocs/core/modules/modMargin.class.php
index 4baa4f51680..cc5eb01ffa3 100644
--- a/htdocs/core/modules/modMargin.class.php
+++ b/htdocs/core/modules/modMargin.class.php
@@ -80,7 +80,7 @@ class modMargin extends DolibarrModules
// 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):/margin/tabs/thirdpartyMargins.php?socid=__ID__'
);
diff --git a/htdocs/core/tpl/objectline_view.tpl.php b/htdocs/core/tpl/objectline_view.tpl.php
index abaef7a1910..75620334a08 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)) {
?>
pa_ht); ?> |
global->DISPLAY_MARGIN_RATES)) {?>
diff --git a/htdocs/langs/fr_FR/margins.lang b/htdocs/langs/fr_FR/margins.lang
index b30e79a3e7b..0ab270891b3 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