Changeset 552
- Timestamp:
- May 31, 2010, 1:29:04 PM (15 years ago)
- Location:
- trunk/grails-app
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/grails-app/controllers/TaskDetailedController.groovy
r525 r552 149 149 filterParams.order = params.order ?: "desc" 150 150 151 // Get some associatedProperty values for filterpane. 152 def associatedPropertyValues = [:] 153 def associatedPropertyMax = 10000 154 associatedPropertyValues.taskPriorityList = TaskPriority.findAllByIsActive(true, [max:associatedPropertyMax, sort:'name']) 155 def lastNameQuery = 'select distinct p.lastName from Person p where p.isActive = ? order by p.lastName' 156 associatedPropertyValues.lastNameList = Person.executeQuery(lastNameQuery, [true], [max:associatedPropertyMax]) 157 def firstNameQuery = 'select distinct p.firstName from Person p where p.isActive = ? order by p.firstName' 158 associatedPropertyValues.firstNameList = Person.executeQuery(firstNameQuery, [true], [max:associatedPropertyMax]) 159 associatedPropertyValues.taskGroupList = TaskGroup.findAllByIsActive(true, [max:associatedPropertyMax, sort:'name']) 160 associatedPropertyValues.assetList = Asset.findAllByIsActive(true, [max:associatedPropertyMax, sort:'name']) 161 associatedPropertyValues.taskStatusList = TaskStatus.findAllByIsActive(true, [max:associatedPropertyMax, sort:'name']) 162 associatedPropertyValues.taskTypeList = TaskType.findAllByIsActive(true, [max:associatedPropertyMax, sort:'name']) 163 def startOfYearRange = dateUtilService.getYearFromDate(dateUtilService.plusYear(new Date(), -10)) 164 def endOfYearRange = dateUtilService.getYearFromDate(dateUtilService.plusYear(new Date(), 10)) 165 associatedPropertyValues.yearRange = startOfYearRange..endOfYearRange 166 151 167 return[ taskInstanceList: taskInstanceList, 152 168 taskInstanceTotal: taskInstanceTotal, 153 169 filterParams: filterParams, 154 params: params ] 170 params: params, 171 associatedPropertyValues: associatedPropertyValues] 155 172 156 173 } // search … … 800 817 result.previousMonth.year = dateUtilService.getYearFromDate(result.previousMonth.date) 801 818 result.nextYear = [:] 802 result.nextYear.date = dateUtilService. getNextYear(showDate)819 result.nextYear.date = dateUtilService.plusYear(showDate) 803 820 result.nextYear.month = dateUtilService.getMonthFromDate(result.nextYear.date) 804 821 result.nextYear.year = dateUtilService.getYearFromDate(result.nextYear.date) 805 822 result.previousYear = [:] 806 result.previousYear.date = dateUtilService. getPreviousYear(showDate)823 result.previousYear.date = dateUtilService.plusYear(showDate, -1) 807 824 result.previousYear.month = dateUtilService.getMonthFromDate(result.previousYear.date) 808 825 result.previousYear.year = dateUtilService.getYearFromDate(result.previousYear.date) -
trunk/grails-app/services/DateUtilService.groovy
r476 r552 99 99 100 100 /** 101 * Get the date one year in the future. 102 * @param date The Date object to start with. 103 * @returns A Date object one year in the future. 101 * Get the date plus x years. 102 * @param date The Date object to start with, defaults to today. 103 * @param plusYears The number of years to add, defaults to 1. 104 * @returns A Date object adjusted by x years. 104 105 */ 105 public static Date getNextYear(Date date) {106 public static Date plusYear(Date date = new Date(), Integer plusYears = 1) { 106 107 use(TimeCategory) { 107 date + 1.years 108 } 109 } 110 111 /** 112 * Get the date one year ago. 113 * @param date The Date object to start with. 114 * @returns A Date object one year ago. 115 */ 116 public static Date getPreviousYear(Date date) { 117 use(TimeCategory) { 118 date - 1.years 108 date + plusYears.years 119 109 } 120 110 } -
trunk/grails-app/views/taskDetailed/search.gsp
r499 r552 171 171 taskStatus.name, 172 172 taskType.name" 173 filterPropertyValues="${['taskPriority.name':[values: TaskPriority.list()],174 'leadPerson.lastName':[values: Person.executeQuery('select distinct t.lastName from Person t')],175 'leadPerson.firstName':[values: Person.executeQuery('select distinct t.firstName from Person t')],176 'taskGroup.name':[values: TaskGroup.list()],177 'associatedAssets.name':[values: Asset.list()],178 'primaryAsset.name':[values: Asset.list()],179 'taskStatus.name':[values: TaskStatus.list()],180 'taskType.name':[values: TaskType.list()],181 targetCompletionDate:[years: 2020..2000,precision:'day'],182 targetStartDate:[years: 2020..2000,precision:'day']173 filterPropertyValues="${['taskPriority.name':[values: associatedPropertyValues.taskPriorityList], 174 'leadPerson.lastName':[values: associatedPropertyValues.lastNameList], 175 'leadPerson.firstName':[values: associatedPropertyValues.firstNameList], 176 'taskGroup.name':[values: associatedPropertyValues.taskGroupList], 177 'associatedAssets.name':[values: associatedPropertyValues.assetList], 178 'primaryAsset.name':[values: associatedPropertyValues.assetList], 179 'taskStatus.name':[values: associatedPropertyValues.taskStatusList], 180 'taskType.name':[values: associatedPropertyValues.taskTypeList], 181 targetCompletionDate:[years: associatedPropertyValues.yearRange,precision:'day'], 182 targetStartDate:[years: associatedPropertyValues.yearRange,precision:'day'] 183 183 ]}"/> 184 184
Note: See TracChangeset
for help on using the changeset viewer.