You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by ja...@apache.org on 2009/09/16 10:07:03 UTC

svn commit: r815656 - /ofbiz/trunk/applications/order/webapp/ordermgr/return/returnLinks.ftl

Author: jacopoc
Date: Wed Sep 16 08:07:02 2009
New Revision: 815656

URL: http://svn.apache.org/viewvc?rev=815656&view=rev
Log:
Quick fixes to prevent NPE (but the code should be reviewed/improved here).

Modified:
    ofbiz/trunk/applications/order/webapp/ordermgr/return/returnLinks.ftl

Modified: ofbiz/trunk/applications/order/webapp/ordermgr/return/returnLinks.ftl
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/webapp/ordermgr/return/returnLinks.ftl?rev=815656&r1=815655&r2=815656&view=diff
==============================================================================
--- ofbiz/trunk/applications/order/webapp/ordermgr/return/returnLinks.ftl (original)
+++ ofbiz/trunk/applications/order/webapp/ordermgr/return/returnLinks.ftl Wed Sep 16 08:07:02 2009
@@ -42,15 +42,21 @@
             <#assign orderId = (Static["org.ofbiz.entity.util.EntityUtil"].getFirst(returnItems)).getString("orderId")/>
             <#assign shipGroupAssoc = Static["org.ofbiz.entity.util.EntityUtil"].getFirst(delegator.findByAnd("OrderItemShipGroupAssoc", {"orderId" : orderId}))/>
             <#assign shipGroup = delegator.findOne("OrderItemShipGroup", {"orderId" : orderId, "shipGroupSeqId" : shipGroupAssoc.shipGroupSeqId}, false)>
-            <#assign shipGroupShipment = Static["org.ofbiz.entity.util.EntityUtil"].getFirst(delegator.findByAnd("Shipment", {"primaryOrderId" : shipGroup.orderId, "primaryShipGroupSeqId" : shipGroup.shipGroupSeqId}))/>
-            <#assign shipmentRouteSegment = Static["org.ofbiz.entity.util.EntityUtil"].getFirst(delegator.findByAnd("ShipmentRouteSegment", {"shipmentId" : shipGroupShipment.shipmentId}))>
-            <#if "UPS" == shipmentRouteSegment.carrierPartyId>
-              <a href="javascript:document.upsEmailReturnLabel.submit();" class="buttontext">${uiLabelMap.ProductEmailReturnShippingLabelUPS}</a>
-              <form name="upsEmailReturnLabel" method="post" action="<@o...@ofbizUrl>">
-                <input type="hidden" name="returnId" value="${returnId}"/>
-                <input type="hidden" name="shipmentId" value="${shipGroupShipment.shipmentId}"/>
-                <input type="hidden" name="shipmentRouteSegmentId" value=${shipmentRouteSegment.shipmentRouteSegmentId}>
-              </form>
+            <#if shipGroup?exists>
+              <#assign shipGroupShipment = Static["org.ofbiz.entity.util.EntityUtil"].getFirst(delegator.findByAnd("Shipment", {"primaryOrderId" : shipGroup.orderId, "primaryShipGroupSeqId" : shipGroup.shipGroupSeqId}))/>
+              <#if shipGroupShipment?exists>
+                <#assign shipmentRouteSegment = Static["org.ofbiz.entity.util.EntityUtil"].getFirst(delegator.findByAnd("ShipmentRouteSegment", {"shipmentId" : shipGroupShipment.shipmentId}))>
+                <#if shipmentRouteSegment?exists>
+                  <#if "UPS" == shipmentRouteSegment.carrierPartyId>
+                    <a href="javascript:document.upsEmailReturnLabel.submit();" class="buttontext">${uiLabelMap.ProductEmailReturnShippingLabelUPS}</a>
+                    <form name="upsEmailReturnLabel" method="post" action="<@o...@ofbizUrl>">
+                      <input type="hidden" name="returnId" value="${returnId}"/>
+                      <input type="hidden" name="shipmentId" value="${shipGroupShipment.shipmentId}"/>
+                      <input type="hidden" name="shipmentRouteSegmentId" value=${shipmentRouteSegment.shipmentRouteSegmentId}>
+                    </form>
+                  </#if>
+                </#if>
+              </#if>
             </#if>
           </#if>
         </#if>