Ignore:
Timestamp:
Jan 21, 2011, 3:19:01 PM (13 years ago)
Author:
gav
Message:

New task type 'Parent PM', display these tasks as 'Life Plan' in asset views.

File:
1 edited

Legend:

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

    r728 r749  
    4444                }
    4545        }
     46    }
     47
     48    /**
     49    * Determines and returns a list of parentPM tasks for an asset.
     50    * @param asset The asset to get parentPM tasks for.
     51    * @returns A list of the possible task types.
     52    */
     53    def getParentPMs(asset) {
     54        def parentPMs = Task.withCriteria {
     55                                                eq("primaryAsset", asset)
     56                                                taskType {
     57                                                    idEq(6L)
     58                                                }
     59                                                maxResults(1000)
     60                                        }
    4661    }
    4762
     
    202217        p.taskStatus = TaskStatus.get(1) // A new subTask must always be "Not Started".
    203218        p.taskPriority = parentTask.taskPriority
     219
    204220        p.taskType = params.taskType ?: parentTask.taskType
     221         // Convert "Parent PM" tasks to "Preventative Maintenance" tasks.
     222        if(p.taskType.id == 6)
     223            p.taskType = TaskType.get(4)
     224
    205225        p.leadPerson = params.leadPerson ?: parentTask.leadPerson
    206226        p.primaryAsset = params.primaryAsset ?: parentTask.primaryAsset
Note: See TracChangeset for help on using the changeset viewer.