- Timestamp:
- Mar 3, 2011, 11:17:40 PM (14 years ago)
- Location:
- trunk
- Files:
-
- 1 added
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/grails-app/controllers/EntryDetailedController.groovy
r833 r838 67 67 } 68 68 69 /// @todo: Refactor to taskService and include moving task to "In Progress" when Entry.duration is updated. 69 70 def update = { 70 71 def entryInstance = Entry.get( params.id ) … … 74 75 entryInstance.properties = params 75 76 if(!entryInstance.hasErrors() && entryInstance.save(flush: true)) { 77 // If PM Entry update task.highestSeverity 78 if(entryInstance.entryType.id == 6) { 79 def clist = [] 80 entryInstance.task.entries.each { entry -> 81 if(entry.entryType.id == 6) 82 clist << entry.highestSeverity 83 } 84 85 if(clist) 86 entryInstance.task.highestSeverity = clist.sort{p1,p2 -> p2.id <=> p1.id}[0] 87 } 76 88 flash.message = "Entry ${params.id} updated" 77 89 redirect(action:show,id:entryInstance.id) -
trunk/grails-app/controllers/TaskDetailedController.groovy
r833 r838 185 185 associatedPropertyValues.taskGroupList = TaskGroup.findAllByIsActive(true, [max:associatedPropertyMax, sort:'name']) 186 186 associatedPropertyValues.assetList = Asset.findAllByIsActive(true, [max:associatedPropertyMax, sort:'name']) 187 def highestSeverityCodeQuery = 'select distinct cs.code from ConditionSeverity cs where cs.isActive = ? order by cs.code' 188 associatedPropertyValues.highestSeverityList = ConditionSeverity.executeQuery(highestSeverityCodeQuery, [true], [max:associatedPropertyMax]) 187 189 associatedPropertyValues.taskStatusList = TaskStatus.findAllByIsActive(true, [max:associatedPropertyMax, sort:'name']) 188 190 associatedPropertyValues.taskTypeList = TaskType.findAllByIsActive(true, [max:associatedPropertyMax, sort:'name']) … … 342 344 associatedPropertyValues.taskGroupList = TaskGroup.findAllByIsActive(true, [max:associatedPropertyMax, sort:'name']) 343 345 associatedPropertyValues.assetList = Asset.findAllByIsActive(true, [max:associatedPropertyMax, sort:'name']) 346 def highestSeverityCodeQuery = 'select distinct cs.code from ConditionSeverity cs where cs.isActive = ? order by cs.code' 347 associatedPropertyValues.highestSeverityList = ConditionSeverity.executeQuery(highestSeverityCodeQuery, [true], [max:associatedPropertyMax]) 344 348 associatedPropertyValues.taskStatusList = TaskStatus.findAllByIsActive(true, [max:associatedPropertyMax, sort:'name']) 345 349 associatedPropertyValues.taskTypeList = TaskType.findAllByIsActive(true, [max:associatedPropertyMax, sort:'name']) -
trunk/grails-app/services/TaskService.groovy
r832 r838 353 353 return fail(code:"default.create.failure") 354 354 355 // If task status is "Not Started" and entry type is "Work Done" and time has been booked. 355 // If task status is "Not Started" 356 // and entry type is "Work Done" or "PM Entry" 357 // and time has been booked. 356 358 // Then we create the started modification and set task status. 357 if(taskInstance.taskStatus.id == 1 && result.entryInstance.entryType.id == 3 359 if(taskInstance.taskStatus.id == 1 360 && (result.entryInstance.entryType.id == 3 || result.entryInstance.entryType.id == 6) 358 361 && (result.entryInstance.durationHour + result.entryInstance.durationMinute > 0)) { 359 362 … … 368 371 // Set task status to "In Progress". 369 372 taskInstance.taskStatus = TaskStatus.read(2) 370 371 if(taskInstance.hasErrors() || !taskInstance.save()) 372 return fail(field:"task", code:"task.failedToSave") 373 } 373 } 374 375 // If PM Entry update task.highestSeverity 376 if(result.entryInstance.entryType.id == 6) { 377 def clist = [] 378 taskInstance.entries.each { entry -> 379 if(entry.entryType.id == 6) 380 clist << entry.highestSeverity 381 } 382 383 if(clist) 384 taskInstance.highestSeverity = clist.sort{p1,p2 -> p2.id <=> p1.id}[0] 385 } 386 387 if(taskInstance.hasErrors() || !taskInstance.save()) 388 return fail(field:"task", code:"task.failedToSave") 374 389 375 390 // Success. -
trunk/grails-app/views/entryDetailed/_create.gsp
r833 r838 16 16 <table> 17 17 <tbody> 18 19 <g:if test="${entryInstance?.entryType?.id == 1}"> 20 <tr class="prop"> 21 <td valign="top" class="name"> 22 <label for="productionReference">Production:</label> 23 </td> 24 <td valign="top" class="value ${hasErrors(bean:entryInstance,field:'productionReference','errors')}"> 25 <g:select optionKey="id" 26 from="${ProductionReference.findAllByIsActive(true)}" 27 name="productionReference.id" 28 value="${entryInstance.productionReference?.id}" 29 noSelection="['null':'--None--']"> 30 </g:select> 31 <custom:helpBalloon code="entry.productionReference.fault" iconSrc="${resource(plugin:'help-balloons', dir:'images', file:'balloon-icon.gif')}" /> 32 </td> 33 </tr> 34 </g:if> 35 36 <g:if test="${entryInstance?.entryType?.id == 6}"> 37 <tr class="prop"> 38 <td valign="top" class="name"> 39 <label for="highestSeverity">Condition Severity:</label> 40 </td> 41 <td valign="top" class="value ${hasErrors(bean:entryInstance,field:'highestSeverity','errors')}"> 42 <g:select optionKey="id" 43 from="${ConditionSeverity.findAllByIsActive(true)}" 44 name="highestSeverity.id" 45 value="${entryInstance.highestSeverity?.id}" 46 noSelection="['null':/${g.message(code:'default.please.select.text')}/]" > 47 </g:select> 48 <custom:helpBalloon code="entry.comment.pm.entry" iconSrc="${resource(plugin:'help-balloons', dir:'images', file:'balloon-icon.gif')}" /> 49 </td> 50 </tr> 51 </g:if> 18 52 19 53 <tr class="prop"> … … 48 82 </tr> 49 83 50 <g:if test="${entryInstance?.entryType?.id == 1}">51 <tr class="prop">52 <td valign="top" class="name">53 <label for="productionReference">Production:</label>54 </td>55 <td valign="top" class="value ${hasErrors(bean:entryInstance,field:'productionReference','errors')}">56 <g:select optionKey="id"57 from="${ProductionReference.findAllByIsActive(true)}"58 name="productionReference.id"59 value="${entryInstance.productionReference?.id}"60 noSelection="['null':'--None--']">61 </g:select>62 <custom:helpBalloon code="entry.productionReference.fault" iconSrc="${resource(plugin:'help-balloons', dir:'images', file:'balloon-icon.gif')}" />63 </td>64 </tr>65 </g:if>66 67 84 <g:if test="${entryInstance?.entryType?.id != 2}"> 68 85 <tr class="prop"> -
trunk/grails-app/views/entryDetailed/_list.gsp
r834 r838 18 18 <thead> 19 19 <tr> 20 <g:if test="${entryList[0]?.entryType?.id == 6}"> 21 <th> 22 <img src="${resource(dir:'images/skin',file:'award_star_silver_3.png')}" 23 alt="Severity" 24 title="Highest Severity" /> 25 </th> 26 </g:if> 20 27 <th>Comment</th> 21 28 <th>Date Done</th> … … 28 35 <g:each in="${entryList}" status="i" var="entry"> 29 36 <tr class="${(i % 2) == 0 ? 'clickableOdd' : 'clickableEven'}"> 37 38 <g:if test="${entryList[0]?.entryType?.id == 6}"> 39 <td onclick='window.location = "${request.getContextPath()}/entryDetailed/edit/${entry.id}"'> 40 ${entry.highestSeverity.code.encodeAsHTML()} 41 </td> 42 </g:if> 30 43 31 44 <td width="65%" onclick='window.location = "${request.getContextPath()}/entryDetailed/edit/${entry.id}"'> -
trunk/grails-app/views/entryDetailed/edit.gsp
r432 r838 37 37 </td> 38 38 </tr> 39 40 <g:if test="${entryInstance?.entryType?.id == 1}"> 41 <tr class="prop"> 42 <td valign="top" class="name"> 43 <label for="productionReference">Production:</label> 44 </td> 45 <td valign="top" class="value ${hasErrors(bean:entryInstance,field:'productionReference','errors')}"> 46 <g:select optionKey="id" 47 from="${ProductionReference.findAllByIsActive(true)}" 48 name="productionReference.id" 49 value="${entryInstance.productionReference?.id}" 50 noSelection="['null':'--None--']"> 51 </g:select> 52 <g:helpBalloon code="entry.productionReference.fault" /> 53 </td> 54 </tr> 55 </g:if> 56 57 <g:if test="${entryInstance?.entryType?.id == 6}"> 58 <tr class="prop"> 59 <td valign="top" class="name"> 60 <label for="highestSeverity">Condition Severity:</label> 61 </td> 62 <td valign="top" class="value ${hasErrors(bean:entryInstance,field:'highestSeverity','errors')}"> 63 <g:select optionKey="id" 64 from="${ConditionSeverity.findAllByIsActive(true)}" 65 name="highestSeverity.id" 66 value="${entryInstance.highestSeverity?.id}" 67 noSelection="['null':/${g.message(code:'default.please.select.text')}/]" > 68 </g:select> 69 <custom:helpBalloon code="entry.comment.pm.entry" iconSrc="${resource(plugin:'help-balloons', dir:'images', file:'balloon-icon.gif')}" /> 70 </td> 71 </tr> 72 </g:if> 39 73 40 74 <tr class="prop"> … … 55 89 </td> 56 90 </tr> 57 58 <g:if test="${entryInstance?.entryType?.id == 1}">59 <tr class="prop">60 <td valign="top" class="name">61 <label for="productionReference">Production:</label>62 </td>63 <td valign="top" class="value ${hasErrors(bean:entryInstance,field:'productionReference','errors')}">64 <g:select optionKey="id"65 from="${ProductionReference.findAllByIsActive(true)}"66 name="productionReference.id"67 value="${entryInstance.productionReference?.id}"68 noSelection="['null':'--None--']">69 </g:select>70 <g:helpBalloon code="entry.productionReference.fault" />71 </td>72 </tr>73 </g:if>74 91 75 92 <g:if test="${entryInstance?.entryType?.id != 2}"> -
trunk/grails-app/views/entryDetailed/show.gsp
r431 r838 33 33 34 34 </tr> 35 36 <g:if test="${entryInstance.productionReference}"> 37 <tr class="prop"> 38 <td valign="top" class="name">Production:</td> 39 40 <td valign="top" class="value"> 41 ${fieldValue(bean:entryInstance, field:'productionReference')} 42 </td> 43 44 </tr> 45 </g:if> 46 47 <g:if test="${entryInstance.highestSeverity}"> 48 <tr class="prop"> 49 <td valign="top" class="name">Condition Severity:</td> 50 51 <td valign="top" class="value"> 52 ${fieldValue(bean:entryInstance, field:'highestSeverity')} 53 </td> 54 55 </tr> 56 </g:if> 35 57 36 58 <tr class="prop"> … … 49 71 50 72 </tr> 51 52 <g:if test="${entryInstance.productionReference}">53 <tr class="prop">54 <td valign="top" class="name">Production:</td>55 56 <td valign="top" class="value">57 ${fieldValue(bean:entryInstance, field:'productionReference')}58 </td>59 60 </tr>61 </g:if>62 73 63 74 <tr class="prop"> -
trunk/grails-app/views/taskDetailed/search.gsp
r836 r838 93 93 params="${filterParams}" /> 94 94 95 <custom:sortableColumnWithImg property="highestSeverity" 96 imgSrc="${resource(dir:'images/skin',file:'award_star_silver_3.png')}" 97 imgAlt="Severity" 98 imgTitle="Highest Severity" 99 params="${filterParams}" /> 100 95 101 <g:sortableColumn property="targetStartDate" title="Target Start Date" params="${filterParams}" /> 96 102 … … 125 131 <g:if test="${taskInstance.attentionFlag}"> 126 132 <img src="${resource(dir:'images/skin',file:'flag_red.png')}" alt="Flag" title="Attention Flag"/> 133 </g:if> 134 </td> 135 136 <td class="idColumn" onclick='window.location = "${request.getContextPath()}/taskDetailed/show/${taskInstance.id}"'> 137 <g:if test="${taskInstance.highestSeverity}"> 138 ${taskInstance.highestSeverity.code.encodeAsHTML()} 127 139 </g:if> 128 140 </td> … … 237 249 leadPerson.firstName, 238 250 taskGroup.name, 239 associatedAssets.name,251 highestSeverity.code, 240 252 primaryAsset.name, 241 253 taskStatus.name, … … 245 257 'leadPerson.firstName':[values: associatedPropertyValues.firstNameList], 246 258 'taskGroup.name':[values: associatedPropertyValues.taskGroupList], 247 ' associatedAssets.name':[values: associatedPropertyValues.assetList],259 'highestSeverity.code':[values: associatedPropertyValues.highestSeverityList], 248 260 'primaryAsset.name':[values: associatedPropertyValues.assetList], 249 261 'taskStatus.name':[values: associatedPropertyValues.taskStatusList], -
trunk/grails-app/views/taskDetailed/searchCalendar.gsp
r713 r838 122 122 leadPerson.firstName, 123 123 taskGroup.name, 124 associatedAssets.name,124 highestSeverity.code, 125 125 primaryAsset.name, 126 126 taskStatus.name, … … 130 130 'leadPerson.firstName':[values: associatedPropertyValues.firstNameList], 131 131 'taskGroup.name':[values: associatedPropertyValues.taskGroupList], 132 'associatedAssets.name':[values: associatedPropertyValues.assetList],133 132 'primaryAsset.name':[values: associatedPropertyValues.assetList], 133 'highestSeverity.code':[values: associatedPropertyValues.highestSeverityList], 134 134 'taskStatus.name':[values: associatedPropertyValues.taskStatusList], 135 135 'taskType.name':[values: associatedPropertyValues.taskTypeList],
Note: See TracChangeset
for help on using the changeset viewer.