From c5d098100b390533e65abf5a24f591b64f5b87f4 Mon Sep 17 00:00:00 2001 From: Danielle Mayabb Date: Fri, 8 Dec 2023 11:31:23 -0800 Subject: [PATCH] Add check to template use - When a user chooses a template, check the task type of template against the store. If not in store, alert user and do not fill value. --- web/js/tasks.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/web/js/tasks.js b/web/js/tasks.js index 016c0d5d3..19a3c27af 100644 --- a/web/js/tasks.js +++ b/web/js/tasks.js @@ -1352,7 +1352,12 @@ Ext.onReady(function(){ // Create and populate a record var newTask = new taskRecord(); newTask.set('projectId', templateValues['projectId']); - newTask.set('ttype', templateValues['ttype']); + if(templateValues && !taskTypeStore.data.items.includes(x => x.id == templateValues['ttype'])){ + let message = `Task type of ${templateValues['ttype']} is not valid. The task type may have been deactivated. Please choose another task type.` + App.setAlert(false, message); + } else { + newTask.set('ttype', templateValues['ttype']); + } newTask.set('story', templateValues['story']); newTask.set('text', templateValues['text']); newTask.set('initTime', templateValues['initTime']);