Author: bibryam
Date: Thu Feb 18 11:08:35 2010
New Revision: 911328

URL: http://svn.apache.org/viewvc?rev=911328&view=rev
Log:
Fixed NPE in Fixed asset geo location screen.
Commented out not used code and removed unnecessary isEmpty checks.

Modified:
    
ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/fixedasset/FixedAssetGeoLocation.groovy
    ofbiz/trunk/applications/accounting/widget/FixedAssetScreens.xml

Modified: 
ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/fixedasset/FixedAssetGeoLocation.groovy
URL: 
http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/fixedasset/FixedAssetGeoLocation.groovy?rev=911328&r1=911327&r2=911328&view=diff
==============================================================================
--- 
ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/fixedasset/FixedAssetGeoLocation.groovy
 (original)
+++ 
ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/fixedasset/FixedAssetGeoLocation.groovy
 Thu Feb 18 11:08:35 2010
@@ -21,25 +21,25 @@
 import org.ofbiz.common.geo.*;
 import org.ofbiz.entity.*;
 
-fixedAssetId = parameters.fixedAssetId;
-fa = delegator.findByPrimaryKey("FixedAsset", UtilMisc.toMap("fixedAssetId", 
fixedAssetId));
 uiLabelMap = UtilProperties.getResourceBundleMap("AccountingUiLabels", locale);
 
-if (fixedAssetId) {
+if (fixedAsset) {
     latestGeoPoint = GeoWorker.findLatestGeoPoint(delegator, 
"FixedAssetAndGeoPoint", "fixedAssetId", fixedAssetId, null, null);
-    context.latestGeoPoint = latestGeoPoint;
-
-    List geoCenter = UtilMisc.toList(UtilMisc.toMap("lat", 
latestGeoPoint.latitude, "lon", latestGeoPoint.longitude, "zoom", "13"));
-
-    if (UtilValidate.isNotEmpty(latestGeoPoint) && 
latestGeoPoint.containsKey("latitude") && 
latestGeoPoint.containsKey("longitude")) {
-        List geoPoints = UtilMisc.toList(UtilMisc.toMap("lat", 
latestGeoPoint.latitude, "lon", latestGeoPoint.longitude, "fixedAssetId", 
fixedAssetId,
-                "link", UtilMisc.toMap("url", "EditFixedAsset?fixedAssetId="+ 
fixedAssetId, "label", uiLabelMap.AccountingFixedAsset + " " + 
fa.fixedAssetName)));
-
-        Map geoChart = UtilMisc.toMap("width", "500", "height", "450", 
"controlUI" , "small", "dataSourceId", latestGeoPoint.dataSourceId, "points", 
geoPoints);
-        context.geoChart = geoChart;
-    }
-    if (latestGeoPoint && latestGeoPoint.elevationUomId) {
-        elevationUom = delegator.findOne("Uom", [uomId : 
latestGeoPoint.elevationUomId], false);
-        context.elevationUomAbbr = elevationUom.abbreviation;
+    if (latestGeoPoint) {
+        context.latestGeoPoint = latestGeoPoint;
+        
+        //List geoCenter = UtilMisc.toList(UtilMisc.toMap("lat", 
latestGeoPoint.latitude, "lon", latestGeoPoint.longitude, "zoom", "13"));
+        
+        if (latestGeoPoint.containsKey("latitude") && 
latestGeoPoint.containsKey("longitude")) {
+            List geoPoints = UtilMisc.toList(UtilMisc.toMap("lat", 
latestGeoPoint.latitude, "lon", latestGeoPoint.longitude, "fixedAssetId", 
fixedAssetId,
+                            "link", UtilMisc.toMap("url", 
"EditFixedAsset?fixedAssetId="+ fixedAssetId, "label", 
uiLabelMap.AccountingFixedAsset + " " + fixedAsset.fixedAssetName)));
+            
+            Map geoChart = UtilMisc.toMap("width", "500", "height", "450", 
"controlUI" , "small", "dataSourceId", latestGeoPoint.dataSourceId, "points", 
geoPoints);
+            context.geoChart = geoChart;
+        }
+        if (latestGeoPoint.elevationUomId) {
+            elevationUom = delegator.findOne("Uom", [uomId : 
latestGeoPoint.elevationUomId], false);
+            context.elevationUomAbbr = elevationUom.abbreviation;
+        }
     }
 }
\ No newline at end of file

Modified: ofbiz/trunk/applications/accounting/widget/FixedAssetScreens.xml
URL: 
http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/widget/FixedAssetScreens.xml?rev=911328&r1=911327&r2=911328&view=diff
==============================================================================
--- ofbiz/trunk/applications/accounting/widget/FixedAssetScreens.xml (original)
+++ ofbiz/trunk/applications/accounting/widget/FixedAssetScreens.xml Thu Feb 18 
11:08:35 2010
@@ -577,6 +577,7 @@
             <actions>
                 <set field="titleProperty" 
value="PageTitleFixedAssetGeoLocation"/>
                 <set field="tabButtonItem" value="FixedAssetGeoLocation"/>
+                <set field="fixedAssetId" 
from-field="parameters.fixedAssetId"/>
                 <entity-one value-field="fixedAsset" entity-name="FixedAsset"/>
                 <script 
location="component://accounting/webapp/accounting/WEB-INF/actions/fixedasset/FixedAssetGeoLocation.groovy"/>
             </actions>


Reply via email to