svn commit: r664377 - in /ofbiz/trunk/specialpurpose/assetmaint/webapp/assetmaint/WEB-INF: actions/workeffort/EditWorkEfforts.bsh controller.xml

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

svn commit: r664377 - in /ofbiz/trunk/specialpurpose/assetmaint/webapp/assetmaint/WEB-INF: actions/workeffort/EditWorkEfforts.bsh controller.xml

adrianc
Author: adrianc
Date: Sat Jun  7 13:03:44 2008
New Revision: 664377

URL: http://svn.apache.org/viewvc?rev=664377&view=rev
Log:
More UI work in the Asset Maintenance component.

Modified:
    ofbiz/trunk/specialpurpose/assetmaint/webapp/assetmaint/WEB-INF/actions/workeffort/EditWorkEfforts.bsh
    ofbiz/trunk/specialpurpose/assetmaint/webapp/assetmaint/WEB-INF/controller.xml

Modified: ofbiz/trunk/specialpurpose/assetmaint/webapp/assetmaint/WEB-INF/actions/workeffort/EditWorkEfforts.bsh
URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/assetmaint/webapp/assetmaint/WEB-INF/actions/workeffort/EditWorkEfforts.bsh?rev=664377&r1=664376&r2=664377&view=diff
==============================================================================
--- ofbiz/trunk/specialpurpose/assetmaint/webapp/assetmaint/WEB-INF/actions/workeffort/EditWorkEfforts.bsh (original)
+++ ofbiz/trunk/specialpurpose/assetmaint/webapp/assetmaint/WEB-INF/actions/workeffort/EditWorkEfforts.bsh Sat Jun  7 13:03:44 2008
@@ -24,7 +24,6 @@
 import org.ofbiz.entity.condition.*;
 import org.ofbiz.entity.util.*;
 
-
 maintHistSeqId = context.get("maintHistSeqId");
 fixedAssetId = context.get("fixedAssetId");
 workEffortId = context.get("workEffortId");
@@ -32,20 +31,15 @@
 if (maintHistSeqId == null) {
     maintHistSeqId = parameters.get("maintHistSeqId");
 }
-if (fixedAssetId == null) {
-    fixedAssetId = parameters.get("fixedAssetId");
-}
-
 if (maintHistSeqId == null) {
     maintHistSeqId = request.getParameter("maintHistSeqId");
 }
 if (fixedAssetId == null) {
+    fixedAssetId = parameters.get("fixedAssetId");
+}
+if (fixedAssetId == null) {
     fixedAssetId = request.getParameter("fixedAssetId");
 }
-
-// Following two cases are just to cover in forseen situation. In normal situation these will never execute.
-// If request is coming from EditWorkEffort or EditWorkEffortAndAssoc then we'll not have fixedAssetId and maintSeqId
-
 if (workEffortId == null) {
     workEffortId = parameters.get("workEffortId");
 }
@@ -53,34 +47,32 @@
     workEffortId = request.getParameter("workEffortId");
 }
 
-
 fixedAssetMaint = null;
 workEffort = null;
 fixedAsset = null;
 
-//Prefer to get workEffortId from FixedAssetMaint.
-if (maintHistSeqId !=null && fixedAssetId !=null) {
-    fixedAssetMaint = delegator.findByPrimaryKey("FixedAssetMaint", UtilMisc.toMap("fixedAssetId",fixedAssetId ,"maintHistSeqId",maintHistSeqId));
-    if (fixedAssetMaint != null) {
-        workEffortId = fixedAssetMaint.get("scheduleWorkEffortId");
+if (workEffortId != null) {
+    workEffort = delegator.findByPrimaryKey("WorkEffort", UtilMisc.toMap("workEffortId", workEffortId));
+    if (workEffort != null) {
+        fixedAssetId = workEffort.get("fixedAssetId");
     }
 }
 
-if (workEffortId != null) {
-    workEffort = delegator.findByPrimaryKey("WorkEffort", UtilMisc.toMap("workEffortId",workEffortId));
-    if (fixedAssetId == null && workEffort != null) {
-        fixedAssetId = workEffort.get("fixedAssetId");
+if (workEffortId != null && fixedAssetId != null) {
+    fixedAssetMaint = EntityUtil.getFirst(delegator.findByAnd("FixedAssetMaint", UtilMisc.toMap("fixedAssetId", fixedAssetId , "scheduleWorkEffortId", workEffortId)));
+    if (fixedAssetMaint != null) {
+        maintHistSeqId = fixedAssetMaint.get("maintHistSeqId");
     }
 }
 
 if (fixedAssetId != null) {
-    fixedAsset = delegator.findByPrimaryKey("FixedAsset", UtilMisc.toMap("fixedAssetId",fixedAssetId));
+    fixedAsset = delegator.findByPrimaryKey("FixedAsset", UtilMisc.toMap("fixedAssetId", fixedAssetId));
 }
-context.put("fixedAssetMaint",fixedAssetMaint);      
-context.put("workEffort",workEffort);      
-context.put("fixedAsset",fixedAsset);  
-
-context.put("maintHistSeqId",maintHistSeqId);      
-context.put("fixedAssetId",fixedAssetId);      
-context.put("workEffortId",workEffortId);
-context.put("workEffortIdFrom",workEffortId);
+
+context.put("fixedAssetMaint", fixedAssetMaint);      
+context.put("workEffort", workEffort);      
+context.put("fixedAsset", fixedAsset);  
+context.put("maintHistSeqId", maintHistSeqId);      
+context.put("fixedAssetId", fixedAssetId);      
+context.put("workEffortId", workEffortId);
+context.put("workEffortIdFrom", workEffortId);

Modified: ofbiz/trunk/specialpurpose/assetmaint/webapp/assetmaint/WEB-INF/controller.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/assetmaint/webapp/assetmaint/WEB-INF/controller.xml?rev=664377&r1=664376&r2=664377&view=diff
==============================================================================
--- ofbiz/trunk/specialpurpose/assetmaint/webapp/assetmaint/WEB-INF/controller.xml (original)
+++ ofbiz/trunk/specialpurpose/assetmaint/webapp/assetmaint/WEB-INF/controller.xml Sat Jun  7 13:03:44 2008
@@ -185,6 +185,6 @@
     <view-map name="LookupWorkEffortShort" type="screen" page="component://workeffort/widget/LookupScreens.xml#LookupWorkEffortShort"/>
 
     <view-map name="EditWorkEffort" type="screen" page="component://assetmaint/widget/AssetmaintScreens.xml#EditFixedAssetMaint"/>
-    <view-map name="WorkEffortSummary" type="screen" page="component://assetmaint/widget/AssetmaintScreens.xml#EditFixedAssetMaint"/>
+    <view-map name="WorkEffortSummary" type="screen" page="component://assetmaint/widget/AssetmaintScreens.xml#EditWorkEfforts"/>
     <!-- end of view mappings -->
 </site-conf>