Skip to content

Commit

Permalink
Add check to template use
Browse files Browse the repository at this point in the history
- 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.
  • Loading branch information
dmtrek14 authored and anarute committed Dec 11, 2023
1 parent 231534b commit c5d0981
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion web/js/tasks.js
Original file line number Diff line number Diff line change
Expand Up @@ -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']);
Expand Down

0 comments on commit c5d0981

Please sign in to comment.