Changeset 243 for trunk/grails-app/services
- Timestamp:
- Dec 24, 2009, 10:22:35 AM (15 years ago)
- Location:
- trunk/grails-app/services
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/grails-app/services/TaskRecurringScheduleService.groovy
r219 r243 17 17 if ( dateUtilService.tomorrow > it.nextGenerationDate) { 18 18 def p = [:] 19 20 // Build the required params. 19 21 p.targetStartDate = it.nextTargetStartDate 20 22 p.targetCompletionDate = it.nextTargetCompletionDate 21 23 if(it.task.taskProcedure) p.taskProcedure = it.task.taskProcedure 24 if(it.task.assignedGroups) p.assignedGroups = new ArrayList(it.task.assignedGroups) 25 if(it.task.assignedPersons) p.assignedPersons = new ArrayList(it.task.assignedPersons) 26 22 27 def result = taskService.createSubTask(it.task, p) 23 28 if( !result.error ) { -
trunk/grails-app/services/TaskService.groovy
r241 r243 57 57 } 58 58 59 // If we get here all went well. 59 //Add the assignedGroups, provided by a new ArrayList(task.assignedGroups) 60 if(params.assignedGroups) { 61 def assignedGroupInstance 62 params.assignedGroups.each() { 63 assignedGroupInstance = new AssignedGroup(personGroup: it.personGroup, 64 task: taskInstance, 65 estimatedHour: it.estimatedHour, 66 estimatedMinute: it.estimatedMinute) 67 68 if(!assignedGroupInstance.save()) { 69 status.setRollbackOnly() 70 taskInstance.errors.rejectValue("assignedGroups", "task.assignedGroups.failedToSave") 71 result.error = true 72 return result 73 } 74 } 75 } 76 77 //Add the assignedPersons, provided by a new ArrayList(task.assignedPersons) 78 if(params.assignedPersons) { 79 def assignedPersonInstance 80 params.assignedPersons.each() { 81 assignedPersonInstance = new AssignedPerson(person: it.person, 82 task: taskInstance, 83 estimatedHour: it.estimatedHour, 84 estimatedMinute: it.estimatedMinute) 85 86 if(!assignedPersonInstance.save()) { 87 status.setRollbackOnly() 88 taskInstance.errors.rejectValue("assignedPersons", "task.assignedPersons.failedToSave") 89 result.error = true 90 return result 91 } 92 } 93 } 94 95 // Success. 60 96 return result 61 97 } … … 71 107 * Creates a subTask copying attributes from the parentTask unless otherwise specified. 72 108 * The taskProcedure is only assigned to the sub task if given in params. 109 * The assignedPersons and assignedGroups are only added to the sub task if given as new ArrayList's in params. 73 110 * @param parentTask The parent task to get attributes from, also set as the parent. 74 111 * @param params Overrides the parent task values if specified. … … 96 133 97 134 if(params.taskProcedure) p.taskProcedure = params.taskProcedure 98 99 //Set the assignedPersons 100 // taskInstance.assignedPersons.each() { 101 // 102 // def assignedPerson = new AssignedPerson(person: it.person, 103 // task: subTaskInstance, 104 // estimatedHour: it.estimatedHour, 105 // estimatedMinute: it.estimatedMinute).save() 106 // } 135 if(params.assignedGroups) p.assignedGroups = params.assignedGroups 136 if(params.assignedPersons) p.assignedPersons = params.assignedPersons 107 137 108 138 result = create(p)
Note: See TracChangeset
for help on using the changeset viewer.