Ignore:
Timestamp:
Nov 10, 2009, 9:56:28 PM (14 years ago)
Author:
gav
Message:

Small refactor to use personService where appropriate.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/grails-app/controllers/TaskDetailedController.groovy

    r181 r185  
    44class TaskDetailedController extends BaseController {
    55
    6     def authenticateService
     6    def personService
    77    def dateUtilService
    88    def taskService
     
    2929        {
    3030            def taskInstanceList = []
    31             def personInstance = Person.get(authenticateService.userDomain().id)
     31            def personInstance = personService.currentUser()
    3232
    3333            if(params.quickSearch == "searchMyTodays") {
     
    3939                taskInstanceList = taskSearchService.getInTheLastWeek(params)
    4040                if(taskInstanceList.totalCount > 0) { params.message = "Tasks with Target Start Date in the last week." }
    41                 else { params.message = "No tasks found for today." }
     41                else { params.message = "No tasks found for the last week." }
    4242            }
    4343            else if(params.quickSearch == "searchMyInTheLastWeek") {
    4444                taskInstanceList = taskSearchService.getMyInTheLastWeek(params)
    4545                if(taskInstanceList.totalCount > 0) { params.message = "Tasks with Target Start Date in the last week for ${personInstance.firstName} ${personInstance.lastName}." }
    46                 else { params.message = "No tasks found for today." }
     46                else { params.message = "No tasks found for the last week." }
    4747            }
    4848            else {
     
    7070        {
    7171            def taskInstanceList = []
    72             def personInstance = Person.get(authenticateService.userDomain().id)
     72            def personInstance = personService.currentUser()
    7373
    7474            if(params.quickSearch == "searchMyTodays") {
     
    8181                taskInstanceList = taskSearchService.getInTheLastWeek(params)
    8282                if(taskInstanceList.totalCount > 0) { params.message = "Tasks with Target Start Date in the last week." }
    83                 else { params.message = "No tasks found for today." }
     83                else { params.message = "No tasks found for the last week." }
    8484                if(taskInstanceList.totalCount > params.max) { params.message = "Too many results, only the first ${params.max} shown" }
    8585            }
     
    8787                taskInstanceList = taskSearchService.getMyInTheLastWeek(params)
    8888                if(taskInstanceList.totalCount > 0) { params.message = "Tasks with Target Start Date in the last week for ${personInstance.firstName} ${personInstance.lastName}." }
    89                 else { params.message = "No tasks found for today." }
     89                else { params.message = "No tasks found for the last week." }
    9090                if(taskInstanceList.totalCount > params.max) { params.message = "Too many results, only the first ${params.max} shown" }
    9191            }
     
    117117        {
    118118            def taskInstanceList = []
    119             def personInstance = Person.get(authenticateService.userDomain().id)
     119            def personInstance = personService.currentUser()
    120120
    121121            if(params.quickSearch == "budgetUnplanned") {
     
    456456        def taskInstance = new Task()
    457457        // Default leadPerson to current user.
    458         taskInstance.leadPerson = Person.get(authenticateService.userDomain().id)
     458        taskInstance.leadPerson = personService.currentUser()
    459459        taskInstance.properties = params
    460460        return ['taskInstance':taskInstance]
Note: See TracChangeset for help on using the changeset viewer.