Hi Pierre,

Thanks for noticing. On looking into it further I have found that
promotext.properties file is used only in
ProductPromoWorker.makeAutoDescription() method and was implemented way
back when UI Labels were managed in *.properties files. So, in fact
promotext.properties should be moved to UiLabels file because all the
properties defined in the file are text descriptions and not system
configurations, which makes them a candidate of internationalization. I'll
create a Jira ticket for it.

Thanks & Regards
Mridul Pathak
Hotwax Systems
http://www.hotwaxsystems.com <http://www.hotwaxmedia.com>

On Thu, Jun 9, 2016 at 6:46 PM, Pierre Smits <pierre.sm...@gmail.com> wrote:

> UtilProperties.getMessage won't fly in a multi-tenant setup
>
>
> Best regards,
>
> Pierre
>
>
>
> On Thursday, June 9, 2016, <mridulpat...@apache.org> wrote:
>
> > Author: mridulpathak
> > Date: Thu Jun  9 11:58:22 2016
> > New Revision: 1747540
> >
> > URL: http://svn.apache.org/viewvc?rev=1747540&view=rev
> > Log:
> > [OFBIZ-7027] Added support to include party classification information in
> > promo description. Thanks Swapnil M Mane for the contribution.
> >
> > Modified:
> >
> >
> ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/product/ProductPromoWorker.java
> >     ofbiz/trunk/applications/product/config/promotext.properties
> >
> > Modified:
> >
> ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/product/ProductPromoWorker.java
> > URL:
> >
> http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/product/ProductPromoWorker.java?rev=1747540&r1=1747539&r2=1747540&view=diff
> >
> >
> ==============================================================================
> > ---
> >
> ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/product/ProductPromoWorker.java
> > (original)
> > +++
> >
> ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/product/ProductPromoWorker.java
> > Thu Jun  9 11:58:22 2016
> > @@ -666,6 +666,8 @@ public class ProductPromoWorker {
> >          if (productPromo == null) {
> >              return "";
> >          }
> > +        ArrayList<String> partyClassificationsIncluded = new
> > ArrayList<String>();
> > +        ArrayList<String> partyClassificationsExcluded = new
> > ArrayList<String>();
> >          StringBuilder promoDescBuf = new StringBuilder();
> >          List<GenericValue> productPromoRules =
> > productPromo.getRelated("ProductPromoRule", null, null, true);
> >          Iterator<GenericValue> promoRulesIter =
> > productPromoRules.iterator();
> > @@ -688,12 +690,27 @@ public class ProductPromoWorker {
> >                  }
> >
> >                  Map<String, Object> messageContext = UtilMisc.<String,
> > Object>toMap("condValue", condValue, "equalityOperator",
> equalityOperator,
> > "quantityOperator", quantityOperator);
> > -                String msgProp = UtilProperties.getMessage("promotext",
> > "condition." + productPromoCond.getString("inputParamEnumId"),
> > messageContext, locale);
> > -                promoDescBuf.append(msgProp);
> > -                promoDescBuf.append(" ");
> >
> > -                if (promoRulesIter.hasNext()) {
> > -                    promoDescBuf.append(" and ");
> > +                if
> >
> ("PPIP_PARTY_CLASS".equalsIgnoreCase(productPromoCond.getString("inputParamEnumId")))
> > {
> > +                    GenericValue partyClassificationGroup =
> >
> EntityQuery.use(delegator).from("PartyClassificationGroup").where("partyClassificationGroupId",
> > condValue).cache(true).queryOne();
> > +                    if
> (UtilValidate.isNotEmpty(partyClassificationGroup)
> > &&
> >
> UtilValidate.isNotEmpty(partyClassificationGroup.getString("description")))
> > {
> > +                        condValue =
> > partyClassificationGroup.getString("description");
> > +                    }
> > +
> > +                    if
> >
> ("PPC_EQ".equalsIgnoreCase(productPromoCond.getString("operatorEnumId"))) {
> > +                        partyClassificationsIncluded.add(condValue);
> > +                    }
> > +                    if
> >
> ("PPC_NEQ".equalsIgnoreCase(productPromoCond.getString("operatorEnumId"))) {
> > +                        partyClassificationsExcluded.add(condValue);
> > +                    }
> > +                } else {
> > +                    String msgProp =
> > UtilProperties.getMessage("promotext", "condition." +
> > productPromoCond.getString("inputParamEnumId"), messageContext, locale);
> > +                    promoDescBuf.append(msgProp);
> > +                    promoDescBuf.append(" ");
> > +
> > +                    if (promoRulesIter.hasNext()) {
> > +                        promoDescBuf.append(" and ");
> > +                    }
> >                  }
> >              }
> >
> > @@ -752,6 +769,18 @@ public class ProductPromoWorker {
> >                      UtilMisc.toMap("limit",
> > productPromo.getLong("useLimitPerPromotion")), locale));
> >          }
> >
> > +        if (UtilValidate.isNotEmpty(partyClassificationsIncluded)) {
> > +            Map<String, Object> messageContext = UtilMisc.<String,
> > Object>toMap("partyClassificationsIncluded",
> partyClassificationsIncluded);
> > +            String msgProp = UtilProperties.getMessage("promotext",
> > "condition.PPIP_PARTY_CLASS.APPLIED", messageContext, locale);
> > +            promoDescBuf.append("\n" + msgProp);
> > +        }
> > +
> > +        if (UtilValidate.isNotEmpty(partyClassificationsExcluded)) {
> > +            Map<String, Object> messageContext = UtilMisc.<String,
> > Object>toMap("partyClassificationsExcluded",
> partyClassificationsExcluded);
> > +            String msgProp = UtilProperties.getMessage("promotext",
> > "condition.PPIP_PARTY_CLASS.NOT_APPLIED", messageContext, locale);
> > +            promoDescBuf.append("\n" + msgProp);
> > +        }
> > +
> >          return promoDescBuf.toString();
> >      }
> >
> >
> > Modified: ofbiz/trunk/applications/product/config/promotext.properties
> > URL:
> >
> http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/config/promotext.properties?rev=1747540&r1=1747539&r2=1747540&view=diff
> >
> >
> ==============================================================================
> > --- ofbiz/trunk/applications/product/config/promotext.properties
> (original)
> > +++ ofbiz/trunk/applications/product/config/promotext.properties Thu Jun
> > 9 11:58:22 2016
> > @@ -33,6 +33,8 @@ operator.quantity.PPC_GTE=more than
> >
> >
> >  condition.PPIP_ORDER_TOTAL=spend ${quantityOperator} $${condValue}
> > +condition.PPIP_PARTY_CLASS.APPLIED=Applied to party classification -
> > ${partyClassificationsIncluded}
> > +condition.PPIP_PARTY_CLASS.NOT_APPLIED=Not applied to party
> > classification - ${partyClassificationsExcluded}
> >  condition.PPIP_PRODUCT_TOTAL=buy ${quantityOperator} $${condValue} of
> > qualifying products
> >  condition.PPIP_PRODUCT_AMOUNT=for each $${condValue} or more of
> > qualifying products
> >  condition.PPIP_PRODUCT_QUANT=buy ${condValue} of qualifying products
> >
> >
> >
>
> --
> Pierre Smits
>
> ORRTIZ.COM <http://www.orrtiz.com>
> OFBiz based solutions & services
>
> OFBiz Extensions Marketplace
> http://oem.ofbizci.net/oci-2/
>

Reply via email to