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

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

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

jacopoc
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="<@ofbizUrl>upsEmailReturnLabelReturn</@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="<@ofbizUrl>upsEmailReturnLabelReturn</@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>