Author: ashish
Date: Fri Sep 17 06:22:20 2010
New Revision: 997990
URL:
http://svn.apache.org/viewvc?rev=997990&view=revLog:
Bug fix.
Purchase Order creation was not working from Quote if Parent Organization is being associated with the facility and the value passed from Quote is for Child Organisation. For this I had put a check on PartyRelationship, so that it will also check the relationship between parent & child organisation. If it exists then it will fetch companyId from there.
Modified:
ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/ShipSettings.groovy
Modified: ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/ShipSettings.groovy
URL:
http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/ShipSettings.groovy?rev=997990&r1=997989&r2=997990&view=diff==============================================================================
--- ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/ShipSettings.groovy (original)
+++ ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/ShipSettings.groovy Fri Sep 17 06:22:20 2010
@@ -22,6 +22,9 @@ import org.ofbiz.base.util.*;
import org.ofbiz.order.shoppingcart.*;
import org.ofbiz.party.contact.*;
import org.ofbiz.product.catalog.*;
+import org.ofbiz.base.util.UtilValidate;
+import org.ofbiz.entity.condition.EntityCondition;
+import org.ofbiz.entity.util.EntityUtil;
import javolution.util.FastMap;
import javolution.util.FastList;
@@ -83,6 +86,15 @@ if ("SALES_ORDER".equals(cart.getOrderTy
if (companyId) {
facilityMaps = FastList.newInstance();
facilities = delegator.findByAndCache("Facility", [ownerPartyId : companyId]);
+
+ // if facilites is null then check the PartyRelationship where there is a relationship set for Parent & Child organization. Then also fetch the value of companyId from there.
+ if (UtilValidate.isEmpty(facilities)) {
+ partyRelationship = EntityUtil.getFirst(delegator.findList("PartyRelationship", EntityCondition.makeCondition(["roleTypeIdFrom": "PARENT_ORGANIZATION", "partyIdTo": companyId]), null, null, null, false));
+ if (UtilValidate.isNotEmpty(partyRelationship)) {
+ companyId = partyRelationship.partyIdFrom;
+ facilities = delegator.findByAndCache("Facility", [ownerPartyId : companyId]);
+ }
+ }
facilities.each { facility ->
facilityMap = FastMap.newInstance();
facilityContactMechValueMaps = ContactMechWorker.getFacilityContactMechValueMaps(delegator, facility.facilityId, false, null);