From f275145bd2481b0e93c53e0a0243e13999eff775 Mon Sep 17 00:00:00 2001
From: Laurent Destailleur <eldy@destailleur.fr>
Date: Sun, 10 May 2015 23:37:04 +0200
Subject: [PATCH] FIX We did a test on a permission to export contract when
 permission did not exists.

---
 htdocs/core/modules/modContrat.class.php | 76 ++++++++++++++----------
 1 file changed, 45 insertions(+), 31 deletions(-)

diff --git a/htdocs/core/modules/modContrat.class.php b/htdocs/core/modules/modContrat.class.php
index 6e1b6b351ae..636dda7d99f 100644
--- a/htdocs/core/modules/modContrat.class.php
+++ b/htdocs/core/modules/modContrat.class.php
@@ -85,37 +85,51 @@ class modContrat extends DolibarrModules
 		// Permissions
 		$this->rights = array();
 		$this->rights_class = 'contrat';
-
-		$this->rights[1][0] = 161;
-		$this->rights[1][1] = 'Lire les contrats';
-		$this->rights[1][2] = 'r';
-		$this->rights[1][3] = 1;
-		$this->rights[1][4] = 'lire';
-
-		$this->rights[2][0] = 162;
-		$this->rights[2][1] = 'Creer / modifier les contrats';
-		$this->rights[2][2] = 'w';
-		$this->rights[2][3] = 0;
-		$this->rights[2][4] = 'creer';
-
-		$this->rights[3][0] = 163;
-		$this->rights[3][1] = 'Activer un service d\'un contrat';
-		$this->rights[3][2] = 'w';
-		$this->rights[3][3] = 0;
-		$this->rights[3][4] = 'activer';
-
-		$this->rights[4][0] = 164;
-		$this->rights[4][1] = 'Desactiver un service d\'un contrat';
-		$this->rights[4][2] = 'w';
-		$this->rights[4][3] = 0;
-		$this->rights[4][4] = 'desactiver';
-
-		$this->rights[5][0] = 165;
-		$this->rights[5][1] = 'Supprimer un contrat';
-		$this->rights[5][2] = 'd';
-		$this->rights[5][3] = 0;
-		$this->rights[5][4] = 'supprimer';
-
+		$r=0;
+		
+		$r++;
+		$this->rights[$r][0] = 161;
+		$this->rights[$r][1] = 'Lire les contrats';
+		$this->rights[$r][2] = 'r';
+		$this->rights[$r][3] = 1;
+		$this->rights[$r][4] = 'lire';
+
+		$r++;
+		$this->rights[$r][0] = 162;
+		$this->rights[$r][1] = 'Creer / modifier les contrats';
+		$this->rights[$r][2] = 'w';
+		$this->rights[$r][3] = 0;
+		$this->rights[$r][4] = 'creer';
+
+		$r++;
+		$this->rights[$r][0] = 163;
+		$this->rights[$r][1] = 'Activer un service d\'un contrat';
+		$this->rights[$r][2] = 'w';
+		$this->rights[$r][3] = 0;
+		$this->rights[$r][4] = 'activer';
+
+		$r++;
+		$this->rights[$r][0] = 164;
+		$this->rights[$r][1] = 'Desactiver un service d\'un contrat';
+		$this->rights[$r][2] = 'w';
+		$this->rights[$r][3] = 0;
+		$this->rights[$r][4] = 'desactiver';
+
+		$r++;
+		$this->rights[$r][0] = 165;
+		$this->rights[$r][1] = 'Supprimer un contrat';
+		$this->rights[$r][2] = 'd';
+		$this->rights[$r][3] = 0;
+		$this->rights[$r][4] = 'supprimer';
+
+		$r++;
+		$this->rights[$r][0] = 167;
+		$this->rights[$r][1] = 'Export contracts';
+		$this->rights[$r][2] = 'r';
+		$this->rights[$r][3] = 0;
+		$this->rights[$r][4] = 'export';
+
+		
 		// Exports
 		//--------
 
-- 
GitLab