Skip to content

Commit ec07889

Browse files
BroadleafCommerce/QA#1437 - Add a system property to selectively qualify a fulfillment group based on all of the items in the order instead of just the items within that fulfillment group
1 parent 0eec7d6 commit ec07889

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

core/broadleaf-framework/src/main/java/org/broadleafcommerce/core/offer/service/processor/FulfillmentGroupOfferProcessorImpl.java

+19
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
import org.broadleafcommerce.common.currency.util.BroadleafCurrencyUtils;
2727
import org.broadleafcommerce.common.money.BankersRounding;
2828
import org.broadleafcommerce.common.money.Money;
29+
import org.broadleafcommerce.common.util.BLCSystemProperty;
2930
import org.broadleafcommerce.core.offer.domain.Offer;
3031
import org.broadleafcommerce.core.offer.domain.OfferOfferRuleXref;
3132
import org.broadleafcommerce.core.offer.domain.OfferRule;
@@ -81,14 +82,32 @@ public void filterFulfillmentGroupLevelOffer(PromotableOrder order, List<Promota
8182

8283
// Item Qualification - new for 1.5!
8384
if (fgLevelQualification) {
85+
8486
CandidatePromotionItems candidates = couldOfferApplyToOrderItems(offer, fulfillmentGroup.getDiscountableOrderItems());
87+
// couldn't qualify based on the items within this fulfillment group, jump out and now try to validate based
88+
// on all the items in the order across all fulfillment groups (not the default behavior)
89+
if (!candidates.isMatchedQualifier() && getQualifyGroupAcrossAllOrderItems(fulfillmentGroup)) {
90+
candidates = couldOfferApplyToOrderItems(offer, order.getAllOrderItems());
91+
}
92+
8593
if (candidates.isMatchedQualifier()) {
8694
PromotableCandidateFulfillmentGroupOffer candidateOffer = createCandidateFulfillmentGroupOffer(offer, qualifiedFGOffers, fulfillmentGroup);
8795
candidateOffer.getCandidateQualifiersMap().putAll(candidates.getCandidateQualifiersMap());
8896
}
8997
}
9098
}
9199
}
100+
101+
/**
102+
* Whether or not items across the entire order should be considered in item-level qualifiers for the given fulfillment
103+
* group. Default behavior is to use only the items within the fulfillment group for the item-level qualifiers.
104+
*
105+
* @param fg the fulfillment group that we are attempting to apply item-level qualifiers to
106+
* @return
107+
*/
108+
protected boolean getQualifyGroupAcrossAllOrderItems(PromotableFulfillmentGroup fg) {
109+
return BLCSystemProperty.resolveBooleanSystemProperty("promotion.fulfillmentgroup.qualifyAcrossAllOrderItems", false);
110+
}
92111

93112
@Override
94113
public void calculateFulfillmentGroupTotal(PromotableOrder order) {

0 commit comments

Comments
 (0)