svn commit: r1861815 - in /ofbiz/ofbiz-framework/trunk/applications: order/src/main/java/org/apache/ofbiz/order/shoppingcart/product/ProductPromoWorker.java product/config/ProductPromoUiLabels.xml

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

svn commit: r1861815 - in /ofbiz/ofbiz-framework/trunk/applications: order/src/main/java/org/apache/ofbiz/order/shoppingcart/product/ProductPromoWorker.java product/config/ProductPromoUiLabels.xml

surajk
Author: surajk
Date: Sat Jun 22 05:55:05 2019
New Revision: 1861815

URL: http://svn.apache.org/viewvc?rev=1861815&view=rev
Log:
Fixed: AutoDescription of promotion showing invalid text.
(OFBIZ-10853)
Modified code as per latest changes of inputParamEnumId and customMethodId.
Thanks Lalit Dashora for reporting the issue and providing the patch.

Modified:
    ofbiz/ofbiz-framework/trunk/applications/order/src/main/java/org/apache/ofbiz/order/shoppingcart/product/ProductPromoWorker.java
    ofbiz/ofbiz-framework/trunk/applications/product/config/ProductPromoUiLabels.xml

Modified: ofbiz/ofbiz-framework/trunk/applications/order/src/main/java/org/apache/ofbiz/order/shoppingcart/product/ProductPromoWorker.java
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/applications/order/src/main/java/org/apache/ofbiz/order/shoppingcart/product/ProductPromoWorker.java?rev=1861815&r1=1861814&r2=1861815&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/applications/order/src/main/java/org/apache/ofbiz/order/shoppingcart/product/ProductPromoWorker.java (original)
+++ ofbiz/ofbiz-framework/trunk/applications/order/src/main/java/org/apache/ofbiz/order/shoppingcart/product/ProductPromoWorker.java Sat Jun 22 05:55:05 2019
@@ -690,7 +690,7 @@ public final class ProductPromoWorker {
 
                 Map<String, Object> messageContext = UtilMisc.<String, Object>toMap("condValue", condValue, "equalityOperator", equalityOperator, "quantityOperator", quantityOperator);
 
-                if ("PPIP_PARTY_CLASS".equalsIgnoreCase(productPromoCond.getString("inputParamEnumId"))) {
+                if ("PPIP_PARTY_CLASS".equalsIgnoreCase(productPromoCond.getString("inputParamEnumId")) || "PPC_PARTY_CLASS".equalsIgnoreCase(productPromoCond.getString("customMethodId"))) {
                     GenericValue partyClassificationGroup = EntityQuery.use(delegator).from("PartyClassificationGroup").where("partyClassificationGroupId", condValue).cache(true).queryOne();
                     if (partyClassificationGroup != null && UtilValidate.isNotEmpty(partyClassificationGroup.getString("description"))) {
                         condValue = partyClassificationGroup.getString("description");
@@ -703,7 +703,20 @@ public final class ProductPromoWorker {
                         partyClassificationsExcluded.add(condValue);
                     }
                 } else {
-                    String msgProp = UtilProperties.getMessage("ProductPromoUiLabels", "ProductPromoCondition." + productPromoCond.getString("inputParamEnumId"), messageContext, locale);
+                    String enumId = null;
+                    if (UtilValidate.isNotEmpty(productPromoCond.getString("customMethodId"))) {
+                        GenericValue enumeration = EntityQuery.use(delegator).from("Enumeration").where("enumCode", productPromoCond.getString("customMethodId")).cache().queryFirst();
+                        if (enumeration != null) {
+                            enumId = enumeration.getString("enumId");
+                        }
+                    } else {
+                        enumId = productPromoCond.getString("inputParamEnumId");
+                    }
+
+                    if (UtilValidate.isNotEmpty(productPromoCond.getString("otherValue"))) {
+                        messageContext.put("otherValue", productPromoCond.getString("otherValue"));
+                    }
+                    String msgProp = UtilProperties.getMessage("ProductPromoUiLabels", "ProductPromoCondition." + enumId, messageContext, locale);
                     promoDescBuf.append(msgProp);
                     promoDescBuf.append(" ");
 
@@ -733,7 +746,17 @@ public final class ProductPromoWorker {
                     messageContext.put("productName", ProductContentWrapper.getProductContentAsText(product, "PRODUCT_NAME", locale, dispatcher, "html"));
                 }
 
-                String msgProp = UtilProperties.getMessage("ProductPromoUiLabels", "ProductPromoAction." + productPromoAction.getString("productPromoActionEnumId"), messageContext, locale);
+                String enumId = null;
+                if (UtilValidate.isNotEmpty(productPromoAction.getString("customMethodId"))) {
+                    GenericValue enumeration = EntityQuery.use(delegator).from("Enumeration").where("enumCode", productPromoAction.getString("customMethodId")).cache().queryFirst();
+                    if (enumeration != null) {
+                        enumId = enumeration.getString("enumId");
+                    }
+                } else {
+                    enumId = productPromoAction.getString("productPromoActionEnumId");
+                }
+
+                String msgProp = UtilProperties.getMessage("ProductPromoUiLabels", "ProductPromoAction." + enumId, messageContext, locale);
                 promoDescBuf.append(msgProp);
                 promoDescBuf.append(" ");
 

Modified: ofbiz/ofbiz-framework/trunk/applications/product/config/ProductPromoUiLabels.xml
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/applications/product/config/ProductPromoUiLabels.xml?rev=1861815&r1=1861814&r2=1861815&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/applications/product/config/ProductPromoUiLabels.xml (original)
+++ ofbiz/ofbiz-framework/trunk/applications/product/config/ProductPromoUiLabels.xml Sat Jun 22 05:55:05 2019
@@ -76,6 +76,9 @@
         <value xml:lang="zh">大于等于</value>
         <value xml:lang="zh-TW">大于等于</value>
     </property>
+    <property key="ProductPromoCondition.PPIP_ORST_HIST">
+        <value xml:lang="en">spend ${quantityOperator} ${condValue} in any ${otherValue}</value>
+    </property>
     <property key="ProductPromoCondition.PPIP_ORDER_TOTAL">
         <value xml:lang="en">spend ${quantityOperator} ${condValue}</value>
         <value xml:lang="zh">花费 ${quantityOperator} ${condValue}</value>
@@ -92,6 +95,9 @@
         <value xml:lang="zh">è´­ä¹° ${quantityOperator} ${condValue} 的合格产品</value>
         <value xml:lang="zh-TW">購買 ${quantityOperator} ${condValue} 的合格產品</value>
     </property>
+    <property key="ProductPromoCondition.PPIP_GEO_ID">
+        <value xml:lang="en">With shipping destination ${condValue}</value>
+    </property>
     <property key="ProductPromoCondition.PPIP_PRODUCT_AMOUNT">
         <value xml:lang="en">for each ${condValue} or more of qualifying products</value>
         <value xml:lang="zh">对于每个 ${condValue} 或更多的合格产品</value>
@@ -157,4 +163,7 @@
         <value xml:lang="zh">得到 ${amount} 从你的订单扣除</value>
         <value xml:lang="zh-TW">得到 ${amount} 從你的訂單扣除</value>
     </property>
+    <property key="ProductPromoAction.PROMO_SHIP_CHARGE">
+        <value xml:lang="en">Get ${amount}% discount on shipping</value>
+    </property>
 </resource>
\ No newline at end of file