From e854700da5942cb0a637ffd2e4e46bce7715ae66 Mon Sep 17 00:00:00 2001
From: Regis Houssin <regis@dolibarr.fr>
Date: Sun, 30 Jul 2006 18:03:59 +0000
Subject: [PATCH] =?UTF-8?q?Fix:=20bug=20#17236=20Modif:=20on=20cache=20les?=
 =?UTF-8?q?=20onglets=20"note",=20"notifications"=20et=20"info"=20de=20la?=
 =?UTF-8?q?=20fiche=20soci=E9t=E9=20pour=20=20un=20utilisateur=20externe.?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 htdocs/comm/fiche.php      |  6 +++---
 htdocs/compta/fiche.php    | 10 ++++++++--
 htdocs/lib/company.lib.php | 20 +++++++++++++-------
 3 files changed, 24 insertions(+), 12 deletions(-)

diff --git a/htdocs/comm/fiche.php b/htdocs/comm/fiche.php
index d84626fe5f6..4e1d3be899a 100644
--- a/htdocs/comm/fiche.php
+++ b/htdocs/comm/fiche.php
@@ -81,7 +81,7 @@ if ($_GET["action"] == 'attribute_prefix')
     $societe->attribute_prefix($db, $_GET["socid"]);
 }
 // conditions de r�glement
-if ($_POST["action"] == 'setconditions')
+if ($_POST["action"] == 'setconditions' && (!$user->societe_id > 0))
 {
     
 	$societe = new Societe($db, $_GET["socid"]);
@@ -92,7 +92,7 @@ if ($_POST["action"] == 'setconditions')
     if (! $result) dolibarr_print_error($result);
 }
 // mode de r�glement
-if ($_POST["action"] == 'setmode')
+if ($_POST["action"] == 'setmode' && (!$user->societe_id > 0))
 {
     $societe = new Societe($db, $_GET["socid"]);
     $societe->mode_reglement=$_POST['mode_reglement_id'];
@@ -102,7 +102,7 @@ if ($_POST["action"] == 'setmode')
     if (! $result) dolibarr_print_error($result);
 }
 // assuj�tissement � la TVA
-if ($_POST["action"] == 'setassujtva')
+if ($_POST["action"] == 'setassujtva' && (!$user->societe_id > 0))
 {
 	$societe = new Societe($db, $_GET["socid"]);
     $societe->tva_assuj=$_POST['assujtva_value'];
diff --git a/htdocs/compta/fiche.php b/htdocs/compta/fiche.php
index caa53f83e1b..8396bd37a60 100644
--- a/htdocs/compta/fiche.php
+++ b/htdocs/compta/fiche.php
@@ -178,7 +178,10 @@ if ($socid > 0)
         print '<table width="100%" class="nobordernopadding"><tr><td nowrap>';
         print $langs->trans("CustomerRelativeDiscountShort");
         print '<td><td align="right">';
-        print '<a href="'.DOL_URL_ROOT.'/comm/remise.php?id='.$societe->id.'">'.img_edit($langs->trans("Modify")).'</a>';
+        if (!$user->societe_id > 0)
+        {
+        	print '<a href="'.DOL_URL_ROOT.'/comm/remise.php?id='.$societe->id.'">'.img_edit($langs->trans("Modify")).'</a>';
+        }
         print '</td></tr></table>';
         print '</td><td colspan="3">'.($societe->remise_client?$societe->remise_client.'%':$langs->trans("DiscountNone")).'</td>';
         print '</tr>';
@@ -189,7 +192,10 @@ if ($socid > 0)
         print '<tr><td nowrap>';
         print $langs->trans("CustomerAbsoluteDiscountShort");
         print '<td><td align="right">';
-        print '<a href="'.DOL_URL_ROOT.'/comm/remx.php?id='.$societe->id.'">'.img_edit($langs->trans("Modify")).'</a>';
+        if (!$user->societe_id > 0)
+        {
+        	print '<a href="'.DOL_URL_ROOT.'/comm/remx.php?id='.$societe->id.'">'.img_edit($langs->trans("Modify")).'</a>';
+        }
         print '</td></tr></table>';
         print '</td>';
         print '<td colspan="3">';
diff --git a/htdocs/lib/company.lib.php b/htdocs/lib/company.lib.php
index ff9e4bade09..d340a00b33f 100644
--- a/htdocs/lib/company.lib.php
+++ b/htdocs/lib/company.lib.php
@@ -71,10 +71,13 @@ function societe_prepare_head($objsoc)
         $h++;
     }
 
-    $head[$h][0] = DOL_URL_ROOT.'/socnote.php?socid='.$objsoc->id;
-    $head[$h][1] = $langs->trans("Note");
-    $head[$h][2] = 'note';
-    $h++;
+    if ($user->societe_id == 0)
+    {
+    	$head[$h][0] = DOL_URL_ROOT.'/socnote.php?socid='.$objsoc->id;
+    	$head[$h][1] = $langs->trans("Note");
+    	$head[$h][2] = 'note';
+    	$h++;
+    }
 
     if ($user->societe_id == 0)
     {
@@ -84,18 +87,21 @@ function societe_prepare_head($objsoc)
         $h++;
     }
 
-    if (! $conf->global->SOCIETE_DISABLE_NOTIFICATIONS)
+    if (! $conf->global->SOCIETE_DISABLE_NOTIFICATIONS && $user->societe_id == 0)
     {
 	    $head[$h][0] = DOL_URL_ROOT.'/societe/notify/fiche.php?socid='.$objsoc->id;
 	    $head[$h][1] = $langs->trans("Notifications");
 	    $head[$h][2] = 'notify';
 	    $h++;
-	}
-	
+	 }
+	 
+	 if ($user->societe_id == 0)
+   {	
     $head[$h][0] = DOL_URL_ROOT.'/societe/info.php?socid='.$objsoc->id;
     $head[$h][1] = $langs->trans("Info");
     $head[$h][2] = 'info';
     $h++;
+  }
 
     if ($conf->bookmark->enabled && $user->rights->bookmark->creer)
     {
-- 
GitLab