diff --git a/htdocs/includes/modules/modProjet.class.php b/htdocs/includes/modules/modProjet.class.php index 68410e876be..be503f71368 100644 --- a/htdocs/includes/modules/modProjet.class.php +++ b/htdocs/includes/modules/modProjet.class.php @@ -3,7 +3,7 @@ * Copyright (C) 2004-2007 Laurent Destailleur * Copyright (C) 2004 Sebastien Di Cintio * Copyright (C) 2004 Benoit Mortier - * Copyright (C) 2005-2009 Regis Houssin + * Copyright (C) 2005-2010 Regis Houssin * * 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 @@ -20,12 +20,14 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/** \defgroup projet Module projet +/** + * \defgroup projet Module projet * \brief Module pour inclure le detail par projets dans les autres modules * \version $Id$ */ -/** \file htdocs/includes/modules/modProjet.class.php +/** + * \file htdocs/includes/modules/modProjet.class.php * \ingroup projet * \brief Fichier de description et activation du module Projet */ @@ -70,18 +72,21 @@ class modProjet extends DolibarrModules // Constants $this->const = array(); + $r=0; - $this->const[0][0] = "PROJECT_ADDON_PDF"; - $this->const[0][1] = "chaine"; - $this->const[0][2] = "baleine"; - $this->const[0][3] = 'Nom du gestionnaire de generation des projets en PDF'; - $this->const[0][4] = 0; + $this->const[$r][0] = "PROJECT_ADDON_PDF"; + $this->const[$r][1] = "chaine"; + $this->const[$r][2] = "baleine"; + $this->const[$r][3] = 'Nom du gestionnaire de generation des projets en PDF'; + $this->const[$r][4] = 0; + $r++; - $this->const[1][0] = "PROJECT_ADDON"; - $this->const[1][1] = "chaine"; - $this->const[1][2] = "mod_project_universal"; - $this->const[1][3] = 'Nom du gestionnaire de numerotation des projets'; - $this->const[1][4] = 0; + $this->const[$r][0] = "PROJECT_ADDON"; + $this->const[$r][1] = "chaine"; + $this->const[$r][2] = "mod_project_universal"; + $this->const[$r][3] = 'Nom du gestionnaire de numerotation des projets'; + $this->const[$r][4] = 0; + $r++; // Boxes $this->boxes = array(); @@ -89,24 +94,52 @@ class modProjet extends DolibarrModules // Permissions $this->rights = array(); $this->rights_class = 'projet'; + $r=0; - $this->rights[1][0] = 41; // id de la permission - $this->rights[1][1] = 'Lire les projets'; // libelle de la permission - $this->rights[1][2] = 'r'; // type de la permission (deprecie a ce jour) - $this->rights[1][3] = 1; // La permission est-elle une permission par defaut - $this->rights[1][4] = 'lire'; + $r++; + $this->rights[$r][0] = 41; // id de la permission + $this->rights[$r][1] = 'Lire les projets'; // libelle de la permission + $this->rights[$r][2] = 'r'; // type de la permission (deprecie a ce jour) + $this->rights[$r][3] = 1; // La permission est-elle une permission par defaut + $this->rights[$r][4] = 'lire'; - $this->rights[2][0] = 42; // id de la permission - $this->rights[2][1] = 'Creer/modifier les projets'; // libelle de la permission - $this->rights[2][2] = 'w'; // type de la permission (deprecie a ce jour) - $this->rights[2][3] = 0; // La permission est-elle une permission par defaut - $this->rights[2][4] = 'creer'; + $r++; + $this->rights[$r][0] = 42; // id de la permission + $this->rights[$r][1] = 'Creer/modifier les projets'; // libelle de la permission + $this->rights[$r][2] = 'w'; // type de la permission (deprecie a ce jour) + $this->rights[$r][3] = 0; // La permission est-elle une permission par defaut + $this->rights[$r][4] = 'creer'; - $this->rights[3][0] = 44; // id de la permission - $this->rights[3][1] = 'Supprimer les projets'; // libelle de la permission - $this->rights[3][2] = 'd'; // type de la permission (deprecie a ce jour) - $this->rights[3][3] = 0; // La permission est-elle une permission par defaut - $this->rights[3][4] = 'supprimer'; + $r++; + $this->rights[$r][0] = 44; // id de la permission + $this->rights[$r][1] = 'Supprimer les projets'; // libelle de la permission + $this->rights[$r][2] = 'd'; // type de la permission (deprecie a ce jour) + $this->rights[$r][3] = 0; // La permission est-elle une permission par defaut + $this->rights[$r][4] = 'supprimer'; + + $r++; + $this->rights[$r][0] = 141; // id de la permission + $this->rights[$r][1] = 'Lire les taches'; // libelle de la permission + $this->rights[$r][2] = 'r'; // type de la permission (deprecie a ce jour) + $this->rights[$r][3] = 1; // La permission est-elle une permission par defaut + $this->rights[$r][4] = 'task'; + $this->rights[$r][5] = 'lire'; + + $r++; + $this->rights[$r][0] = 142; // id de la permission + $this->rights[$r][1] = 'Creer/modifier les taches'; // libelle de la permission + $this->rights[$r][2] = 'w'; // type de la permission (deprecie a ce jour) + $this->rights[$r][3] = 0; // La permission est-elle une permission par defaut + $this->rights[$r][4] = 'task'; + $this->rights[$r][5] = 'creer'; + + $r++; + $this->rights[$r][0] = 144; // id de la permission + $this->rights[$r][1] = 'Supprimer les taches'; // libelle de la permission + $this->rights[$r][2] = 'd'; // type de la permission (deprecie a ce jour) + $this->rights[$r][3] = 0; // La permission est-elle une permission par defaut + $this->rights[$r][4] = 'task'; + $this->rights[$r][5] = 'supprimer'; } diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index 7589bf2989c..88632d282be 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -394,8 +394,8 @@ Permission31=Read products Permission32=Create/modify products Permission34=Delete products Permission38=Export products -Permission41=Read projects and tasks -Permission42=Create/modify projects, edit tasks for my projects +Permission41=Read projects +Permission42=Create/modify projects Permission44=Delete projects Permission61=Read interventions Permission62=Create/modify interventions @@ -438,6 +438,9 @@ Permission121=Read third parties linked to user Permission122=Create/modify third parties linked to user Permission125=Delete third parties linked to user Permission126=Export third parties +Permission141=Read tasks +Permission142=Create/modify tasks +Permission144=Delete tasks Permission146=Read providers Permission147=Read stats Permission151=Read standing orders diff --git a/htdocs/langs/fr_FR/admin.lang b/htdocs/langs/fr_FR/admin.lang index 57fd0c52795..0c8b03d0604 100644 --- a/htdocs/langs/fr_FR/admin.lang +++ b/htdocs/langs/fr_FR/admin.lang @@ -394,8 +394,8 @@ Permission31 = Consulter les produits Permission32 = Créer/modifier les produits Permission34 = Supprimer les produits Permission38 = Exporter les produits -Permission41 = Consulter les projets et tâches -Permission42 = Créer/modifier les projets, éditer tâches de mes projets +Permission41 = Consulter les projets +Permission42 = Créer/modifier les projets Permission44 = Supprimer les projets Permission61 = Consulter les interventions Permission62 = Créer/modifier les interventions @@ -438,6 +438,9 @@ Permission121 = Consulter les tiers (sociétés) liés à l'utilisateur Permission122 = Créer/modifier les tiers (sociétés) liés à l'utilisateur Permission125 = Supprimer les tiers (sociétés) liés à l'utilisateur Permission126 = Exporter les tiers (sociétés) +Permission141 = Consulter les tâches +Permission142 = Créer/modifier les tâches +Permission144 = Supprimer les tâches Permission146 = Consulter les fournisseurs Permission147 = Consulter les stats Permission151 = Consulter les prélèvements diff --git a/htdocs/projet/tasks/contact.php b/htdocs/projet/tasks/contact.php index 27f5e46f3bd..935374ab4f2 100644 --- a/htdocs/projet/tasks/contact.php +++ b/htdocs/projet/tasks/contact.php @@ -38,7 +38,7 @@ $taskid = isset($_GET["id"])?$_GET["id"]:''; // Security check if ($user->societe_id) $socid=$user->societe_id; //$result = restrictedArea($user, 'projet', $taskid, 'projet_task'); -if (!$user->rights->projet->lire) accessforbidden(); +if (!$user->rights->projet->task->lire) accessforbidden(); /* @@ -46,7 +46,7 @@ if (!$user->rights->projet->lire) accessforbidden(); */ // Add new contact -if ($_POST["action"] == 'addcontact' && $user->rights->projet->creer) +if ($_POST["action"] == 'addcontact' && $user->rights->projet->task->creer) { $result = 0; @@ -77,7 +77,7 @@ if ($_POST["action"] == 'addcontact' && $user->rights->projet->creer) } } // modification d'un contact. On enregistre le type -if ($_POST["action"] == 'updateline' && $user->rights->projet->creer) +if ($_POST["action"] == 'updateline' && $user->rights->projet->task->creer) { $task = new Task($db); if ($task->fetch($taskid)) @@ -103,7 +103,7 @@ if ($_POST["action"] == 'updateline' && $user->rights->projet->creer) } // bascule du statut d'un contact -if ($_GET["action"] == 'swapstatut' && $user->rights->projet->creer) +if ($_GET["action"] == 'swapstatut' && $user->rights->projet->task->creer) { $task = new Task($db); if ($task->fetch($taskid)) @@ -129,7 +129,7 @@ if ($_GET["action"] == 'swapstatut' && $user->rights->projet->creer) } // Efface un contact -if ($_GET["action"] == 'deleteline' && $user->rights->projet->creer) +if ($_GET["action"] == 'deleteline' && $user->rights->projet->task->creer) { $task = new Task($db); $task->fetch($taskid); @@ -216,7 +216,7 @@ if ($id > 0 || ! empty($ref)) * Ajouter une ligne de contact * Non affiche en mode modification de ligne */ - if ($_GET["action"] != 'editline' && $user->rights->projet->creer) + if ($_GET["action"] != 'editline' && $user->rights->projet->task->creer) { print ''; print ''.$langs->trans("Source").''; @@ -369,7 +369,7 @@ if ($id > 0 || ! empty($ref)) // Icon update et delete print ''; - if ($user->rights->projet->creer) + if ($user->rights->projet->task->creer) { print ' '; print ''; diff --git a/htdocs/projet/tasks/fiche.php b/htdocs/projet/tasks/fiche.php index 28ed64ac767..d3ba9538881 100644 --- a/htdocs/projet/tasks/fiche.php +++ b/htdocs/projet/tasks/fiche.php @@ -137,7 +137,7 @@ if ($id > 0 || ! empty($ref)) } } -if ($_GET["action"] == 'create' && $user->rights->projet->creer) +if ($_GET["action"] == 'create' && $user->rights->projet->task->creer && $userAccess) { print_fiche_titre($langs->trans("NewTask")); @@ -269,7 +269,7 @@ else */ print '
'; - if ($user->rights->projet->creer) + if ($user->rights->projet->task->creer) { if ($userAccess) { diff --git a/htdocs/projet/tasks/task.php b/htdocs/projet/tasks/task.php index 2c482ac013a..cc2e741ece0 100644 --- a/htdocs/projet/tasks/task.php +++ b/htdocs/projet/tasks/task.php @@ -32,13 +32,13 @@ require_once(DOL_DOCUMENT_ROOT."/html.formother.class.php"); $taskid = (isset($_GET["id"])?$_GET["id"]:(isset($_POST["id"])?$_POST["id"]:'')); $taskref = (isset($_GET["ref"])?$_GET["ref"]:''); -if (!$user->rights->projet->lire) accessforbidden(); +if (!$user->rights->projet->task->lire) accessforbidden(); /* * Actions */ -if ($_POST["action"] == 'update' && ! $_POST["cancel"] && $user->rights->projet->creer) +if ($_POST["action"] == 'update' && ! $_POST["cancel"] && $user->rights->projet->task->creer) { $error=0; @@ -74,7 +74,7 @@ if ($_POST["action"] == 'update' && ! $_POST["cancel"] && $user->rights->projet- } } -if ($_POST["action"] == 'confirm_delete' && $_POST["confirm"] == "yes" && $user->rights->projet->creer) +if ($_POST["action"] == 'confirm_delete' && $_POST["confirm"] == "yes" && $user->rights->projet->task->creer) { $task = new Task($db); if ($task->fetch($_GET["id"]) >= 0 ) @@ -124,7 +124,7 @@ if ($taskid) dol_fiche_head($head, 'task', $langs->trans("Task"),0,'projecttask'); - if ($_GET["action"] == 'edit' && $user->rights->projet->creer) + if ($_GET["action"] == 'edit' && $user->rights->projet->task->creer) { print '
'; print ''; @@ -246,7 +246,7 @@ if ($taskid) print '
'; // Modify - if ($user->rights->projet->creer) + if ($user->rights->projet->task->creer) { print ''.$langs->trans('Modify').''; } @@ -256,7 +256,7 @@ if ($taskid) } // Delete - if ($user->rights->projet->supprimer) + if ($user->rights->projet->task->supprimer) { print ''.$langs->trans('Delete').''; } diff --git a/htdocs/projet/tasks/time.php b/htdocs/projet/tasks/time.php index fa5607989fe..038f6e66189 100644 --- a/htdocs/projet/tasks/time.php +++ b/htdocs/projet/tasks/time.php @@ -28,7 +28,7 @@ require("./pre.inc.php"); require_once(DOL_DOCUMENT_ROOT."/lib/project.lib.php"); -if (!$user->rights->projet->lire) accessforbidden(); +if (!$user->rights->projet->task->lire) accessforbidden(); /* * Actions