Works on enhancement of project tasks
Add rights for task
This commit is contained in:
parent
9ba7d422ff
commit
1afda34ad7
@ -3,7 +3,7 @@
|
|||||||
* Copyright (C) 2004-2007 Laurent Destailleur <eldy@users.sourceforge.net>
|
* Copyright (C) 2004-2007 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
* Copyright (C) 2004 Sebastien Di Cintio <sdicintio@ressource-toi.org>
|
* Copyright (C) 2004 Sebastien Di Cintio <sdicintio@ressource-toi.org>
|
||||||
* Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be>
|
* 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
|
* 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
|
* 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.
|
* 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
|
* \brief Module pour inclure le detail par projets dans les autres modules
|
||||||
* \version $Id$
|
* \version $Id$
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/** \file htdocs/includes/modules/modProjet.class.php
|
/**
|
||||||
|
* \file htdocs/includes/modules/modProjet.class.php
|
||||||
* \ingroup projet
|
* \ingroup projet
|
||||||
* \brief Fichier de description et activation du module Projet
|
* \brief Fichier de description et activation du module Projet
|
||||||
*/
|
*/
|
||||||
@ -70,18 +72,21 @@ class modProjet extends DolibarrModules
|
|||||||
|
|
||||||
// Constants
|
// Constants
|
||||||
$this->const = array();
|
$this->const = array();
|
||||||
|
$r=0;
|
||||||
|
|
||||||
$this->const[0][0] = "PROJECT_ADDON_PDF";
|
$this->const[$r][0] = "PROJECT_ADDON_PDF";
|
||||||
$this->const[0][1] = "chaine";
|
$this->const[$r][1] = "chaine";
|
||||||
$this->const[0][2] = "baleine";
|
$this->const[$r][2] = "baleine";
|
||||||
$this->const[0][3] = 'Nom du gestionnaire de generation des projets en PDF';
|
$this->const[$r][3] = 'Nom du gestionnaire de generation des projets en PDF';
|
||||||
$this->const[0][4] = 0;
|
$this->const[$r][4] = 0;
|
||||||
|
$r++;
|
||||||
|
|
||||||
$this->const[1][0] = "PROJECT_ADDON";
|
$this->const[$r][0] = "PROJECT_ADDON";
|
||||||
$this->const[1][1] = "chaine";
|
$this->const[$r][1] = "chaine";
|
||||||
$this->const[1][2] = "mod_project_universal";
|
$this->const[$r][2] = "mod_project_universal";
|
||||||
$this->const[1][3] = 'Nom du gestionnaire de numerotation des projets';
|
$this->const[$r][3] = 'Nom du gestionnaire de numerotation des projets';
|
||||||
$this->const[1][4] = 0;
|
$this->const[$r][4] = 0;
|
||||||
|
$r++;
|
||||||
|
|
||||||
// Boxes
|
// Boxes
|
||||||
$this->boxes = array();
|
$this->boxes = array();
|
||||||
@ -89,24 +94,52 @@ class modProjet extends DolibarrModules
|
|||||||
// Permissions
|
// Permissions
|
||||||
$this->rights = array();
|
$this->rights = array();
|
||||||
$this->rights_class = 'projet';
|
$this->rights_class = 'projet';
|
||||||
|
$r=0;
|
||||||
|
|
||||||
$this->rights[1][0] = 41; // id de la permission
|
$r++;
|
||||||
$this->rights[1][1] = 'Lire les projets'; // libelle de la permission
|
$this->rights[$r][0] = 41; // id de la permission
|
||||||
$this->rights[1][2] = 'r'; // type de la permission (deprecie a ce jour)
|
$this->rights[$r][1] = 'Lire les projets'; // libelle de la permission
|
||||||
$this->rights[1][3] = 1; // La permission est-elle une permission par defaut
|
$this->rights[$r][2] = 'r'; // type de la permission (deprecie a ce jour)
|
||||||
$this->rights[1][4] = 'lire';
|
$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
|
$r++;
|
||||||
$this->rights[2][1] = 'Creer/modifier les projets'; // libelle de la permission
|
$this->rights[$r][0] = 42; // id de la permission
|
||||||
$this->rights[2][2] = 'w'; // type de la permission (deprecie a ce jour)
|
$this->rights[$r][1] = 'Creer/modifier les projets'; // libelle de la permission
|
||||||
$this->rights[2][3] = 0; // La permission est-elle une permission par defaut
|
$this->rights[$r][2] = 'w'; // type de la permission (deprecie a ce jour)
|
||||||
$this->rights[2][4] = 'creer';
|
$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
|
$r++;
|
||||||
$this->rights[3][1] = 'Supprimer les projets'; // libelle de la permission
|
$this->rights[$r][0] = 44; // id de la permission
|
||||||
$this->rights[3][2] = 'd'; // type de la permission (deprecie a ce jour)
|
$this->rights[$r][1] = 'Supprimer les projets'; // libelle de la permission
|
||||||
$this->rights[3][3] = 0; // La permission est-elle une permission par defaut
|
$this->rights[$r][2] = 'd'; // type de la permission (deprecie a ce jour)
|
||||||
$this->rights[3][4] = 'supprimer';
|
$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';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -394,8 +394,8 @@ Permission31=Read products
|
|||||||
Permission32=Create/modify products
|
Permission32=Create/modify products
|
||||||
Permission34=Delete products
|
Permission34=Delete products
|
||||||
Permission38=Export products
|
Permission38=Export products
|
||||||
Permission41=Read projects and tasks
|
Permission41=Read projects
|
||||||
Permission42=Create/modify projects, edit tasks for my projects
|
Permission42=Create/modify projects
|
||||||
Permission44=Delete projects
|
Permission44=Delete projects
|
||||||
Permission61=Read interventions
|
Permission61=Read interventions
|
||||||
Permission62=Create/modify interventions
|
Permission62=Create/modify interventions
|
||||||
@ -438,6 +438,9 @@ Permission121=Read third parties linked to user
|
|||||||
Permission122=Create/modify third parties linked to user
|
Permission122=Create/modify third parties linked to user
|
||||||
Permission125=Delete third parties linked to user
|
Permission125=Delete third parties linked to user
|
||||||
Permission126=Export third parties
|
Permission126=Export third parties
|
||||||
|
Permission141=Read tasks
|
||||||
|
Permission142=Create/modify tasks
|
||||||
|
Permission144=Delete tasks
|
||||||
Permission146=Read providers
|
Permission146=Read providers
|
||||||
Permission147=Read stats
|
Permission147=Read stats
|
||||||
Permission151=Read standing orders
|
Permission151=Read standing orders
|
||||||
|
|||||||
@ -394,8 +394,8 @@ Permission31 = Consulter les produits
|
|||||||
Permission32 = Créer/modifier les produits
|
Permission32 = Créer/modifier les produits
|
||||||
Permission34 = Supprimer les produits
|
Permission34 = Supprimer les produits
|
||||||
Permission38 = Exporter les produits
|
Permission38 = Exporter les produits
|
||||||
Permission41 = Consulter les projets et tâches
|
Permission41 = Consulter les projets
|
||||||
Permission42 = Créer/modifier les projets, éditer tâches de mes projets
|
Permission42 = Créer/modifier les projets
|
||||||
Permission44 = Supprimer les projets
|
Permission44 = Supprimer les projets
|
||||||
Permission61 = Consulter les interventions
|
Permission61 = Consulter les interventions
|
||||||
Permission62 = Créer/modifier 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
|
Permission122 = Créer/modifier les tiers (sociétés) liés à l'utilisateur
|
||||||
Permission125 = Supprimer 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)
|
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
|
Permission146 = Consulter les fournisseurs
|
||||||
Permission147 = Consulter les stats
|
Permission147 = Consulter les stats
|
||||||
Permission151 = Consulter les prélèvements
|
Permission151 = Consulter les prélèvements
|
||||||
|
|||||||
@ -38,7 +38,7 @@ $taskid = isset($_GET["id"])?$_GET["id"]:'';
|
|||||||
// Security check
|
// Security check
|
||||||
if ($user->societe_id) $socid=$user->societe_id;
|
if ($user->societe_id) $socid=$user->societe_id;
|
||||||
//$result = restrictedArea($user, 'projet', $taskid, 'projet_task');
|
//$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
|
// Add new contact
|
||||||
if ($_POST["action"] == 'addcontact' && $user->rights->projet->creer)
|
if ($_POST["action"] == 'addcontact' && $user->rights->projet->task->creer)
|
||||||
{
|
{
|
||||||
|
|
||||||
$result = 0;
|
$result = 0;
|
||||||
@ -77,7 +77,7 @@ if ($_POST["action"] == 'addcontact' && $user->rights->projet->creer)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
// modification d'un contact. On enregistre le type
|
// 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);
|
$task = new Task($db);
|
||||||
if ($task->fetch($taskid))
|
if ($task->fetch($taskid))
|
||||||
@ -103,7 +103,7 @@ if ($_POST["action"] == 'updateline' && $user->rights->projet->creer)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// bascule du statut d'un contact
|
// 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);
|
$task = new Task($db);
|
||||||
if ($task->fetch($taskid))
|
if ($task->fetch($taskid))
|
||||||
@ -129,7 +129,7 @@ if ($_GET["action"] == 'swapstatut' && $user->rights->projet->creer)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Efface un contact
|
// 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 = new Task($db);
|
||||||
$task->fetch($taskid);
|
$task->fetch($taskid);
|
||||||
@ -216,7 +216,7 @@ if ($id > 0 || ! empty($ref))
|
|||||||
* Ajouter une ligne de contact
|
* Ajouter une ligne de contact
|
||||||
* Non affiche en mode modification de ligne
|
* 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 '<tr class="liste_titre">';
|
||||||
print '<td>'.$langs->trans("Source").'</td>';
|
print '<td>'.$langs->trans("Source").'</td>';
|
||||||
@ -369,7 +369,7 @@ if ($id > 0 || ! empty($ref))
|
|||||||
|
|
||||||
// Icon update et delete
|
// Icon update et delete
|
||||||
print '<td align="center" nowrap>';
|
print '<td align="center" nowrap>';
|
||||||
if ($user->rights->projet->creer)
|
if ($user->rights->projet->task->creer)
|
||||||
{
|
{
|
||||||
print ' ';
|
print ' ';
|
||||||
print '<a href="'.$_SERVER["PHP_SELF"].'?id='.$task->id.'&action=deleteline&lineid='.$tab[$i]['rowid'].'">';
|
print '<a href="'.$_SERVER["PHP_SELF"].'?id='.$task->id.'&action=deleteline&lineid='.$tab[$i]['rowid'].'">';
|
||||||
|
|||||||
@ -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"));
|
print_fiche_titre($langs->trans("NewTask"));
|
||||||
|
|
||||||
@ -269,7 +269,7 @@ else
|
|||||||
*/
|
*/
|
||||||
print '<div class="tabsAction">';
|
print '<div class="tabsAction">';
|
||||||
|
|
||||||
if ($user->rights->projet->creer)
|
if ($user->rights->projet->task->creer)
|
||||||
{
|
{
|
||||||
if ($userAccess)
|
if ($userAccess)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -32,13 +32,13 @@ require_once(DOL_DOCUMENT_ROOT."/html.formother.class.php");
|
|||||||
$taskid = (isset($_GET["id"])?$_GET["id"]:(isset($_POST["id"])?$_POST["id"]:''));
|
$taskid = (isset($_GET["id"])?$_GET["id"]:(isset($_POST["id"])?$_POST["id"]:''));
|
||||||
$taskref = (isset($_GET["ref"])?$_GET["ref"]:'');
|
$taskref = (isset($_GET["ref"])?$_GET["ref"]:'');
|
||||||
|
|
||||||
if (!$user->rights->projet->lire) accessforbidden();
|
if (!$user->rights->projet->task->lire) accessforbidden();
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Actions
|
* Actions
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if ($_POST["action"] == 'update' && ! $_POST["cancel"] && $user->rights->projet->creer)
|
if ($_POST["action"] == 'update' && ! $_POST["cancel"] && $user->rights->projet->task->creer)
|
||||||
{
|
{
|
||||||
$error=0;
|
$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);
|
$task = new Task($db);
|
||||||
if ($task->fetch($_GET["id"]) >= 0 )
|
if ($task->fetch($_GET["id"]) >= 0 )
|
||||||
@ -124,7 +124,7 @@ if ($taskid)
|
|||||||
|
|
||||||
dol_fiche_head($head, 'task', $langs->trans("Task"),0,'projecttask');
|
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 '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">';
|
||||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||||
@ -246,7 +246,7 @@ if ($taskid)
|
|||||||
print '<div class="tabsAction">';
|
print '<div class="tabsAction">';
|
||||||
|
|
||||||
// Modify
|
// Modify
|
||||||
if ($user->rights->projet->creer)
|
if ($user->rights->projet->task->creer)
|
||||||
{
|
{
|
||||||
print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?id='.$task->id.'&action=edit">'.$langs->trans('Modify').'</a>';
|
print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?id='.$task->id.'&action=edit">'.$langs->trans('Modify').'</a>';
|
||||||
}
|
}
|
||||||
@ -256,7 +256,7 @@ if ($taskid)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Delete
|
// Delete
|
||||||
if ($user->rights->projet->supprimer)
|
if ($user->rights->projet->task->supprimer)
|
||||||
{
|
{
|
||||||
print '<a class="butActionDelete" href="'.$_SERVER['PHP_SELF'].'?id='.$task->id.'&action=delete">'.$langs->trans('Delete').'</a>';
|
print '<a class="butActionDelete" href="'.$_SERVER['PHP_SELF'].'?id='.$task->id.'&action=delete">'.$langs->trans('Delete').'</a>';
|
||||||
}
|
}
|
||||||
|
|||||||
@ -28,7 +28,7 @@
|
|||||||
require("./pre.inc.php");
|
require("./pre.inc.php");
|
||||||
require_once(DOL_DOCUMENT_ROOT."/lib/project.lib.php");
|
require_once(DOL_DOCUMENT_ROOT."/lib/project.lib.php");
|
||||||
|
|
||||||
if (!$user->rights->projet->lire) accessforbidden();
|
if (!$user->rights->projet->task->lire) accessforbidden();
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Actions
|
* Actions
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user