diff --git a/htdocs/core/modules/modProjet.class.php b/htdocs/core/modules/modProjet.class.php
index f18a55ff6d8..f8b82e8faa3 100644
--- a/htdocs/core/modules/modProjet.class.php
+++ b/htdocs/core/modules/modProjet.class.php
@@ -152,7 +152,7 @@ class modProjet extends DolibarrModules
$r++;
$this->rights[$r][0] = 41; // id de la permission
- $this->rights[$r][1] = "Read projects and tasks (shared projects or projects I am contact for). Can also enter time consumed on assigned tasks (timesheet)"; // libelle de la permission
+ $this->rights[$r][1] = "Read projects and tasks (shared projects or projects I am contact for)"; // libelle de la permission
$this->rights[$r][2] = 'r'; // 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] = 'lire';
@@ -188,7 +188,7 @@ class modProjet extends DolibarrModules
$r++;
$this->rights[$r][0] = 142; // id de la permission
- $this->rights[$r][1] = "Create/modify all projects and tasks (also private projects I am not contact for). Can also enter time consumed on assigned tasks (timesheet)"; // libelle de la permission
+ $this->rights[$r][1] = "Create/modify all projects and tasks (also private projects I am not contact for)"; // 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] = 'all';
@@ -202,6 +202,12 @@ class modProjet extends DolibarrModules
$this->rights[$r][4] = 'all';
$this->rights[$r][5] = 'supprimer';
+ $r++;
+ $this->rights[$r][0] = 145; // id de la permission
+ $this->rights[$r][1] = "Can enter time consumed on assigned tasks (timesheet)"; // 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] = 'time';
// Menus
//-------
diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang
index 69dfc6bd478..4b60b70f7ad 100644
--- a/htdocs/langs/en_US/admin.lang
+++ b/htdocs/langs/en_US/admin.lang
@@ -718,7 +718,8 @@ Permission34=Delete products
Permission36=See/manage hidden products
Permission38=Export products
Permission39=Ignore minimum price
-Permission41=Read projects and tasks (shared project and projects I'm contact for). Can also enter time consumed, for me or my hierarchy, on assigned tasks (Timesheet)
+Permission41=Read projects and tasks (shared project and projects I'm contact for).
+Permission145=Can enter time consumed, for me or my hierarchy, on assigned tasks (Timesheet)
Permission42=Create/modify projects (shared project and projects I'm contact for). Can also create tasks and assign users to project and tasks
Permission44=Delete projects (shared project and projects I'm contact for)
Permission45=Export projects
diff --git a/htdocs/langs/fr_FR/admin.lang b/htdocs/langs/fr_FR/admin.lang
index 034f105f6d8..8aa317ca305 100644
--- a/htdocs/langs/fr_FR/admin.lang
+++ b/htdocs/langs/fr_FR/admin.lang
@@ -718,7 +718,8 @@ Permission34=Supprimer les produits
Permission36=Voir/gérer les produits cachés
Permission38=Exporter les produits
Permission39=Ignorer le prix minimum
-Permission41=Lire les projets et tâches (partagés ou dont vous n'êtes pas contact). Permet la saisie de temps passé, pour vous-même et votre hiérarchie (vos subordonnés), sur les tâches assignées (Feuilles de temps).
+Permission41=Lire les projets et tâches (partagés ou dont vous n'êtes pas contact).
+Permission145=Permet la saisie de temps passé, pour vous-même et votre hiérarchie (vos subordonnés), sur les tâches assignées (Feuilles de temps).
Permission42=Créer/modifier les projets (projets partagés et projets pour lesquels je suis contact). Permet aussi de créer des tâches et d'assigner des utilisateurs aux projets et tâches.
Permission44=Supprimer les projets et tâches (partagés ou dont je suis contact)
Permission45=Exporter les projets
diff --git a/htdocs/projet/tasks/time.php b/htdocs/projet/tasks/time.php
index aab0fb8dbcf..53d0e6c7f91 100644
--- a/htdocs/projet/tasks/time.php
+++ b/htdocs/projet/tasks/time.php
@@ -169,7 +169,7 @@ if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x'
$action = '';
}
-if ($action == 'addtimespent' && $user->rights->projet->lire) {
+if ($action == 'addtimespent' && $user->rights->projet->time) {
$error = 0;
$timespent_durationhour = GETPOST('timespent_durationhour', 'int');
@@ -313,7 +313,7 @@ if (($action == 'updateline' || $action == 'updatesplitline') && !$cancel && $us
}
}
-if ($action == 'confirm_deleteline' && $confirm == "yes" && $user->rights->projet->lire) {
+if ($action == 'confirm_deleteline' && $confirm == "yes" && $user->rights->projet->supprimer) {
$object->fetchTimeSpent(GETPOST('lineid', 'int')); // load properties like $object->timespent_id
if (in_array($object->timespent_fk_user, $childids) || $user->rights->projet->all->creer) {
@@ -888,7 +888,7 @@ if (($id > 0 || !empty($ref)) || $projectidforalltimes > 0 || $allprojectforuser
$linktocreatetimeBtnStatus = 0;
$linktocreatetimeUrl = '';
$linktocreatetimeHelpText = '';
- if ($user->rights->projet->all->lire || $user->rights->projet->lire) { // To enter time, read permission is enough
+ if ($user->rights->projet->all->lire || $user->rights->projet->time) {
if ($projectstatic->public || $userRead > 0) {
$linktocreatetimeBtnStatus = 1;
@@ -1032,6 +1032,10 @@ if (($id > 0 || !empty($ref)) || $projectidforalltimes > 0 || $allprojectforuser
if ($projectstatic->id > 0 || $allprojectforuser > 0) {
+ if ($action == 'deleteline' && !empty($projectidforalltimes)) {
+ print $form->formconfirm($_SERVER["PHP_SELF"]."?".($object->id > 0 ? "id=".$object->id : 'projectid='.$projectstatic->id).'&lineid='.GETPOST('lineid', 'int').($withproject ? '&withproject=1' : ''), $langs->trans("DeleteATimeSpent"), $langs->trans("ConfirmDeleteATimeSpent"), "confirm_deleteline", '', '', 1);
+ }
+
// Initialize technical object to manage hooks. Note that conf->hooks_modules contains array
$hookmanager->initHooks(array('tasktimelist'));
@@ -1129,7 +1133,7 @@ if (($id > 0 || !empty($ref)) || $projectidforalltimes > 0 || $allprojectforuser
print '';
} elseif ($action == 'splitline') {
print '';
- } elseif ($action == 'createtime' && $user->rights->projet->lire) {
+ } elseif ($action == 'createtime' && $user->rights->projet->time) {
print '';
} elseif ($massaction == 'generateinvoice' && $user->rights->facture->lire) {
print '';
@@ -1403,7 +1407,7 @@ if (($id > 0 || !empty($ref)) || $projectidforalltimes > 0 || $allprojectforuser
/*
* Form to add a new line of time spent
*/
- if ($action == 'createtime' && $user->rights->projet->lire) {
+ if ($action == 'createtime' && $user->rights->projet->time) {
print ''."\n";
if (!empty($id)) {
print '';
@@ -1863,8 +1867,8 @@ if (($id > 0 || !empty($ref)) || $projectidforalltimes > 0 || $allprojectforuser
print '';
print ' ';
print '';
- } elseif ($user->rights->projet->lire || $user->rights->projet->all->creer) { // Read project and enter time consumed on assigned tasks
- if (in_array($task_time->fk_user, $childids) || $user->rights->projet->all->creer) {
+ } elseif ($user->rights->projet->time || $user->rights->projet->all->creer) { // Read project and enter time consumed on assigned tasks
+ if ($task_time->fk_user == $user->id || in_array($task_time->fk_user, $childids) || $user->rights->projet->all->creer) {
if ($conf->MAIN_FEATURES_LEVEL >= 2) {
print ' ';
print 'fk_task.'&action=splitline&token='.newToken().'&lineid='.$task_time->rowid.$param.((empty($id) || $tab == 'timespent') ? '&tab=timespent' : '').'">';