[69] | 1 | import org.codehaus.groovy.grails.plugins.springsecurity.Secured |
---|
[165] | 2 | import org.codehaus.groovy.grails.commons.ConfigurationHolder |
---|
[209] | 3 | import com.zeddware.grails.plugins.filterpane.FilterUtils |
---|
[476] | 4 | import org.springframework.web.servlet.support.RequestContextUtils as RCU |
---|
[69] | 5 | |
---|
[298] | 6 | @Secured(['ROLE_AppAdmin', 'ROLE_Manager', 'ROLE_TaskManager']) |
---|
[85] | 7 | class TaskDetailedController extends BaseController { |
---|
[66] | 8 | |
---|
[291] | 9 | def authService |
---|
[180] | 10 | def taskService |
---|
[143] | 11 | def taskSearchService |
---|
[585] | 12 | def taskReportService |
---|
[140] | 13 | def filterService |
---|
[165] | 14 | def exportService |
---|
[214] | 15 | def dateUtilService |
---|
[139] | 16 | |
---|
[181] | 17 | // these actions only accept POST requests |
---|
[418] | 18 | static allowedMethods = [save:'POST',update:'POST',restore:'POST', trash:'POST', |
---|
| 19 | approve:'POST', renegeApproval:'POST', complete:'POST', |
---|
| 20 | reopen:'POST', setAttentionFlag:'POST', clearAttentionFlag:'POST'] |
---|
[66] | 21 | |
---|
[298] | 22 | @Secured(['ROLE_AppAdmin', 'ROLE_Manager', 'ROLE_TaskManager', 'ROLE_TaskUser']) |
---|
[196] | 23 | def index = { redirect(action: 'search', params: params) } |
---|
[140] | 24 | |
---|
[298] | 25 | @Secured(['ROLE_AppAdmin', 'ROLE_Manager', 'ROLE_TaskManager', 'ROLE_TaskUser']) |
---|
[326] | 26 | def setSearchParamsMax = { |
---|
[262] | 27 | def max = 1000 |
---|
| 28 | if(params.newMax.isInteger()) { |
---|
[260] | 29 | def i = params.newMax.toInteger() |
---|
[262] | 30 | if(i > 0 && i <= max) |
---|
| 31 | session.taskSearchParamsMax = params.newMax |
---|
| 32 | if(i > max) |
---|
| 33 | session.taskSearchParamsMax = max |
---|
| 34 | } |
---|
[260] | 35 | forward(action: 'search', params: params) |
---|
| 36 | } |
---|
| 37 | |
---|
[298] | 38 | @Secured(['ROLE_AppAdmin', 'ROLE_Manager', 'ROLE_TaskManager', 'ROLE_TaskUser']) |
---|
[476] | 39 | def setSearchCalendarParamsMax = { |
---|
| 40 | def max = 1000 |
---|
| 41 | if(params.newMax.isInteger()) { |
---|
| 42 | def i = params.newMax.toInteger() |
---|
| 43 | if(i > 0 && i <= max) |
---|
| 44 | session.taskSearchCalendarParamsMax = params.newMax |
---|
| 45 | if(i > max) |
---|
| 46 | session.taskSearchCalendarParamsMax = max |
---|
| 47 | } |
---|
| 48 | forward(action: 'searchCalendar', params: params) |
---|
| 49 | } |
---|
| 50 | |
---|
[483] | 51 | /** |
---|
| 52 | * Search for tasks. |
---|
| 53 | */ |
---|
[476] | 54 | @Secured(['ROLE_AppAdmin', 'ROLE_Manager', 'ROLE_TaskManager', 'ROLE_TaskUser']) |
---|
[139] | 55 | def search = { |
---|
[143] | 56 | |
---|
[260] | 57 | if(session.taskSearchParamsMax) |
---|
| 58 | params.max = session.taskSearchParamsMax |
---|
| 59 | |
---|
[468] | 60 | // Protect filterPane. |
---|
[525] | 61 | params.max = Math.min( params.max ? params.max.toInteger() : 100, 1000 ) |
---|
[260] | 62 | |
---|
| 63 | def taskInstanceList = [] |
---|
| 64 | def taskInstanceTotal |
---|
[476] | 65 | def filterParams = com.zeddware.grails.plugins.filterpane.FilterUtils.extractFilterParams(params) |
---|
| 66 | def isFilterApplied = FilterUtils.isFilterApplied(params) |
---|
[260] | 67 | |
---|
[476] | 68 | // Restore search unless a new search is being requested. |
---|
| 69 | if(!params.quickSearch && !filterParams) { |
---|
| 70 | if(session.taskSearchQuickSearch) |
---|
| 71 | params.quickSearch = session.taskSearchQuickSearch |
---|
| 72 | else if(session.taskSearchFilterParams) { |
---|
| 73 | session.taskSearchFilterParams.each() { params[it.key] = it.value } |
---|
| 74 | params.filter = session.taskSearchFilter |
---|
| 75 | isFilterApplied = FilterUtils.isFilterApplied(params) |
---|
[144] | 76 | } |
---|
[476] | 77 | } |
---|
[260] | 78 | |
---|
[486] | 79 | // Remember sort if supplied, otherwise try to restore. |
---|
| 80 | if(params.sort && params.order) { |
---|
[582] | 81 | // Reset to defaultSort if requested. |
---|
| 82 | if(params.sort == 'defaultSort') { |
---|
| 83 | params.sort = null |
---|
| 84 | params.order = null |
---|
| 85 | session.removeAttribute("taskSearchSort") |
---|
| 86 | session.removeAttribute("taskSearchOrder") |
---|
| 87 | } |
---|
| 88 | else { |
---|
| 89 | session.taskSearchSort = params.sort |
---|
| 90 | session.taskSearchOrder = params.order |
---|
| 91 | } |
---|
[486] | 92 | } |
---|
| 93 | else if(session.taskSearchSort && session.taskSearchOrder) { |
---|
| 94 | params.sort = session.taskSearchSort |
---|
| 95 | params.order = session.taskSearchOrder |
---|
| 96 | } |
---|
| 97 | |
---|
[476] | 98 | if(isFilterApplied) { |
---|
[260] | 99 | // filterPane: |
---|
[582] | 100 | params.sort = params.sort ?: "id" |
---|
| 101 | params.order = params.order ?: "desc" |
---|
[513] | 102 | if(params.sort == "attentionFlag") // See ticket #64 in Trac. |
---|
| 103 | params.sort = "id" |
---|
[516] | 104 | // Prevent tasks in the trash being returned unless explicitly requested. |
---|
| 105 | if(!params.filter.op.trash) { |
---|
| 106 | params.filter.op.trash = "Equal" |
---|
| 107 | params.filter.trash = "false" |
---|
| 108 | } |
---|
| 109 | // Call filterService. |
---|
[260] | 110 | taskInstanceList = filterService.filter( params, Task ) |
---|
| 111 | taskInstanceTotal = filterService.count( params, Task ) |
---|
| 112 | filterParams = com.zeddware.grails.plugins.filterpane.FilterUtils.extractFilterParams(params) |
---|
[476] | 113 | // Remember search. |
---|
| 114 | session.taskSearchFilterParams = new LinkedHashMap(filterParams) |
---|
| 115 | session.taskSearchFilter = new LinkedHashMap(params.filter) |
---|
[488] | 116 | session.removeAttribute("taskSearchQuickSearch") |
---|
[260] | 117 | } |
---|
[476] | 118 | else { |
---|
| 119 | // Quick Search: |
---|
| 120 | if(!params.quickSearch) params.quickSearch = "myTodays" |
---|
| 121 | def result = taskSearchService.getQuickSearch(params, RCU.getLocale(request)) |
---|
| 122 | taskInstanceList = result.taskInstanceList |
---|
| 123 | taskInstanceTotal = result.taskInstanceList.totalCount |
---|
| 124 | params.message = result.message |
---|
| 125 | filterParams.quickSearch = result.quickSearch |
---|
| 126 | // Remember search. |
---|
[488] | 127 | session.removeAttribute("taskSearchFilterParams") |
---|
| 128 | session.removeAttribute("taskSearchFilter") |
---|
[476] | 129 | session.taskSearchQuickSearch = result.quickSearch |
---|
| 130 | } |
---|
[143] | 131 | |
---|
[260] | 132 | // export plugin: |
---|
| 133 | if(params?.format && params.format != "html") { |
---|
| 134 | |
---|
| 135 | def dateFmt = { date -> |
---|
| 136 | formatDate(format: "EEE, dd-MMM-yyyy", date: date) |
---|
| 137 | } |
---|
| 138 | |
---|
| 139 | String title |
---|
| 140 | if(params.quickSearch) |
---|
[476] | 141 | title = params.message |
---|
[260] | 142 | else |
---|
| 143 | title = "Filtered tasks." |
---|
| 144 | |
---|
| 145 | response.contentType = ConfigurationHolder.config.grails.mime.types[params.format] |
---|
[390] | 146 | response.setHeader("Content-disposition", "attachment; filename=Tasks.${params.extension}") |
---|
[475] | 147 | List fields = ["id", "targetStartDate", "description", "leadPerson", "taskPriority", "taskType", "taskStatus"] |
---|
[260] | 148 | Map labels = ["id": "ID", "targetStartDate": "Target Start Date", "description": "Description", |
---|
[475] | 149 | "leadPerson": "Lead Person", "taskPriority": "Task Priority", |
---|
| 150 | "taskType": "Task Type", "taskStatus": "Task Status"] |
---|
[260] | 151 | Map formatters = [ targetStartDate: dateFmt] |
---|
| 152 | Map parameters = [title: title, separator: ","] |
---|
| 153 | |
---|
| 154 | exportService.export(params.format, response.outputStream, taskInstanceList, fields, labels, formatters, parameters) |
---|
| 155 | } |
---|
| 156 | |
---|
| 157 | // Add some basic params to filterParams. |
---|
| 158 | filterParams.max = params.max |
---|
| 159 | filterParams.offset = params.offset?.toInteger() ?: 0 |
---|
[582] | 160 | filterParams.sort = params.sort ?: "id" |
---|
[260] | 161 | filterParams.order = params.order ?: "desc" |
---|
| 162 | |
---|
[552] | 163 | // Get some associatedProperty values for filterpane. |
---|
| 164 | def associatedPropertyValues = [:] |
---|
| 165 | def associatedPropertyMax = 10000 |
---|
| 166 | associatedPropertyValues.taskPriorityList = TaskPriority.findAllByIsActive(true, [max:associatedPropertyMax, sort:'name']) |
---|
| 167 | def lastNameQuery = 'select distinct p.lastName from Person p where p.isActive = ? order by p.lastName' |
---|
| 168 | associatedPropertyValues.lastNameList = Person.executeQuery(lastNameQuery, [true], [max:associatedPropertyMax]) |
---|
| 169 | def firstNameQuery = 'select distinct p.firstName from Person p where p.isActive = ? order by p.firstName' |
---|
| 170 | associatedPropertyValues.firstNameList = Person.executeQuery(firstNameQuery, [true], [max:associatedPropertyMax]) |
---|
| 171 | associatedPropertyValues.taskGroupList = TaskGroup.findAllByIsActive(true, [max:associatedPropertyMax, sort:'name']) |
---|
| 172 | associatedPropertyValues.assetList = Asset.findAllByIsActive(true, [max:associatedPropertyMax, sort:'name']) |
---|
| 173 | associatedPropertyValues.taskStatusList = TaskStatus.findAllByIsActive(true, [max:associatedPropertyMax, sort:'name']) |
---|
| 174 | associatedPropertyValues.taskTypeList = TaskType.findAllByIsActive(true, [max:associatedPropertyMax, sort:'name']) |
---|
| 175 | def startOfYearRange = dateUtilService.getYearFromDate(dateUtilService.plusYear(new Date(), -10)) |
---|
| 176 | def endOfYearRange = dateUtilService.getYearFromDate(dateUtilService.plusYear(new Date(), 10)) |
---|
| 177 | associatedPropertyValues.yearRange = startOfYearRange..endOfYearRange |
---|
| 178 | |
---|
[260] | 179 | return[ taskInstanceList: taskInstanceList, |
---|
[476] | 180 | taskInstanceTotal: taskInstanceTotal, |
---|
| 181 | filterParams: filterParams, |
---|
[552] | 182 | params: params, |
---|
[554] | 183 | associatedPropertyValues: associatedPropertyValues ] |
---|
[260] | 184 | |
---|
[476] | 185 | } // search |
---|
[260] | 186 | |
---|
[298] | 187 | @Secured(['ROLE_AppAdmin', 'ROLE_Manager', 'ROLE_TaskManager', 'ROLE_TaskUser']) |
---|
[155] | 188 | def searchCalendar = { |
---|
[140] | 189 | |
---|
[476] | 190 | // No pagination for calendar. |
---|
| 191 | params.offset = 0 |
---|
[474] | 192 | |
---|
[476] | 193 | // Restore params.max |
---|
| 194 | if(session.taskSearchCalendarParamsMax) |
---|
| 195 | params.max = session.taskSearchCalendarParamsMax |
---|
| 196 | |
---|
[474] | 197 | // Protect filterPane. |
---|
[476] | 198 | params.max = Math.min( params.max ? params.max.toInteger() : 100, 1000 ) |
---|
[474] | 199 | |
---|
[585] | 200 | def displayList = [] |
---|
[476] | 201 | def taskInstanceList = [] |
---|
| 202 | def taskInstanceTotal |
---|
| 203 | def filterParams = com.zeddware.grails.plugins.filterpane.FilterUtils.extractFilterParams(params) |
---|
| 204 | def isFilterApplied = FilterUtils.isFilterApplied(params) |
---|
[474] | 205 | |
---|
[476] | 206 | // Restore search unless a new search is being requested. |
---|
| 207 | if(!params.quickSearch && !filterParams) { |
---|
| 208 | if(session.taskSearchCalendarQuickSearch) |
---|
| 209 | params.quickSearch = session.taskSearchCalendarQuickSearch |
---|
| 210 | else if(session.taskSearchCalendarFilterParams) { |
---|
| 211 | session.taskSearchCalendarFilterParams.each() { params[it.key] = it.value } |
---|
| 212 | params.filter = session.taskSearchCalendarFilter |
---|
| 213 | isFilterApplied = FilterUtils.isFilterApplied(params) |
---|
| 214 | } |
---|
| 215 | } |
---|
[474] | 216 | |
---|
[476] | 217 | // The date the calendar will use to determine the month to show. |
---|
| 218 | // Use session, if not specified in params, otherwise use today. |
---|
| 219 | def showDate = new Date() |
---|
| 220 | if(params.showMonth) { |
---|
| 221 | if(params.showYear) |
---|
| 222 | showDate = dateUtilService.makeDate(params.showYear, params.showMonth) |
---|
| 223 | else |
---|
| 224 | showDate = dateUtilService.makeDate(dateUtilService.getYearFromDate(showDate), params.showMonth) |
---|
| 225 | // Remember the showDate. |
---|
| 226 | session.taskSearchCalendarShowDate = showDate |
---|
| 227 | } |
---|
| 228 | else if(session.taskSearchCalendarShowDate) |
---|
| 229 | showDate = session.taskSearchCalendarShowDate |
---|
[155] | 230 | |
---|
[476] | 231 | // Get the dates for the calendar month controls. |
---|
| 232 | def calendarMonthControls = getCalendarMonthControls(showDate) |
---|
| 233 | |
---|
| 234 | if(isFilterApplied) { |
---|
| 235 | // filterPane: |
---|
[516] | 236 | if(params.sort == "attentionFlag") // See ticket #64 in Trac. |
---|
| 237 | params.sort = "id" |
---|
| 238 | // Prevent tasks in the trash being returned unless explicitly requested. |
---|
| 239 | if(!params.filter.op.trash) { |
---|
| 240 | params.filter.op.trash = "Equal" |
---|
| 241 | params.filter.trash = "false" |
---|
| 242 | } |
---|
| 243 | // Call filterService. |
---|
[476] | 244 | taskInstanceList = filterService.filter( params, Task ) |
---|
| 245 | taskInstanceTotal = filterService.count( params, Task ) |
---|
| 246 | filterParams = com.zeddware.grails.plugins.filterpane.FilterUtils.extractFilterParams(params) |
---|
| 247 | // Remember search. |
---|
| 248 | session.taskSearchCalendarFilterParams = new LinkedHashMap(filterParams) |
---|
| 249 | session.taskSearchCalendarFilter = new LinkedHashMap(params.filter) |
---|
[488] | 250 | session.removeAttribute("taskSearchCalendarQuickSearch") |
---|
[139] | 251 | } |
---|
[476] | 252 | else { |
---|
| 253 | // Quick Search: |
---|
| 254 | def result = taskSearchService.getQuickSearch(params, RCU.getLocale(request)) |
---|
| 255 | taskInstanceList = result.taskInstanceList |
---|
| 256 | taskInstanceTotal = result.taskInstanceList.totalCount |
---|
| 257 | params.message = result.message |
---|
| 258 | filterParams.quickSearch = result.quickSearch |
---|
| 259 | // Remember search. |
---|
[488] | 260 | session.removeAttribute("taskSearchCalendarFilterParams") |
---|
| 261 | session.removeAttribute("taskSearchCalendarFilter") |
---|
[476] | 262 | session.taskSearchCalendarQuickSearch = result.quickSearch |
---|
| 263 | } |
---|
[140] | 264 | |
---|
[588] | 265 | // displayList = taskReportService.getWorkLoadSummary( |
---|
| 266 | // [taskInstanceList: taskInstanceList], RCU.getLocale(request) |
---|
| 267 | // ).displayList |
---|
[585] | 268 | |
---|
[476] | 269 | // export plugin: |
---|
| 270 | if(params?.format && params.format != "html") { |
---|
[165] | 271 | |
---|
[476] | 272 | def dateFmt = { date -> |
---|
| 273 | formatDate(format: "EEE, dd-MMM-yyyy", date: date) |
---|
[165] | 274 | } |
---|
[260] | 275 | |
---|
[476] | 276 | String title |
---|
| 277 | if(params.quickSearch) |
---|
| 278 | title = params.message |
---|
| 279 | else |
---|
| 280 | title = "Filtered tasks." |
---|
[165] | 281 | |
---|
[476] | 282 | response.contentType = ConfigurationHolder.config.grails.mime.types[params.format] |
---|
| 283 | response.setHeader("Content-disposition", "attachment; filename=Tasks.${params.extension}") |
---|
| 284 | List fields = ["id", "targetStartDate", "description", "leadPerson", "taskPriority", "taskType", "taskStatus"] |
---|
| 285 | Map labels = ["id": "ID", "targetStartDate": "Target Start Date", "description": "Description", |
---|
| 286 | "leadPerson": "Lead Person", "taskPriority": "Task Priority", |
---|
| 287 | "taskType": "Task Type", "taskStatus": "Task Status"] |
---|
| 288 | Map formatters = [ targetStartDate: dateFmt] |
---|
| 289 | Map parameters = [title: title, separator: ","] |
---|
| 290 | |
---|
| 291 | exportService.export(params.format, response.outputStream, taskInstanceList, fields, labels, formatters, parameters) |
---|
[165] | 292 | } |
---|
| 293 | |
---|
[588] | 294 | if(taskInstanceTotal > params.max) |
---|
| 295 | params.errorMessage = g.message(code:"task.search.calendar.text.too.many.results", args:[params.max]) |
---|
[476] | 296 | |
---|
| 297 | // Add some basic params to filterParams. |
---|
| 298 | filterParams.max = params.max |
---|
| 299 | filterParams.offset = params.offset?.toInteger() ?: 0 |
---|
| 300 | |
---|
[588] | 301 | return[taskInstanceList: taskInstanceList, |
---|
[476] | 302 | taskInstanceTotal: taskInstanceTotal, |
---|
| 303 | filterParams: filterParams, |
---|
| 304 | params: params, |
---|
| 305 | showDate: showDate, |
---|
| 306 | today: calendarMonthControls.today, |
---|
| 307 | previousMonth: calendarMonthControls.previousMonth, |
---|
| 308 | nextMonth: calendarMonthControls.nextMonth, |
---|
| 309 | previousYear: calendarMonthControls.previousYear, |
---|
| 310 | nextYear: calendarMonthControls.nextYear] |
---|
| 311 | |
---|
| 312 | } // searchCalendar |
---|
| 313 | |
---|
[298] | 314 | @Secured(['ROLE_AppAdmin', 'ROLE_Manager', 'ROLE_TaskManager', 'ROLE_TaskUser']) |
---|
[66] | 315 | def show = { |
---|
[147] | 316 | |
---|
[139] | 317 | // In the case of an actionSubmit button, rewrite action name from 'index'. |
---|
| 318 | if(params._action_Show) |
---|
[375] | 319 | params.action='show' |
---|
[139] | 320 | |
---|
[433] | 321 | // Used by navigation. |
---|
| 322 | if(params.id == 'nav') { |
---|
| 323 | params.id = session.currentTaskId ?: null |
---|
| 324 | redirect(action: show, id: params.id) |
---|
| 325 | return |
---|
| 326 | } |
---|
| 327 | |
---|
[225] | 328 | def showTab = [:] |
---|
| 329 | switch (params.showTab) { |
---|
| 330 | case "showProcedureTab": |
---|
| 331 | showTab.procedure = new String("true") |
---|
| 332 | break |
---|
| 333 | case "showRecurrenceTab": |
---|
| 334 | showTab.recurrence = new String("true") |
---|
| 335 | break |
---|
| 336 | case "showInventoryTab": |
---|
| 337 | showTab.inventory = new String("true") |
---|
| 338 | break |
---|
| 339 | case "showSubTasksTab": |
---|
| 340 | showTab.subTasks = new String("true") |
---|
| 341 | break |
---|
| 342 | default: |
---|
| 343 | showTab.task = new String("true") |
---|
| 344 | } |
---|
| 345 | |
---|
[66] | 346 | def taskInstance = Task.get( params.id ) |
---|
| 347 | |
---|
| 348 | if(!taskInstance) { |
---|
| 349 | flash.message = "Task not found with id ${params.id}" |
---|
[196] | 350 | redirect(action: 'search') |
---|
[66] | 351 | } |
---|
[133] | 352 | else { |
---|
[433] | 353 | // Remember the current task id for use with navigation. |
---|
| 354 | session.currentTaskId = params.id |
---|
| 355 | |
---|
[179] | 356 | params.max = 10 |
---|
| 357 | params.order = "desc" |
---|
| 358 | params.sort = "id" |
---|
[134] | 359 | |
---|
[418] | 360 | def entryFaultList = Entry.withCriteria { |
---|
| 361 | eq("entryType", EntryType.get(1)) |
---|
| 362 | eq("task", taskInstance) |
---|
| 363 | } |
---|
| 364 | |
---|
| 365 | def entryCauseList = Entry.withCriteria { |
---|
[190] | 366 | eq("entryType", EntryType.get(2)) |
---|
[179] | 367 | eq("task", taskInstance) |
---|
| 368 | } |
---|
| 369 | |
---|
[418] | 370 | def entryWorkDoneList = Entry.withCriteria { |
---|
| 371 | eq("entryType", EntryType.get(3)) |
---|
[179] | 372 | eq("task", taskInstance) |
---|
| 373 | } |
---|
| 374 | |
---|
[196] | 375 | def subTaskInstanceList = Task.findAllByParentTaskAndTrash(taskInstance, false, params) |
---|
| 376 | def subTaskInstanceTotal = Task.countByParentTaskAndTrash(taskInstance, false) |
---|
[134] | 377 | |
---|
[175] | 378 | def inventoryMovementList = InventoryMovement.findAllByTask(taskInstance, [max:100, sort:"id", order:"desc", offset:0]) |
---|
| 379 | |
---|
[180] | 380 | def taskModificationList = TaskModification.findAllByTask(taskInstance, [max:100, sort:"id", order:"asc", offset:0]) |
---|
| 381 | |
---|
[253] | 382 | def assignedGroupList = taskInstance.assignedGroups.sort { p1, p2 -> p1.personGroup.name.compareToIgnoreCase(p2.personGroup.name) } |
---|
| 383 | def assignedPersonList = taskInstance.assignedPersons.sort { p1, p2 -> p1.person.firstName.compareToIgnoreCase(p2.person.firstName) } |
---|
| 384 | |
---|
[133] | 385 | def taskProcedureInstance = TaskProcedure.get(taskInstance.taskProcedure?.id) |
---|
| 386 | def taskProcedureExits = new Boolean("true") |
---|
| 387 | if(!taskProcedureInstance) { |
---|
| 388 | taskProcedureExits = false |
---|
| 389 | } |
---|
[175] | 390 | |
---|
| 391 | params.order = "asc" |
---|
| 392 | params.sort = "procedureStepNumber" |
---|
| 393 | def maintenanceActionList = MaintenanceAction.findAllByTaskProcedure(taskProcedureInstance, params) |
---|
| 394 | |
---|
[134] | 395 | def taskRecurringScheduleInstance = TaskRecurringSchedule.get(taskInstance.taskRecurringSchedule?.id) |
---|
| 396 | def taskRecurringScheduleExits= new Boolean("true") |
---|
[175] | 397 | if(!taskRecurringScheduleInstance) { |
---|
[134] | 398 | taskRecurringScheduleExits = false |
---|
| 399 | } |
---|
[179] | 400 | |
---|
[137] | 401 | return [ taskInstance: taskInstance, |
---|
[418] | 402 | entryFaultList: entryFaultList, |
---|
| 403 | entryCauseList: entryCauseList, |
---|
[179] | 404 | entryWorkDoneList: entryWorkDoneList, |
---|
[133] | 405 | taskProcedureInstance: taskProcedureInstance, |
---|
| 406 | taskProcedureExits: taskProcedureExits, |
---|
[225] | 407 | showTab: showTab, |
---|
[179] | 408 | subTaskInstanceList: subTaskInstanceList, |
---|
| 409 | subTaskInstanceTotal: subTaskInstanceTotal, |
---|
| 410 | subTaskInstanceMax: params.max, |
---|
| 411 | maintenanceActionList: maintenanceActionList, |
---|
| 412 | taskRecurringScheduleInstance: taskRecurringScheduleInstance, |
---|
| 413 | taskRecurringScheduleExits: taskRecurringScheduleExits, |
---|
[180] | 414 | inventoryMovementList: inventoryMovementList, |
---|
[253] | 415 | taskModificationList: taskModificationList, |
---|
| 416 | assignedGroupList: assignedGroupList, |
---|
| 417 | assignedPersonList: assignedPersonList] |
---|
[131] | 418 | } |
---|
[66] | 419 | } |
---|
| 420 | |
---|
[418] | 421 | @Secured(['ROLE_AppAdmin', 'ROLE_Manager', 'ROLE_TaskManager', 'ROLE_TaskUser']) |
---|
[181] | 422 | def restore = { |
---|
| 423 | |
---|
| 424 | def result = taskService.restore(params) |
---|
| 425 | |
---|
| 426 | if(!result.error) { |
---|
| 427 | flash.message = "Task ${params.id} has been restored." |
---|
[418] | 428 | redirect(action: show, id: params.id) |
---|
| 429 | return |
---|
[181] | 430 | } |
---|
| 431 | |
---|
[418] | 432 | flash.errorMessage = g.message(code: result.error.code, args: result.error.args) |
---|
| 433 | |
---|
| 434 | if(result.taskInstance) |
---|
| 435 | redirect(action: show, id: params.id) |
---|
| 436 | else |
---|
| 437 | redirect(action: 'search') |
---|
| 438 | |
---|
[181] | 439 | } |
---|
| 440 | |
---|
[418] | 441 | @Secured(['ROLE_AppAdmin', 'ROLE_Manager', 'ROLE_TaskManager', 'ROLE_TaskUser']) |
---|
[181] | 442 | def trash = { |
---|
| 443 | |
---|
| 444 | def result = taskService.trash(params) |
---|
| 445 | |
---|
| 446 | if(!result.error) { |
---|
| 447 | flash.message = "Task ${params.id} has been moved to trash." |
---|
[196] | 448 | redirect(action: 'search') |
---|
[418] | 449 | return |
---|
[181] | 450 | } |
---|
| 451 | |
---|
[418] | 452 | flash.errorMessage = g.message(code: result.error.code, args: result.error.args) |
---|
| 453 | |
---|
| 454 | if(result.taskInstance) |
---|
| 455 | redirect(action: show, id: params.id) |
---|
| 456 | else |
---|
| 457 | redirect(action: 'search') |
---|
| 458 | |
---|
[66] | 459 | } |
---|
| 460 | |
---|
[418] | 461 | @Secured(['ROLE_AppAdmin', 'ROLE_Manager', 'ROLE_TaskManager']) |
---|
[181] | 462 | def approve = { |
---|
| 463 | |
---|
| 464 | def result = taskService.approve(params) |
---|
| 465 | |
---|
| 466 | if(!result.error) { |
---|
| 467 | flash.message = "Task ${params.id} has been approved." |
---|
[418] | 468 | redirect(action: show, id: params.id) |
---|
| 469 | return |
---|
[181] | 470 | } |
---|
| 471 | |
---|
[418] | 472 | flash.errorMessage = g.message(code: result.error.code, args: result.error.args) |
---|
| 473 | |
---|
| 474 | if(result.taskInstance) |
---|
| 475 | redirect(action: show, id: params.id) |
---|
| 476 | else |
---|
| 477 | redirect(action: 'search') |
---|
| 478 | |
---|
[181] | 479 | } |
---|
| 480 | |
---|
[465] | 481 | @Secured(['ROLE_AppAdmin', 'ROLE_Manager', 'ROLE_TaskManager']) |
---|
[181] | 482 | def renegeApproval = { |
---|
| 483 | |
---|
| 484 | def result = taskService.renegeApproval(params) |
---|
| 485 | |
---|
| 486 | if(!result.error) { |
---|
| 487 | flash.message = "Task ${params.id} has had approval removed." |
---|
[418] | 488 | redirect(action: show, id: params.id) |
---|
| 489 | return |
---|
[181] | 490 | } |
---|
| 491 | |
---|
[418] | 492 | flash.errorMessage = g.message(code: result.error.code, args: result.error.args) |
---|
| 493 | |
---|
| 494 | if(result.taskInstance) |
---|
| 495 | redirect(action: show, id: params.id) |
---|
| 496 | else |
---|
| 497 | redirect(action: 'search') |
---|
| 498 | |
---|
[181] | 499 | } |
---|
| 500 | |
---|
[298] | 501 | @Secured(['ROLE_AppAdmin', 'ROLE_Manager', 'ROLE_TaskManager', 'ROLE_TaskUser']) |
---|
[181] | 502 | def complete = { |
---|
| 503 | |
---|
| 504 | def result = taskService.complete(params) |
---|
| 505 | |
---|
| 506 | if(!result.error) { |
---|
| 507 | flash.message = "Task ${params.id} has been completed." |
---|
[418] | 508 | redirect(action: show, id: params.id) |
---|
| 509 | return |
---|
[181] | 510 | } |
---|
[418] | 511 | |
---|
| 512 | flash.errorMessage = g.message(code: result.error.code, args: result.error.args) |
---|
| 513 | |
---|
| 514 | if(result.taskInstance) |
---|
| 515 | redirect(action: show, id: params.id) |
---|
| 516 | else |
---|
| 517 | redirect(action: 'search') |
---|
| 518 | |
---|
| 519 | } |
---|
| 520 | |
---|
| 521 | @Secured(['ROLE_AppAdmin', 'ROLE_Manager', 'ROLE_TaskManager', 'ROLE_TaskUser']) |
---|
| 522 | def setAttentionFlag = { |
---|
| 523 | |
---|
| 524 | def result = taskService.setAttentionFlag(params) |
---|
| 525 | |
---|
| 526 | if(!result.error) { |
---|
| 527 | flash.message = "Task ${params.id} has been flagged for attention." |
---|
| 528 | redirect(action: show, id: params.id) |
---|
| 529 | return |
---|
[181] | 530 | } |
---|
| 531 | |
---|
[418] | 532 | flash.errorMessage = g.message(code: result.error.code, args: result.error.args) |
---|
| 533 | |
---|
| 534 | if(result.taskInstance) |
---|
| 535 | redirect(action: show, id: params.id) |
---|
| 536 | else |
---|
| 537 | redirect(action: 'search') |
---|
| 538 | |
---|
[181] | 539 | } |
---|
| 540 | |
---|
[298] | 541 | @Secured(['ROLE_AppAdmin', 'ROLE_Manager', 'ROLE_TaskManager', 'ROLE_TaskUser']) |
---|
[418] | 542 | def clearAttentionFlag = { |
---|
[181] | 543 | |
---|
[418] | 544 | def result = taskService.clearAttentionFlag(params) |
---|
| 545 | |
---|
| 546 | if(!result.error) { |
---|
| 547 | flash.message = "Task ${params.id} attention flag cleared." |
---|
| 548 | redirect(action: show, id: params.id) |
---|
| 549 | return |
---|
[181] | 550 | } |
---|
| 551 | |
---|
[418] | 552 | flash.errorMessage = g.message(code: result.error.code, args: result.error.args) |
---|
| 553 | |
---|
| 554 | if(result.taskInstance) |
---|
| 555 | redirect(action: show, id: params.id) |
---|
| 556 | else |
---|
| 557 | redirect(action: 'search') |
---|
| 558 | |
---|
| 559 | } |
---|
| 560 | |
---|
| 561 | @Secured(['ROLE_AppAdmin', 'ROLE_Manager', 'ROLE_TaskManager', 'ROLE_TaskUser']) |
---|
| 562 | def reopen = { |
---|
| 563 | |
---|
[181] | 564 | def result = taskService.reopen(params) |
---|
| 565 | |
---|
| 566 | if(!result.error) { |
---|
| 567 | flash.message = "Task ${params.id} has been reopened." |
---|
[418] | 568 | redirect(action: show, id: params.id) |
---|
| 569 | return |
---|
[181] | 570 | } |
---|
| 571 | |
---|
[418] | 572 | flash.errorMessage = g.message(code: result.error.code, args: result.error.args) |
---|
| 573 | |
---|
| 574 | if(result.taskInstance) |
---|
| 575 | redirect(action: show, id: params.id) |
---|
| 576 | else |
---|
| 577 | redirect(action: 'search') |
---|
| 578 | |
---|
[181] | 579 | } |
---|
| 580 | |
---|
[298] | 581 | @Secured(['ROLE_AppAdmin', 'ROLE_Manager', 'ROLE_TaskManager', 'ROLE_TaskUser']) |
---|
[66] | 582 | def edit = { |
---|
[147] | 583 | |
---|
[139] | 584 | // In the case of an actionSubmit button, rewrite action name from 'index'. |
---|
| 585 | if(params._action_Edit) |
---|
[375] | 586 | params.action='edit' |
---|
[169] | 587 | |
---|
[433] | 588 | // Used by navigation. |
---|
| 589 | if(params.id == 'nav') { |
---|
| 590 | params.id = session.currentTaskId ?: null |
---|
| 591 | redirect(action: edit, id: params.id) |
---|
| 592 | return |
---|
| 593 | } |
---|
| 594 | |
---|
[66] | 595 | def taskInstance = Task.get( params.id ) |
---|
| 596 | |
---|
| 597 | if(!taskInstance) { |
---|
| 598 | flash.message = "Task not found with id ${params.id}" |
---|
[196] | 599 | redirect(action: 'search') |
---|
[66] | 600 | } |
---|
| 601 | else { |
---|
[433] | 602 | // Remember the current task id for use with navigation. |
---|
| 603 | session.currentTaskId = params.id |
---|
| 604 | |
---|
[181] | 605 | if(taskInstance.trash) { |
---|
[196] | 606 | flash.message = "You may not edit tasks that are in the trash." |
---|
| 607 | redirect(action: 'show', id: taskInstance.id) |
---|
| 608 | return |
---|
[181] | 609 | } |
---|
[246] | 610 | // def possibleParentList = taskService.possibleParentList(taskInstance) |
---|
| 611 | // return [ taskInstance : taskInstance, possibleParentList: possibleParentList ] |
---|
| 612 | return [ taskInstance : taskInstance ] |
---|
[84] | 613 | } |
---|
| 614 | } |
---|
| 615 | |
---|
[298] | 616 | @Secured(['ROLE_AppAdmin', 'ROLE_Manager', 'ROLE_TaskManager', 'ROLE_TaskUser']) |
---|
[66] | 617 | def update = { |
---|
[179] | 618 | |
---|
[180] | 619 | def result = taskService.update(params) |
---|
| 620 | |
---|
| 621 | if(!result.error) { |
---|
[66] | 622 | flash.message = "Task ${params.id} updated" |
---|
[418] | 623 | redirect(action: show, id: params.id) |
---|
| 624 | return |
---|
[180] | 625 | } |
---|
| 626 | |
---|
[418] | 627 | if(result.error.code == "task.modifications.failedToSave") |
---|
| 628 | flash.errorMessage = g.message(code: result.error.code, args: result.error.args) |
---|
| 629 | |
---|
| 630 | render(view:'edit',model:[taskInstance:result.taskInstance.attach()]) |
---|
| 631 | |
---|
[66] | 632 | } |
---|
| 633 | |
---|
[473] | 634 | /** |
---|
| 635 | * The create action is used to create scheduled types of tasks. |
---|
| 636 | */ |
---|
| 637 | @Secured(['ROLE_AppAdmin', 'ROLE_Manager', 'ROLE_TaskManager']) |
---|
[66] | 638 | def create = { |
---|
| 639 | def taskInstance = new Task() |
---|
[214] | 640 | |
---|
| 641 | // Set the targetStartDate if specified, used by searchCalendar view. |
---|
[476] | 642 | if(params.year && params.month && params.day) { |
---|
| 643 | def date = dateUtilService.makeDate(params.year, params.month, params.day) |
---|
| 644 | taskInstance.targetStartDate = date |
---|
| 645 | taskInstance.targetCompletionDate = date |
---|
| 646 | } |
---|
[214] | 647 | |
---|
[196] | 648 | // Default leadPerson to current user, unless supplied in params. |
---|
[291] | 649 | taskInstance.leadPerson = authService.currentUser |
---|
[487] | 650 | |
---|
| 651 | // Apply params, overiding anything above. |
---|
[66] | 652 | taskInstance.properties = params |
---|
[433] | 653 | |
---|
| 654 | def scheduledTaskTypes = taskService.scheduledTaskTypes |
---|
| 655 | def scheduledTaskPriorities = taskService.scheduledTaskPriorities |
---|
| 656 | taskInstance.taskPriority = scheduledTaskPriorities.default |
---|
| 657 | return ['taskInstance': taskInstance, |
---|
| 658 | 'scheduledTaskTypes': scheduledTaskTypes, |
---|
| 659 | 'scheduledTaskPriorities': scheduledTaskPriorities.list] |
---|
[66] | 660 | } |
---|
| 661 | |
---|
[298] | 662 | @Secured(['ROLE_AppAdmin', 'ROLE_Manager', 'ROLE_TaskManager', 'ROLE_TaskUser']) |
---|
[66] | 663 | def save = { |
---|
[394] | 664 | def result = taskService.save(params) |
---|
[180] | 665 | |
---|
| 666 | if(!result.error) { |
---|
| 667 | flash.message = "Task ${result.taskInstance.id} created." |
---|
[196] | 668 | redirect(action: 'show', id: result.taskInstance.id) |
---|
[418] | 669 | return |
---|
[66] | 670 | } |
---|
[180] | 671 | |
---|
[418] | 672 | if(result.error.code == "task.modifications.failedToSave") |
---|
| 673 | flash.errorMessage = g.message(code: result.error.code, args: result.error.args) |
---|
| 674 | |
---|
[433] | 675 | |
---|
| 676 | def scheduledTaskTypes = taskService.scheduledTaskTypes |
---|
| 677 | def scheduledTaskPriorities = taskService.scheduledTaskPriorities |
---|
| 678 | render(view:'create', model:[taskInstance:result.taskInstance, |
---|
| 679 | 'scheduledTaskTypes': scheduledTaskTypes, |
---|
| 680 | 'scheduledTaskPriorities': scheduledTaskPriorities.list]) |
---|
[66] | 681 | } |
---|
[179] | 682 | |
---|
[298] | 683 | @Secured(['ROLE_AppAdmin', 'ROLE_Manager', 'ROLE_TaskManager', 'ROLE_TaskUser']) |
---|
[179] | 684 | def listSubTasks = { |
---|
| 685 | def parentTaskInstance = Task.get(params.id) |
---|
| 686 | |
---|
[134] | 687 | if(!parentTaskInstance) { |
---|
| 688 | flash.message = "Task not found with id ${params.id}" |
---|
[196] | 689 | redirect(action: 'search') |
---|
[133] | 690 | } |
---|
| 691 | else { |
---|
[179] | 692 | params.max = Math.min( params.max ? params.max.toInteger() : 10, 100) |
---|
[196] | 693 | def subTaskInstanceList = Task.findAllByParentTaskAndTrash(parentTaskInstance, false, params) |
---|
| 694 | def subTaskInstanceTotal = Task.countByParentTaskAndTrash(parentTaskInstance, false) |
---|
[179] | 695 | |
---|
[134] | 696 | [ taskInstanceList: subTaskInstanceList, |
---|
[179] | 697 | taskInstanceTotal: subTaskInstanceTotal, |
---|
| 698 | parentTaskInstance: parentTaskInstance] |
---|
| 699 | } |
---|
| 700 | } |
---|
| 701 | |
---|
[298] | 702 | @Secured(['ROLE_AppAdmin', 'ROLE_Manager', 'ROLE_TaskManager', 'ROLE_TaskUser']) |
---|
[196] | 703 | def createSubTask = { |
---|
| 704 | def parentTaskInstance = Task.get(params.id) |
---|
| 705 | |
---|
| 706 | if(parentTaskInstance) { |
---|
| 707 | |
---|
| 708 | def result = taskService.createSubTask(parentTaskInstance) |
---|
| 709 | if(!result.error) { |
---|
| 710 | flash.message = "Sub Task ${result.taskInstance.id} created, please edit and update to your requirements." |
---|
| 711 | redirect(action: 'edit', id: result.taskInstance.id) |
---|
| 712 | } |
---|
| 713 | else { |
---|
| 714 | if(result.taskInstance.errors.hasFieldErrors("parentTask")) { |
---|
[418] | 715 | flash.errorMessage = g.message(code:"task.operationNotPermittedOnTaskInTrash") |
---|
[196] | 716 | redirect(action: 'show', id: parentTaskInstance.id) |
---|
| 717 | } |
---|
| 718 | else { |
---|
| 719 | render(view: 'create', model:[taskInstance: result.taskInstance]) |
---|
| 720 | } |
---|
| 721 | } |
---|
| 722 | } |
---|
| 723 | |
---|
| 724 | else { |
---|
| 725 | flash.message = "Task not found with id ${params.id}" |
---|
| 726 | redirect(action: 'search') |
---|
| 727 | } |
---|
| 728 | } |
---|
| 729 | |
---|
[395] | 730 | @Secured(['ROLE_AppAdmin', 'ROLE_Manager', 'ROLE_TaskManager', 'ROLE_TaskUser']) |
---|
[433] | 731 | def createUnscheduled = { |
---|
| 732 | def taskInstance = new Task() |
---|
| 733 | |
---|
| 734 | // Default leadPerson to current user, unless supplied in params. |
---|
| 735 | taskInstance.leadPerson = authService.currentUser |
---|
| 736 | taskInstance.properties = params |
---|
| 737 | |
---|
| 738 | // Always for Unscheduled task. |
---|
| 739 | taskInstance.taskType = TaskType.get(2) // Unscheduled Breakin. |
---|
| 740 | def unscheduledTaskPriorities = taskService.unscheduledTaskPriorities |
---|
| 741 | taskInstance.taskPriority = unscheduledTaskPriorities.default |
---|
| 742 | |
---|
| 743 | return ['taskInstance': taskInstance, 'unscheduledTaskPriorities': unscheduledTaskPriorities.list] |
---|
| 744 | } |
---|
| 745 | |
---|
| 746 | @Secured(['ROLE_AppAdmin', 'ROLE_Manager', 'ROLE_TaskManager', 'ROLE_TaskUser']) |
---|
| 747 | def saveUnscheduled = { |
---|
| 748 | def result = taskService.saveUnscheduled(params) |
---|
| 749 | |
---|
| 750 | if(!result.error) { |
---|
| 751 | flash.message = "Task ${result.taskInstance.id} created." |
---|
| 752 | redirect(action: 'show', id: result.taskInstance.id) |
---|
| 753 | return |
---|
| 754 | } |
---|
| 755 | |
---|
| 756 | if(result.error.code == "task.modifications.failedToSave") |
---|
| 757 | flash.errorMessage = g.message(code: result.error.code, args: result.error.args) |
---|
| 758 | |
---|
| 759 | def unscheduledTaskPriorities = taskService.unscheduledTaskPriorities |
---|
| 760 | |
---|
| 761 | render(view:'createUnscheduled', |
---|
| 762 | model: ['taskInstance': result.taskInstance, 'unscheduledTaskPriorities': unscheduledTaskPriorities.list]) |
---|
| 763 | } |
---|
| 764 | |
---|
| 765 | @Secured(['ROLE_AppAdmin', 'ROLE_Manager', 'ROLE_TaskManager', 'ROLE_TaskUser']) |
---|
[418] | 766 | def createImmediateCallout = { |
---|
[395] | 767 | def taskInstance = new Task() |
---|
| 768 | |
---|
| 769 | def entryFaultInstance = new Entry(entryType: EntryType.get(1)) // Fault. |
---|
[418] | 770 | def entryCauseInstance = new Entry(entryType: EntryType.get(2)) // Cause. |
---|
| 771 | def entryWorkDoneInstance = new Entry(entryType: EntryType.get(3)) // Work Done. |
---|
[395] | 772 | |
---|
| 773 | return ['taskInstance': taskInstance, |
---|
| 774 | 'entryFaultInstance': entryFaultInstance, |
---|
[418] | 775 | 'entryCauseInstance': entryCauseInstance, |
---|
[395] | 776 | 'entryWorkDoneInstance': entryWorkDoneInstance] |
---|
| 777 | } |
---|
| 778 | |
---|
| 779 | @Secured(['ROLE_AppAdmin', 'ROLE_Manager', 'ROLE_TaskManager', 'ROLE_TaskUser']) |
---|
[418] | 780 | def saveImmediateCallout = { |
---|
| 781 | def result = taskService.saveImmediateCallout(params) |
---|
[395] | 782 | |
---|
| 783 | if(!result.error) { |
---|
| 784 | flash.message = "Task ${result.taskInstance.id} created." |
---|
| 785 | redirect(action: 'show', id: result.taskInstance.id) |
---|
| 786 | return |
---|
| 787 | } |
---|
| 788 | |
---|
| 789 | if(result.error.code == "task.modifications.failedToSave") |
---|
| 790 | flash.errorMessage = g.message(code: result.error.code, args: result.error.args) |
---|
| 791 | |
---|
[418] | 792 | render(view:'createImmediateCallout', |
---|
[395] | 793 | model: ['taskInstance': result.taskInstance, |
---|
| 794 | 'entryFaultInstance': result.entryFaultInstance, |
---|
[418] | 795 | 'entryCauseInstance': result.entryCauseInstance, |
---|
[395] | 796 | 'entryWorkDoneInstance': result.entryWorkDoneInstance]) |
---|
| 797 | |
---|
| 798 | } |
---|
| 799 | |
---|
[476] | 800 | /** |
---|
[490] | 801 | * Render a users total work done hours. |
---|
| 802 | */ |
---|
| 803 | @Secured(['ROLE_AppAdmin', 'ROLE_Manager', 'ROLE_TaskManager', 'ROLE_TaskUser']) |
---|
| 804 | def workDone = { |
---|
| 805 | def result = taskSearchService.getWorkDone(params, RCU.getLocale(request)) |
---|
| 806 | |
---|
| 807 | params.message = result.message |
---|
| 808 | |
---|
| 809 | return[entries: result.entries, |
---|
| 810 | totalEntries : result.totalEntries, |
---|
| 811 | startOfDay: result.startOfDay, |
---|
| 812 | person: result.person, |
---|
| 813 | totalHours: result.totalHours, |
---|
| 814 | totalMinutes: result.totalMinutes] |
---|
| 815 | } // workDone |
---|
| 816 | |
---|
| 817 | /** |
---|
[476] | 818 | * Get some integers for use by the month control links. |
---|
| 819 | */ |
---|
| 820 | private getCalendarMonthControls(Date showDate) { |
---|
| 821 | def result = [:] |
---|
| 822 | result.today = [:] |
---|
| 823 | result.today.date = new Date() |
---|
| 824 | result.today.month = dateUtilService.getMonthFromDate(result.today.date) |
---|
| 825 | result.today.year = dateUtilService.getYearFromDate(result.today.date) |
---|
| 826 | result.nextMonth = [:] |
---|
[553] | 827 | result.nextMonth.date = dateUtilService.plusMonth(showDate) |
---|
[476] | 828 | result.nextMonth.month = dateUtilService.getMonthFromDate(result.nextMonth.date) |
---|
| 829 | result.nextMonth.year = dateUtilService.getYearFromDate(result.nextMonth.date) |
---|
| 830 | result.previousMonth = [:] |
---|
[553] | 831 | result.previousMonth.date = dateUtilService.plusMonth(showDate, -1) |
---|
[476] | 832 | result.previousMonth.month = dateUtilService.getMonthFromDate(result.previousMonth.date) |
---|
| 833 | result.previousMonth.year = dateUtilService.getYearFromDate(result.previousMonth.date) |
---|
| 834 | result.nextYear = [:] |
---|
[552] | 835 | result.nextYear.date = dateUtilService.plusYear(showDate) |
---|
[476] | 836 | result.nextYear.month = dateUtilService.getMonthFromDate(result.nextYear.date) |
---|
| 837 | result.nextYear.year = dateUtilService.getYearFromDate(result.nextYear.date) |
---|
| 838 | result.previousYear = [:] |
---|
[552] | 839 | result.previousYear.date = dateUtilService.plusYear(showDate, -1) |
---|
[476] | 840 | result.previousYear.month = dateUtilService.getMonthFromDate(result.previousYear.date) |
---|
| 841 | result.previousYear.year = dateUtilService.getYearFromDate(result.previousYear.date) |
---|
| 842 | return result |
---|
| 843 | } |
---|
| 844 | |
---|
[196] | 845 | } // end of class. |
---|