Author: mor
Date: Thu Jun 4 08:45:54 2009 New Revision: 781685 URL: http://svn.apache.org/viewvc?rev=781685&view=rev Log: Fix: NPE occurred while printing pick sheet from Order Detail Page when the order is created using offline payment method. Applied patch from Chirag Manocha, as reported by Ratnesh Upadhyay in jira OFBIZ-2563 (https://issues.apache.org/jira/browse/OFBIZ-2563) Modified: ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/shipment/PrintPickSheets.groovy ofbiz/trunk/applications/product/webapp/facility/facility/PrintPickSheets.fo.ftl Modified: ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/shipment/PrintPickSheets.groovy URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/shipment/PrintPickSheets.groovy?rev=781685&r1=781684&r2=781685&view=diff ============================================================================== --- ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/shipment/PrintPickSheets.groovy (original) +++ ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/shipment/PrintPickSheets.groovy Thu Jun 4 08:45:54 2009 @@ -58,8 +58,12 @@ orderId = orderHeader.orderId; orderMap.orderId = orderId; orderMap.orderDate = orderHeader.orderDate; - billingContactMechId = EntityUtil.getFirst(delegator.findByAnd("OrderContactMech", [orderId : orderId, contactMechPurposeTypeId : "BILLING_LOCATION"])).contactMechId; - billingAddress = delegator.findOne("PostalAddress", [contactMechId : billingContactMechId], false); + billingOrderContactMechs = []; + billingOrderContactMechs = delegator.findByAnd("OrderContactMech", [orderId : orderId, contactMechPurposeTypeId : "BILLING_LOCATION"]); + if (billingOrderContactMechs.size() > 0) { + billingContactMechId = EntityUtil.getFirst(billingOrderContactMechs).contactMechId; + billingAddress = delegator.findOne("PostalAddress", [contactMechId : billingContactMechId], false); + } shippingContactMechId = EntityUtil.getFirst(delegator.findByAnd("OrderContactMech", [orderId : orderId, contactMechPurposeTypeId : "SHIPPING_LOCATION"])).contactMechId; shippingAddress = delegator.findOne("PostalAddress", [contactMechId : shippingContactMechId], false); orderItemShipGroups.each { orderItemShipGroup -> @@ -70,7 +74,9 @@ orderMap.carrierPartyId = orderItemShipGroup.carrierPartyId; } orderMap.shippingAddress = shippingAddress; - orderMap.billingAddress = billingAddress; + if (billingOrderContactMechs.size() > 0) { + orderMap.billingAddress = billingAddress; + } orderInfoMap = [:]; orderInfoMap.(orderHeader.orderId) = orderMap; } Modified: ofbiz/trunk/applications/product/webapp/facility/facility/PrintPickSheets.fo.ftl URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/webapp/facility/facility/PrintPickSheets.fo.ftl?rev=781685&r1=781684&r2=781685&view=diff ============================================================================== --- ofbiz/trunk/applications/product/webapp/facility/facility/PrintPickSheets.fo.ftl (original) +++ ofbiz/trunk/applications/product/webapp/facility/facility/PrintPickSheets.fo.ftl Thu Jun 4 08:45:54 2009 @@ -37,7 +37,9 @@ <#if orderInfo.get("${orderId}")?exists> <#assign orderDetail = orderInfo.get("${orderId}")> <#assign orderDate = orderDetail.orderDate> - <#assign billAddress = orderDetail.billingAddress> + <#if orderDetail.billingAddress?exists> + <#assign billAddress = orderDetail.billingAddress> + </#if> <#assign shipAddress = orderDetail.shippingAddress> <#assign shipmentMethodType = orderDetail.shipmentMethodType> <#assign carrierPartyId = orderDetail.carrierPartyId> @@ -84,13 +86,15 @@ <fo:table-body> <fo:table-row> <fo:table-cell> - <fo:block font-weight="bold">${uiLabelMap.OrderOrderBillToParty}:</fo:block> - <fo:block> ${billAddress.toName?if_exists}</fo:block> - <fo:block> ${billAddress.address1?if_exists}</fo:block> - <fo:block> ${billAddress.city?if_exists}</fo:block> - <fo:block> ${billAddress.countryGeoId?if_exists}</fo:block> - <fo:block> ${billAddress.postalCode?if_exists}</fo:block> - <fo:block> ${billAddress.stateProvinceGeoId?if_exists}</fo:block> + <#if billAddress?has_content> + <fo:block font-weight="bold">${uiLabelMap.OrderOrderBillToParty}:</fo:block> + <fo:block> ${billAddress.toName?if_exists}</fo:block> + <fo:block> ${billAddress.address1?if_exists}</fo:block> + <fo:block> ${billAddress.city?if_exists}</fo:block> + <fo:block> ${billAddress.countryGeoId?if_exists}</fo:block> + <fo:block> ${billAddress.postalCode?if_exists}</fo:block> + <fo:block> ${billAddress.stateProvinceGeoId?if_exists}</fo:block> + </#if> </fo:table-cell> </fo:table-row> </fo:table-body> |
Free forum by Nabble | Edit this page |