Changeset 838 for trunk/grails-app/services
- Timestamp:
- Mar 3, 2011, 11:17:40 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/grails-app/services/TaskService.groovy
r832 r838 353 353 return fail(code:"default.create.failure") 354 354 355 // If task status is "Not Started" and entry type is "Work Done" and time has been booked. 355 // If task status is "Not Started" 356 // and entry type is "Work Done" or "PM Entry" 357 // and time has been booked. 356 358 // Then we create the started modification and set task status. 357 if(taskInstance.taskStatus.id == 1 && result.entryInstance.entryType.id == 3 359 if(taskInstance.taskStatus.id == 1 360 && (result.entryInstance.entryType.id == 3 || result.entryInstance.entryType.id == 6) 358 361 && (result.entryInstance.durationHour + result.entryInstance.durationMinute > 0)) { 359 362 … … 368 371 // Set task status to "In Progress". 369 372 taskInstance.taskStatus = TaskStatus.read(2) 370 371 if(taskInstance.hasErrors() || !taskInstance.save()) 372 return fail(field:"task", code:"task.failedToSave") 373 } 373 } 374 375 // If PM Entry update task.highestSeverity 376 if(result.entryInstance.entryType.id == 6) { 377 def clist = [] 378 taskInstance.entries.each { entry -> 379 if(entry.entryType.id == 6) 380 clist << entry.highestSeverity 381 } 382 383 if(clist) 384 taskInstance.highestSeverity = clist.sort{p1,p2 -> p2.id <=> p1.id}[0] 385 } 386 387 if(taskInstance.hasErrors() || !taskInstance.save()) 388 return fail(field:"task", code:"task.failedToSave") 374 389 375 390 // Success.
Note: See TracChangeset
for help on using the changeset viewer.