From afb8e5eb4dac195498fc663fa718b9edde592fb4 Mon Sep 17 00:00:00 2001
From: Laurent Destailleur <eldy@users.sourceforge.net>
Date: Sat, 25 Dec 2004 19:18:49 +0000
Subject: [PATCH] Fix: Pb de droits sur le dossier clients.

---
 htdocs/dossier/client/fiche.php   |  5 ++++-
 htdocs/dossier/client/pre.inc.php | 22 ++++++++++++----------
 2 files changed, 16 insertions(+), 11 deletions(-)

diff --git a/htdocs/dossier/client/fiche.php b/htdocs/dossier/client/fiche.php
index 0163efd6a20..b5be6fad13b 100644
--- a/htdocs/dossier/client/fiche.php
+++ b/htdocs/dossier/client/fiche.php
@@ -1,5 +1,6 @@
 <?PHP
 /* Copyright (C) 2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
+ * Copyright (C) 2004 Laurent Destailleur  <eldy@users.sourceforge.net>
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -22,10 +23,12 @@
 require("./pre.inc.php");
 require_once DOL_DOCUMENT_ROOT.'/client.class.php';
 
+$user->getrights("facture");
 
-if (!$user->rights->telephonie->lire)
+if (!$user->rights->facture->lire)
   accessforbidden();
 
+
 $facs = array();
 $client = new client($db, $_GET["id"]);
 $client->fetch($_GET["id"]);
diff --git a/htdocs/dossier/client/pre.inc.php b/htdocs/dossier/client/pre.inc.php
index baefcbae39d..22983d34ae1 100644
--- a/htdocs/dossier/client/pre.inc.php
+++ b/htdocs/dossier/client/pre.inc.php
@@ -20,11 +20,12 @@
  *
  */
 require("../../main.inc.php");
-require(DOL_DOCUMENT_ROOT."/telephonie/lignetel.class.php");
-$user->getrights('telephonie');
 
-function llxHeader($head = "", $title="", $soc) {
-  global $user, $conf;
+
+function llxHeader($head = "", $title="", $soc="") {
+  global $user, $conf, $langs;
+  $langs->load("bills");
+  
   /*
    *
    *
@@ -35,13 +36,14 @@ function llxHeader($head = "", $title="", $soc) {
 
   $menu->add(DOL_URL_ROOT."/comm/fiche.php?socid=".$soc->id, $soc->nom);
 
-  $menu->add(DOL_URL_ROOT."/dossier/client/fiche.php?id=".$soc->id, "Factures");
-
-  foreach($soc->factures as $key=>$value)
-    {
-      $menu->add_submenu(DOL_URL_ROOT."/dossier/client/fiche.php?id=".$soc->id."&amp;facid=".$value[0], $value[1]);
-    }
+  $menu->add(DOL_URL_ROOT."/dossier/client/fiche.php?id=".$soc->id, $langs->trans("Bills"));
 
+  if ($soc) {
+      foreach($soc->factures as $key=>$value)
+        {
+          $menu->add_submenu(DOL_URL_ROOT."/dossier/client/fiche.php?id=".$soc->id."&amp;facid=".$value[0], $value[1]);
+        }
+  }
 
   left_menu($menu->liste);
 }
-- 
GitLab