Works on enhancement of project tasks

Add rights for task
This commit is contained in:
Regis Houssin 2010-02-02 13:27:59 +00:00
parent 9ba7d422ff
commit 1afda34ad7
7 changed files with 87 additions and 48 deletions

View File

@ -3,7 +3,7 @@
* Copyright (C) 2004-2007 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2004 Sebastien Di Cintio <sdicintio@ressource-toi.org>
* Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be>
* Copyright (C) 2005-2009 Regis Houssin <regis@dolibarr.fr>
* Copyright (C) 2005-2010 Regis Houssin <regis@dolibarr.fr>
*
* 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';
}

View File

@ -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

View File

@ -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

View File

@ -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 '<tr class="liste_titre">';
print '<td>'.$langs->trans("Source").'</td>';
@ -369,7 +369,7 @@ if ($id > 0 || ! empty($ref))
// Icon update et delete
print '<td align="center" nowrap>';
if ($user->rights->projet->creer)
if ($user->rights->projet->task->creer)
{
print '&nbsp;';
print '<a href="'.$_SERVER["PHP_SELF"].'?id='.$task->id.'&amp;action=deleteline&amp;lineid='.$tab[$i]['rowid'].'">';

View File

@ -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 '<div class="tabsAction">';
if ($user->rights->projet->creer)
if ($user->rights->projet->task->creer)
{
if ($userAccess)
{

View File

@ -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 '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
@ -246,7 +246,7 @@ if ($taskid)
print '<div class="tabsAction">';
// Modify
if ($user->rights->projet->creer)
if ($user->rights->projet->task->creer)
{
print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?id='.$task->id.'&amp;action=edit">'.$langs->trans('Modify').'</a>';
}
@ -256,7 +256,7 @@ if ($taskid)
}
// Delete
if ($user->rights->projet->supprimer)
if ($user->rights->projet->task->supprimer)
{
print '<a class="butActionDelete" href="'.$_SERVER['PHP_SELF'].'?id='.$task->id.'&amp;action=delete">'.$langs->trans('Delete').'</a>';
}

View File

@ -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