Merge branch 'develop' of git@github.com:Dolibarr/dolibarr.git into develop

This commit is contained in:
Laurent Destailleur 2022-05-08 20:08:29 +02:00
commit 5d0af6d216
4 changed files with 23 additions and 11 deletions

View File

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

View File

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

View File

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

View File

@ -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 '<input type="hidden" name="action" value="updateline">';
} elseif ($action == 'splitline') {
print '<input type="hidden" name="action" value="updatesplitline">';
} elseif ($action == 'createtime' && $user->rights->projet->lire) {
} elseif ($action == 'createtime' && $user->rights->projet->time) {
print '<input type="hidden" name="action" value="addtimespent">';
} elseif ($massaction == 'generateinvoice' && $user->rights->facture->lire) {
print '<input type="hidden" name="action" value="confirm_generateinvoice">';
@ -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 '<!-- table to add time spent -->'."\n";
if (!empty($id)) {
print '<input type="hidden" name="taskid" value="'.$id.'">';
@ -1863,8 +1867,8 @@ if (($id > 0 || !empty($ref)) || $projectidforalltimes > 0 || $allprojectforuser
print '<input type="submit" class="button buttongen margintoponlyshort marginbottomonlyshort button-save" name="save" value="'.$langs->trans("Save").'">';
print '<br>';
print '<input type="submit" class="button buttongen margintoponlyshort marginbottomonlyshort button-cancel" name="cancel" value="'.$langs->trans("Cancel").'">';
} 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 '&nbsp;';
print '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?id='.$task_time->fk_task.'&action=splitline&token='.newToken().'&lineid='.$task_time->rowid.$param.((empty($id) || $tab == 'timespent') ? '&tab=timespent' : '').'">';