[email protected] wrote: > Author: jleroux > Date: Fri Mar 12 08:27:42 2010 > New Revision: 922177 > > URL: http://svn.apache.org/viewvc?rev=922177&view=rev > Log: > A slightly modified patch from Geir Ove Grønmo "Calculation of promotions and > price rules should support multi-level GROUP_ROLLUP" > (https://issues.apache.org/jira/browse/OFBIZ-3440) - OFBIZ-3440 > > The calculation of product prices given promotion and price rules do not > currently take multi-level GROUP_ROLLUP party relations into account. > The calculation of price rules consider two levels of GROUP_ROLLUP only, > while the calculation of promotions take just a single level of GROUP_ROLLUP > into account. > The attached patch will calculate price rules and promotions for > GROUP_ROLLUPs for an arbitrary number of GROUP_ROLLUPs. This is essential in > the situation where there are hierarchies of parties. > > Modified: > > ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/product/ProductPromoWorker.java > > ofbiz/trunk/applications/product/src/org/ofbiz/product/price/PriceServices.java > > + private static int checkConditionPartyHierarchy(Delegator delegator, > Timestamp nowTimestamp, String groupPartyId, String partyId) throws > GenericEntityException{ > + List<GenericValue> partyRelationshipList = > delegator.findByAndCache("PartyRelationship", UtilMisc.toMap("partyIdTo", > partyId, "partyRelationshipTypeId", "GROUP_ROLLUP")); > + partyRelationshipList = > EntityUtil.filterByDate(partyRelationshipList, nowTimestamp, null, null, > true); > + for (GenericValue genericValue : partyRelationshipList) { > + String partyIdFrom = (String)genericValue.get("partyIdFrom"); > + if (partyIdFrom.equals(groupPartyId)) { > + return 0; > + } > + if (0 == checkConditionPartyHierarchy(delegator, nowTimestamp, > groupPartyId, partyIdFrom)) { > + return 0; > + } > + } > + > + return 1; > + } > +
It would be nice to have this method in the party component. My guy wants to say there might already been a method to do this.
