From ab06dd956b239f44bc9447de2a2b0c064830860f Mon Sep 17 00:00:00 2001
From: Rodolphe Quiedeville <rodolphe@quiedeville.org>
Date: Tue, 30 Aug 2005 14:52:54 +0000
Subject: [PATCH] Modif permissions

---
 htdocs/telephonie/client/factures.php |  9 +++++++--
 htdocs/telephonie/client/fiche.php    | 16 ++++++++++++++--
 htdocs/telephonie/client/lignes.php   |  9 +++++++--
 3 files changed, 28 insertions(+), 6 deletions(-)

diff --git a/htdocs/telephonie/client/factures.php b/htdocs/telephonie/client/factures.php
index f796b006740..18caf491d88 100644
--- a/htdocs/telephonie/client/factures.php
+++ b/htdocs/telephonie/client/factures.php
@@ -36,9 +36,14 @@ if ($cancel == $langs->trans("Cancel"))
 if ($_GET["id"])
 {
   $soc = new Societe($db);
-  $result = $soc->fetch($_GET["id"]);
+  $result = $soc->fetch($_GET["id"], $user);
 
-  if ( $result == 1 )
+  if (!$soc->perm_read)
+    {
+      print "Lecture non authoris�e";
+    }
+
+  if ( $result == 1 && $soc->perm_read)
     { 
       if ($_GET["action"] <> 'edit' && $_GET["action"] <> 're-edit')
 	{
diff --git a/htdocs/telephonie/client/fiche.php b/htdocs/telephonie/client/fiche.php
index 11db1713ccb..b2ff6019743 100644
--- a/htdocs/telephonie/client/fiche.php
+++ b/htdocs/telephonie/client/fiche.php
@@ -38,9 +38,14 @@ if ($cancel == $langs->trans("Cancel"))
 if ($_GET["id"])
 {
   $soc = new Societe($db);
-  $result = $soc->fetch($_GET["id"]);
+  $result = $soc->fetch($_GET["id"], $user);
 
-  if ( $result == 1 )
+  if (!$soc->perm_read)
+    {
+      print "Lecture non authoris�e";
+    }
+
+  if ( $result == 1 && $soc->perm_read)
     { 
       if ($_GET["action"] <> 'edit' && $_GET["action"] <> 're-edit')
 	{
@@ -66,6 +71,13 @@ if ($_GET["id"])
 	  $head[$h][1] = $langs->trans("Tarifs");
 	  $h++;
 
+	  if ($soc->perm_perms)
+	    {
+	      $head[$h][0] = DOL_URL_ROOT."/telephonie/client/permissions.php?id=".$soc->id;
+	      $head[$h][1] = $langs->trans("Permissions");
+	      $h++;
+	    }
+
 	  dolibarr_fiche_head($head, $hselected, 'Client : '.$soc->nom);
 
 	  print '<table class="border" cellpadding="3" cellspacing="0" width="100%">';
diff --git a/htdocs/telephonie/client/lignes.php b/htdocs/telephonie/client/lignes.php
index 8ba4bde0207..870794dd775 100644
--- a/htdocs/telephonie/client/lignes.php
+++ b/htdocs/telephonie/client/lignes.php
@@ -38,9 +38,14 @@ if ($cancel == $langs->trans("Cancel"))
 if ($_GET["id"])
 {
   $soc = new Societe($db);
-  $result = $soc->fetch($_GET["id"]);
+  $result = $soc->fetch($_GET["id"], $user);
 
-  if ( $result == 1 )
+  if (!$soc->perm_read)
+    {
+      print "Lecture non authoris�e";
+    }
+
+  if ( $result == 1 && $soc->perm_read)
     { 
       if ($_GET["action"] <> 'edit' && $_GET["action"] <> 're-edit')
 	{
-- 
GitLab