Index: trunk/grails-app/controllers/EntryDetailedController.groovy
===================================================================
--- trunk/grails-app/controllers/EntryDetailedController.groovy	(revision 837)
+++ trunk/grails-app/controllers/EntryDetailedController.groovy	(revision 838)
@@ -67,4 +67,5 @@
     }
 
+    /// @todo: Refactor to taskService and include moving task to "In Progress" when Entry.duration is updated.
     def update = {
         def entryInstance = Entry.get( params.id )
@@ -74,4 +75,15 @@
                 entryInstance.properties = params
                 if(!entryInstance.hasErrors() && entryInstance.save(flush: true)) {
+                    // If PM Entry update task.highestSeverity
+                    if(entryInstance.entryType.id == 6) {
+                        def clist = []
+                        entryInstance.task.entries.each { entry ->
+                            if(entry.entryType.id == 6)
+                                clist << entry.highestSeverity
+                        }
+
+                        if(clist)
+                            entryInstance.task.highestSeverity = clist.sort{p1,p2 -> p2.id <=> p1.id}[0]
+                    }
                     flash.message = "Entry ${params.id} updated"
                     redirect(action:show,id:entryInstance.id)
Index: trunk/grails-app/controllers/TaskDetailedController.groovy
===================================================================
--- trunk/grails-app/controllers/TaskDetailedController.groovy	(revision 837)
+++ trunk/grails-app/controllers/TaskDetailedController.groovy	(revision 838)
@@ -185,4 +185,6 @@
         associatedPropertyValues.taskGroupList = TaskGroup.findAllByIsActive(true, [max:associatedPropertyMax, sort:'name'])
         associatedPropertyValues.assetList = Asset.findAllByIsActive(true, [max:associatedPropertyMax, sort:'name'])
+        def highestSeverityCodeQuery = 'select distinct cs.code from ConditionSeverity cs where cs.isActive = ? order by cs.code'
+        associatedPropertyValues.highestSeverityList = ConditionSeverity.executeQuery(highestSeverityCodeQuery, [true], [max:associatedPropertyMax])
         associatedPropertyValues.taskStatusList = TaskStatus.findAllByIsActive(true, [max:associatedPropertyMax, sort:'name'])
         associatedPropertyValues.taskTypeList = TaskType.findAllByIsActive(true, [max:associatedPropertyMax, sort:'name'])
@@ -342,4 +344,6 @@
         associatedPropertyValues.taskGroupList = TaskGroup.findAllByIsActive(true, [max:associatedPropertyMax, sort:'name'])
         associatedPropertyValues.assetList = Asset.findAllByIsActive(true, [max:associatedPropertyMax, sort:'name'])
+        def highestSeverityCodeQuery = 'select distinct cs.code from ConditionSeverity cs where cs.isActive = ? order by cs.code'
+        associatedPropertyValues.highestSeverityList = ConditionSeverity.executeQuery(highestSeverityCodeQuery, [true], [max:associatedPropertyMax])
         associatedPropertyValues.taskStatusList = TaskStatus.findAllByIsActive(true, [max:associatedPropertyMax, sort:'name'])
         associatedPropertyValues.taskTypeList = TaskType.findAllByIsActive(true, [max:associatedPropertyMax, sort:'name'])
Index: trunk/grails-app/services/TaskService.groovy
===================================================================
--- trunk/grails-app/services/TaskService.groovy	(revision 837)
+++ trunk/grails-app/services/TaskService.groovy	(revision 838)
@@ -353,7 +353,10 @@
                 return fail(code:"default.create.failure")
 
-            // If task status is "Not Started" and entry type is "Work Done" and time has been booked.
+            // If task status is "Not Started"
+            // and entry type is "Work Done" or "PM Entry"
+            // and time has been booked.
             // Then we create the started modification and set task status.
-            if(taskInstance.taskStatus.id == 1 && result.entryInstance.entryType.id == 3
+            if(taskInstance.taskStatus.id == 1
+                && (result.entryInstance.entryType.id == 3 || result.entryInstance.entryType.id == 6)
                 && (result.entryInstance.durationHour + result.entryInstance.durationMinute > 0)) {
 
@@ -368,8 +371,20 @@
                 // Set task status to "In Progress".
                 taskInstance.taskStatus = TaskStatus.read(2)
-
-                if(taskInstance.hasErrors() || !taskInstance.save())
-                    return fail(field:"task", code:"task.failedToSave")
-            }
+            }
+
+            // If PM Entry update task.highestSeverity
+            if(result.entryInstance.entryType.id == 6) {
+                def clist = []
+                taskInstance.entries.each { entry ->
+                    if(entry.entryType.id == 6)
+                        clist << entry.highestSeverity
+                }
+
+                if(clist)
+                    taskInstance.highestSeverity = clist.sort{p1,p2 -> p2.id <=> p1.id}[0]
+            }
+
+            if(taskInstance.hasErrors() || !taskInstance.save())
+                return fail(field:"task", code:"task.failedToSave")
 
             // Success.
Index: trunk/grails-app/views/entryDetailed/_create.gsp
===================================================================
--- trunk/grails-app/views/entryDetailed/_create.gsp	(revision 837)
+++ trunk/grails-app/views/entryDetailed/_create.gsp	(revision 838)
@@ -16,4 +16,38 @@
             <table>
                 <tbody>
+
+                    <g:if test="${entryInstance?.entryType?.id == 1}">
+                        <tr class="prop">
+                            <td valign="top" class="name">
+                                <label for="productionReference">Production:</label>
+                            </td>
+                            <td valign="top" class="value ${hasErrors(bean:entryInstance,field:'productionReference','errors')}">
+                                <g:select optionKey="id"
+                                                    from="${ProductionReference.findAllByIsActive(true)}"
+                                                    name="productionReference.id"
+                                                    value="${entryInstance.productionReference?.id}"
+                                                    noSelection="['null':'--None--']">
+                                </g:select>
+                                <custom:helpBalloon code="entry.productionReference.fault" iconSrc="${resource(plugin:'help-balloons', dir:'images', file:'balloon-icon.gif')}" />
+                            </td>
+                        </tr>
+                    </g:if>
+
+                    <g:if test="${entryInstance?.entryType?.id == 6}">
+                        <tr class="prop">
+                            <td valign="top" class="name">
+                                <label for="highestSeverity">Condition Severity:</label>
+                            </td>
+                            <td valign="top" class="value ${hasErrors(bean:entryInstance,field:'highestSeverity','errors')}">
+                                <g:select optionKey="id"
+                                                    from="${ConditionSeverity.findAllByIsActive(true)}"
+                                                    name="highestSeverity.id"
+                                                    value="${entryInstance.highestSeverity?.id}"
+                                                    noSelection="['null':/${g.message(code:'default.please.select.text')}/]" >
+                                </g:select>
+                                <custom:helpBalloon code="entry.comment.pm.entry" iconSrc="${resource(plugin:'help-balloons', dir:'images', file:'balloon-icon.gif')}" />
+                            </td>
+                        </tr>
+                    </g:if>
 
                     <tr class="prop">
@@ -48,21 +82,4 @@
                     </tr>
 
-                    <g:if test="${entryInstance?.entryType?.id == 1}">
-                        <tr class="prop">
-                            <td valign="top" class="name">
-                                <label for="productionReference">Production:</label>
-                            </td>
-                            <td valign="top" class="value ${hasErrors(bean:entryInstance,field:'productionReference','errors')}">
-                                <g:select optionKey="id"
-                                                    from="${ProductionReference.findAllByIsActive(true)}"
-                                                    name="productionReference.id"
-                                                    value="${entryInstance.productionReference?.id}"
-                                                    noSelection="['null':'--None--']">
-                                </g:select>
-                                <custom:helpBalloon code="entry.productionReference.fault" iconSrc="${resource(plugin:'help-balloons', dir:'images', file:'balloon-icon.gif')}" />
-                            </td>
-                        </tr>
-                    </g:if>
-
                     <g:if test="${entryInstance?.entryType?.id != 2}">
                         <tr class="prop">
Index: trunk/grails-app/views/entryDetailed/_list.gsp
===================================================================
--- trunk/grails-app/views/entryDetailed/_list.gsp	(revision 837)
+++ trunk/grails-app/views/entryDetailed/_list.gsp	(revision 838)
@@ -18,4 +18,11 @@
                 <thead>
                     <tr>
+                        <g:if test="${entryList[0]?.entryType?.id == 6}">
+                            <th>
+                                <img src="${resource(dir:'images/skin',file:'award_star_silver_3.png')}"
+                                        alt="Severity"
+                                        title="Highest Severity"  />
+                            </th>
+                        </g:if>
                         <th>Comment</th>
                         <th>Date Done</th>
@@ -28,4 +35,10 @@
                     <g:each in="${entryList}" status="i" var="entry">
                             <tr class="${(i % 2) == 0 ? 'clickableOdd' : 'clickableEven'}">
+
+                                <g:if test="${entryList[0]?.entryType?.id == 6}">
+                                    <td onclick='window.location = "${request.getContextPath()}/entryDetailed/edit/${entry.id}"'>
+                                        ${entry.highestSeverity.code.encodeAsHTML()}
+                                    </td>
+                                </g:if>
 
                                 <td width="65%" onclick='window.location = "${request.getContextPath()}/entryDetailed/edit/${entry.id}"'>
Index: trunk/grails-app/views/entryDetailed/edit.gsp
===================================================================
--- trunk/grails-app/views/entryDetailed/edit.gsp	(revision 837)
+++ trunk/grails-app/views/entryDetailed/edit.gsp	(revision 838)
@@ -37,4 +37,38 @@
                                 </td>
                             </tr>
+
+                            <g:if test="${entryInstance?.entryType?.id == 1}">
+                                <tr class="prop">
+                                    <td valign="top" class="name">
+                                        <label for="productionReference">Production:</label>
+                                    </td>
+                                    <td valign="top" class="value ${hasErrors(bean:entryInstance,field:'productionReference','errors')}">
+                                        <g:select optionKey="id"
+                                                            from="${ProductionReference.findAllByIsActive(true)}"
+                                                            name="productionReference.id"
+                                                            value="${entryInstance.productionReference?.id}"
+                                                            noSelection="['null':'--None--']">
+                                        </g:select>
+                                        <g:helpBalloon code="entry.productionReference.fault" />
+                                    </td>
+                                </tr>
+                            </g:if>
+
+                            <g:if test="${entryInstance?.entryType?.id == 6}">
+                                <tr class="prop">
+                                    <td valign="top" class="name">
+                                        <label for="highestSeverity">Condition Severity:</label>
+                                    </td>
+                                    <td valign="top" class="value ${hasErrors(bean:entryInstance,field:'highestSeverity','errors')}">
+                                        <g:select optionKey="id"
+                                                            from="${ConditionSeverity.findAllByIsActive(true)}"
+                                                            name="highestSeverity.id"
+                                                            value="${entryInstance.highestSeverity?.id}"
+                                                            noSelection="['null':/${g.message(code:'default.please.select.text')}/]" >
+                                        </g:select>
+                                        <custom:helpBalloon code="entry.comment.pm.entry" iconSrc="${resource(plugin:'help-balloons', dir:'images', file:'balloon-icon.gif')}" />
+                                    </td>
+                                </tr>
+                            </g:if>
                         
                             <tr class="prop">
@@ -55,21 +89,4 @@
                                 </td>
                             </tr>
-
-                            <g:if test="${entryInstance?.entryType?.id == 1}">
-                                <tr class="prop">
-                                    <td valign="top" class="name">
-                                        <label for="productionReference">Production:</label>
-                                    </td>
-                                    <td valign="top" class="value ${hasErrors(bean:entryInstance,field:'productionReference','errors')}">
-                                        <g:select optionKey="id"
-                                                            from="${ProductionReference.findAllByIsActive(true)}"
-                                                            name="productionReference.id"
-                                                            value="${entryInstance.productionReference?.id}"
-                                                            noSelection="['null':'--None--']">
-                                        </g:select>
-                                        <g:helpBalloon code="entry.productionReference.fault" />
-                                    </td>
-                                </tr>
-                            </g:if>
 
                             <g:if test="${entryInstance?.entryType?.id != 2}">
Index: trunk/grails-app/views/entryDetailed/show.gsp
===================================================================
--- trunk/grails-app/views/entryDetailed/show.gsp	(revision 837)
+++ trunk/grails-app/views/entryDetailed/show.gsp	(revision 838)
@@ -33,4 +33,26 @@
                             
                         </tr>
+
+                        <g:if test="${entryInstance.productionReference}">
+                            <tr class="prop">
+                                <td valign="top" class="name">Production:</td>
+
+                                <td valign="top" class="value">
+                                    ${fieldValue(bean:entryInstance, field:'productionReference')}
+                                </td>
+
+                            </tr>
+                        </g:if>
+
+                        <g:if test="${entryInstance.highestSeverity}">
+                            <tr class="prop">
+                                <td valign="top" class="name">Condition Severity:</td>
+
+                                <td valign="top" class="value">
+                                    ${fieldValue(bean:entryInstance, field:'highestSeverity')}
+                                </td>
+
+                            </tr>
+                        </g:if>
                     
                         <tr class="prop">
@@ -49,15 +71,4 @@
                             
                         </tr>
-
-                        <g:if test="${entryInstance.productionReference}">
-                            <tr class="prop">
-                                <td valign="top" class="name">Production:</td>
-
-                                <td valign="top" class="value">
-                                    ${fieldValue(bean:entryInstance, field:'productionReference')}
-                                </td>
-
-                            </tr>
-                        </g:if>
                     
                         <tr class="prop">
Index: trunk/grails-app/views/taskDetailed/search.gsp
===================================================================
--- trunk/grails-app/views/taskDetailed/search.gsp	(revision 837)
+++ trunk/grails-app/views/taskDetailed/search.gsp	(revision 838)
@@ -93,4 +93,10 @@
                                                                                                 params="${filterParams}" />
 
+                                <custom:sortableColumnWithImg property="highestSeverity"
+                                                                                                imgSrc="${resource(dir:'images/skin',file:'award_star_silver_3.png')}"
+                                                                                                imgAlt="Severity"
+                                                                                                imgTitle="Highest Severity"
+                                                                                                params="${filterParams}" />
+
                                 <g:sortableColumn property="targetStartDate" title="Target Start Date" params="${filterParams}" />
 
@@ -125,4 +131,10 @@
                                     <g:if test="${taskInstance.attentionFlag}">
                                         <img  src="${resource(dir:'images/skin',file:'flag_red.png')}" alt="Flag" title="Attention Flag"/>
+                                    </g:if>
+                                </td>
+
+                                <td class="idColumn" onclick='window.location = "${request.getContextPath()}/taskDetailed/show/${taskInstance.id}"'>
+                                    <g:if test="${taskInstance.highestSeverity}">
+                                        ${taskInstance.highestSeverity.code.encodeAsHTML()}
                                     </g:if>
                                 </td>
@@ -237,5 +249,5 @@
                                                                                 leadPerson.firstName,
                                                                                 taskGroup.name,
-                                                                                associatedAssets.name,
+                                                                                highestSeverity.code,
                                                                                 primaryAsset.name,
                                                                                 taskStatus.name,
@@ -245,5 +257,5 @@
                                                                                 'leadPerson.firstName':[values: associatedPropertyValues.firstNameList],
                                                                                 'taskGroup.name':[values: associatedPropertyValues.taskGroupList],
-                                                                                'associatedAssets.name':[values: associatedPropertyValues.assetList],
+                                                                                'highestSeverity.code':[values: associatedPropertyValues.highestSeverityList],
                                                                                 'primaryAsset.name':[values: associatedPropertyValues.assetList],
                                                                                 'taskStatus.name':[values: associatedPropertyValues.taskStatusList],
Index: trunk/grails-app/views/taskDetailed/searchCalendar.gsp
===================================================================
--- trunk/grails-app/views/taskDetailed/searchCalendar.gsp	(revision 837)
+++ trunk/grails-app/views/taskDetailed/searchCalendar.gsp	(revision 838)
@@ -122,5 +122,5 @@
                                                                                 leadPerson.firstName,
                                                                                 taskGroup.name,
-                                                                                associatedAssets.name,
+                                                                                highestSeverity.code,
                                                                                 primaryAsset.name,
                                                                                 taskStatus.name,
@@ -130,6 +130,6 @@
                                                                                 'leadPerson.firstName':[values: associatedPropertyValues.firstNameList],
                                                                                 'taskGroup.name':[values: associatedPropertyValues.taskGroupList],
-                                                                                'associatedAssets.name':[values: associatedPropertyValues.assetList],
                                                                                 'primaryAsset.name':[values: associatedPropertyValues.assetList],
+                                                                                'highestSeverity.code':[values: associatedPropertyValues.highestSeverityList],
                                                                                 'taskStatus.name':[values: associatedPropertyValues.taskStatusList],
                                                                                 'taskType.name':[values: associatedPropertyValues.taskTypeList],
