Changeset 832


Ignore:
Timestamp:
Mar 3, 2011, 11:17:15 AM (9 years ago)
Author:
gav
Message:

Adjust fail sequence of TaskService.saveEntry slightly.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/grails-app/services/TaskService.groovy

    r816 r832  
    341341                return fail(field:"task", code:"task.notFound")
    342342
     343            if(taskInstance.taskStatus.id == 3)
     344                return fail(field:"task", code:"task.operationNotPermittedOnCompleteTask")
     345
     346            // Check for authorisation on recurring tasks.
     347            if(taskInstance.taskRecurringSchedule) {
     348                if(!authenticateService.ifAnyGranted('ROLE_AppAdmin,ROLE_Manager,ROLE_TaskManager'))
     349                    return fail(field:"task", code:"task.operationNotPermittedOnRecurringTaskWithoutAuth")
     350            }
     351
    343352            if(result.entryInstance.hasErrors() || !result.entryInstance.save())
    344353                return fail(code:"default.create.failure")
    345 
    346             if(taskInstance.taskStatus.id == 3)
    347                 return fail(field:"task", code:"task.operationNotPermittedOnCompleteTask")
    348 
    349             // Check for authorisation on recurring tasks.
    350             if(taskInstance.taskRecurringSchedule) {
    351                 if(!authenticateService.ifAnyGranted('ROLE_AppAdmin,ROLE_Manager,ROLE_TaskManager'))
    352                     return fail(field:"task", code:"task.operationNotPermittedOnRecurringTaskWithoutAuth")
    353             }
    354354
    355355            // If task status is "Not Started" and entry type is "Work Done" and time has been booked.
Note: See TracChangeset for help on using the changeset viewer.