From b41ffae609fa6a9f8327734f134243ad94e10f89 Mon Sep 17 00:00:00 2001 From: tianshujie Date: Wed, 31 May 2023 13:55:33 +0800 Subject: [PATCH] + Add restrictions to the assignedTo and hours fields on the batch edit task page. --- module/task/js/batchedit.ui.js | 18 +++++++++++++++--- module/task/ui/batchedit.html.php | 1 + 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/module/task/js/batchedit.ui.js b/module/task/js/batchedit.ui.js index c07a3aafc3..49f7cbaf1b 100644 --- a/module/task/js/batchedit.ui.js +++ b/module/task/js/batchedit.ui.js @@ -14,7 +14,7 @@ window.renderRowData = function($row, index, row) teamAccounts = teams[row.id]; $.each(teamAccounts, function(index, teamAccount) { - taskMembers[teamAccount] = users[teamAccount]; + taskMembers[teamAccount.account] = users[teamAccount.account]; }); } else @@ -23,11 +23,23 @@ window.renderRowData = function($row, index, row) taskMembers = members; } - if(row.assignedTo && taskMembers[row.assignedTo] == undefined) taskMembers[row.assignedTo] = users[row.assignedTo]; let $assignedTo = $row.find('.form-batch-input[data-name="assignedTo"]').empty(); + if(teams[row.id] != undefined && ((row.assignedTo != currentUser && row.mode == 'linear') || taskMembers[currentUser] == undefined)) + { + $assignedTo.attr('disabled', 'disabled'); + } + + if(row.assignedTo && taskMembers[row.assignedTo] == undefined) taskMembers[row.assignedTo] = users[row.assignedTo]; $assignedTo.append(''); for(let account in taskMembers) { - $assignedTo.append(''); + $assignedTo.append(''); + } + + if(teams[row.id] != undefined || row.parent < 0) + { + $row.find('.form-batch-input[data-name="estimate"]').attr('disabled', 'disabled'); + $row.find('.form-batch-input[data-name="consumed"]').attr('disabled', 'disabled'); + $row.find('.form-batch-input[data-name="left"]').attr('disabled', 'disabled'); } } diff --git a/module/task/ui/batchedit.html.php b/module/task/ui/batchedit.html.php index 6ba0533ed4..f4a00484e2 100644 --- a/module/task/ui/batchedit.html.php +++ b/module/task/ui/batchedit.html.php @@ -15,6 +15,7 @@ namespace zin; jsVar('executionTeams', $executionTeams); jsVar('users', $users); jsVar('teams', $teams); +jsVar('currentUser', $app->user->account); /* ====== Define the page structure with zin widgets ====== */ formBatchPanel