You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by jl...@apache.org on 2009/03/26 09:55:12 UTC

svn commit: r758562 - in /ofbiz/trunk: applications/order/config/ applications/order/src/org/ofbiz/order/shoppingcart/product/ applications/order/webapp/ordermgr/entry/cart/ specialpurpose/ecommerce/config/

Author: jleroux
Date: Thu Mar 26 08:55:05 2009
New Revision: 758562

URL: http://svn.apache.org/viewvc?rev=758562&view=rev
Log:
I18n and L10n of promotions details in eCommerce

Modified:
    ofbiz/trunk/applications/order/config/OrderUiLabels.xml
    ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/product/ProductPromoWorker.java
    ofbiz/trunk/applications/order/webapp/ordermgr/entry/cart/promotiondetails.ftl
    ofbiz/trunk/specialpurpose/ecommerce/config/EcommerceUiLabels.xml

Modified: ofbiz/trunk/applications/order/config/OrderUiLabels.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/config/OrderUiLabels.xml?rev=758562&r1=758561&r2=758562&view=diff
==============================================================================
--- ofbiz/trunk/applications/order/config/OrderUiLabels.xml (original)
+++ ofbiz/trunk/applications/order/config/OrderUiLabels.xml Thu Mar 26 08:55:05 2009
@@ -3593,6 +3593,18 @@
         <value xml:lang="ru">Последние поиски</value>
         <value xml:lang="th">ค้นหาครั้งสุดท้าย</value>
         <value xml:lang="zh">最近使用的搜索</value>
+    </property>     
+    <property key="OrderLimitPerCustomer">
+        <value xml:lang="en">Limit ${limit} per customer. </value>
+        <value xml:lang="fr">Limiter à ${limit} par client. </value>
+    </property>
+    <property key="OrderLimitPerPromotion">
+        <value xml:lang="en">Limit ${limit} per promotion. </value>
+        <value xml:lang="fr">Limiter à ${limit} par promotion. </value>
+    </property>
+    <property key="OrderLimitPerOrder">
+        <value xml:lang="en">Limit ${limit} per order. </value>
+        <value xml:lang="fr">Limiter à ${limit} par commande. </value>
     </property>
     <property key="OrderLinkedFromOrderItem">
         <value xml:lang="de">Verlinkt von Auftragselement</value>
@@ -7116,6 +7128,10 @@
         <value xml:lang="zh">请求</value>
         <value xml:lang="zh_CN">请求</value>
     </property>
+    <property key="OrderRequiresCodeToUse">
+        <value xml:lang="en">Requires code to use. </value>
+        <value xml:lang="fr">Nécessite un code. </value>
+    </property>     
     <property key="OrderRequestContent">
         <value xml:lang="de">Inhalt</value>
         <value xml:lang="en">Content</value>

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=758562&r1=758561&r2=758562&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 Mar 26 08:55:05 2009
@@ -68,6 +68,7 @@
 public class ProductPromoWorker {
 
     public static final String module = ProductPromoWorker.class.getName();
+    public static final String resource = "OrderUiLabels";
     public static final String resource_error = "OrderErrorUiLabels";
 
     public static final int decimals = UtilNumber.getBigDecimalScale("order.decimals");
@@ -659,22 +660,19 @@
         }
  
         if ("Y".equals(productPromo.getString("requireCode"))) {
-            promoDescBuf.append("Requires code to use. ");
+            promoDescBuf.append(UtilProperties.getMessage(resource, "OrderRequiresCodeToUse", locale));
         }
         if (productPromo.getLong("useLimitPerOrder") != null) {
-            promoDescBuf.append("Limit ");
-            promoDescBuf.append(productPromo.getLong("useLimitPerOrder"));
-            promoDescBuf.append(" per order. ");
+            promoDescBuf.append(UtilProperties.getMessage(resource, "OrderLimitPerOrder", 
+                    UtilMisc.toMap("limit", productPromo.getLong("useLimitPerOrder")), locale));
         }
         if (productPromo.getLong("useLimitPerCustomer") != null) {
-            promoDescBuf.append("Limit ");
-            promoDescBuf.append(productPromo.getLong("useLimitPerCustomer"));
-            promoDescBuf.append(" per customer. ");
+            promoDescBuf.append(UtilProperties.getMessage(resource, "OrderLimitPerCustomer", 
+                    UtilMisc.toMap("limit", productPromo.getLong("useLimitPerCustomer")), locale));
         }
         if (productPromo.getLong("useLimitPerPromotion") != null) {
-            promoDescBuf.append("Limit ");
-            promoDescBuf.append(productPromo.getLong("useLimitPerPromotion"));
-            promoDescBuf.append(" per promotion. ");
+            promoDescBuf.append(UtilProperties.getMessage(resource, "OrderLimitPerPromotion", 
+                    UtilMisc.toMap("limit", productPromo.getLong("useLimitPerPromotion")), locale));
         }
  
         return promoDescBuf.toString();
@@ -1013,6 +1011,10 @@
             BigDecimal orderSubTotal = cart.getSubTotalForPromotions();
             if (Debug.verboseOn()) Debug.logVerbose("Doing order total compare: orderSubTotal=" + orderSubTotal, module);
             compareBase = new Integer(orderSubTotal.compareTo(new BigDecimal(condValue)));
+        } else if ("PPIP_SHIP_TOTAL".equals(inputParamEnumId)) {
+            BigDecimal shippingTotal = cart.getTotalShipping();
+            if (Debug.verboseOn()) Debug.logVerbose("Doing shipping total compare: shippingTotal=" + shippingTotal, module);
+            compareBase = new Integer(shippingTotal.compareTo(new BigDecimal(condValue)));
         } else if ("PPIP_ORST_HIST".equals(inputParamEnumId)) {
             // description="Order sub-total X in last Y Months"
             if (partyId != null && userLogin != null) {
@@ -1058,9 +1060,9 @@
                         Debug.logError("Error calling getOrderedSummaryInformation service for the PPIP_ORST_YEAR ProductPromo condition input value: " + ServiceUtil.getErrorMessage(result), module);
                         return false;
                     } else {
-                        Double orderSubTotal = (Double) result.get("totalSubRemainingAmount");
+                        BigDecimal orderSubTotal = (BigDecimal) result.get("totalSubRemainingAmount");
                         if (Debug.verboseOn()) Debug.logVerbose("Doing order history sub-total compare: orderSubTotal=" + orderSubTotal + ", for the last " + monthsToInclude + " months.", module);
-                        compareBase = new Integer(orderSubTotal.compareTo(Double.valueOf(condValue)));
+                        compareBase = new Integer(orderSubTotal.compareTo(new BigDecimal((condValue))));
                     }
                 } catch (GenericServiceException e) {
                     Debug.logError(e, "Error getting order history sub-total in the getOrderedSummaryInformation service, evaluating condition to false.", module);

Modified: ofbiz/trunk/applications/order/webapp/ordermgr/entry/cart/promotiondetails.ftl
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/webapp/ordermgr/entry/cart/promotiondetails.ftl?rev=758562&r1=758561&r2=758562&view=diff
==============================================================================
--- ofbiz/trunk/applications/order/webapp/ordermgr/entry/cart/promotiondetails.ftl (original)
+++ ofbiz/trunk/applications/order/webapp/ordermgr/entry/cart/promotiondetails.ftl Thu Mar 26 08:55:05 2009
@@ -23,6 +23,6 @@
     </div>
     <div class="screenlet-body">
         <div>${StringUtil.wrapString(productPromo.promoText?if_exists)}</div>
-        <div>Generated Description: ${promoAutoDescription?if_exists}</div>
+        <div>${uiLabelMap.EcommerceGeneratedDescription}  ${promoAutoDescription?if_exists}</div>
     </div>
 </div>

Modified: ofbiz/trunk/specialpurpose/ecommerce/config/EcommerceUiLabels.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/ecommerce/config/EcommerceUiLabels.xml?rev=758562&r1=758561&r2=758562&view=diff
==============================================================================
--- ofbiz/trunk/specialpurpose/ecommerce/config/EcommerceUiLabels.xml (original)
+++ ofbiz/trunk/specialpurpose/ecommerce/config/EcommerceUiLabels.xml Thu Mar 26 08:55:05 2009
@@ -887,6 +887,10 @@
         <value xml:lang="ru">От сайта:</value>
         <value xml:lang="th">จากที่ทำงาน</value>
         <value xml:lang="zh">来自站点:</value>
+    </property>    
+    <property key="EcommerceGeneratedDescription">
+        <value xml:lang="en">Generated Description:</value>
+        <value xml:lang="fr">Description générée : </value>
     </property>
     <property key="EcommerceGiftAmount">
         <value xml:lang="de">Gutschein Betrag:</value>



Re: svn commit: r758562 - in /ofbiz/trunk: applications/order/config/ applications/order/src/org/ofbiz/order/shoppingcart/product/ applications/order/webapp/ordermgr/entry/cart/ specialpurpose/ecommerce/config/

Posted by Jacques Le Roux <ja...@les7arts.com>.
The snippets

+        } else if ("PPIP_SHIP_TOTAL".equals(inputParamEnumId)) {
+            BigDecimal shippingTotal = cart.getTotalShipping();
+            if (Debug.verboseOn()) Debug.logVerbose("Doing shipping total compare: shippingTotal=" + shippingTotal, module);
+            compareBase = new Integer(shippingTotal.compareTo(new BigDecimal(condValue)));

Should not have been commited in this but another commit that will come soon (related to 
https://issues.apache.org/jira/browse/OFBIZ-2178)

Note that in this commit I have also fixed an issue with Double in

-                        Double orderSubTotal = (Double) result.get("totalSubRemainingAmount");
+                        BigDecimal orderSubTotal = (BigDecimal) result.get("totalSubRemainingAmount");

-                        compareBase = new Integer(orderSubTotal.compareTo(Double.valueOf(condValue)));
+                        compareBase = new Integer(orderSubTotal.compareTo(new BigDecimal((condValue))));

Jacques

> Author: jleroux
> Date: Thu Mar 26 08:55:05 2009
> New Revision: 758562
>
> URL: http://svn.apache.org/viewvc?rev=758562&view=rev
> Log:
> I18n and L10n of promotions details in eCommerce
>
> Modified:
>    ofbiz/trunk/applications/order/config/OrderUiLabels.xml
>    ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/product/ProductPromoWorker.java
>    ofbiz/trunk/applications/order/webapp/ordermgr/entry/cart/promotiondetails.ftl
>    ofbiz/trunk/specialpurpose/ecommerce/config/EcommerceUiLabels.xml
>
> Modified: ofbiz/trunk/applications/order/config/OrderUiLabels.xml
> URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/config/OrderUiLabels.xml?rev=758562&r1=758561&r2=758562&view=diff
> ==============================================================================
> --- ofbiz/trunk/applications/order/config/OrderUiLabels.xml (original)
> +++ ofbiz/trunk/applications/order/config/OrderUiLabels.xml Thu Mar 26 08:55:05 2009
> @@ -3593,6 +3593,18 @@
>         <value xml:lang="ru">Последние поиски</value>
>         <value xml:lang="th">ค้นหาครั้งสุดท้าย</value>
>         <value xml:lang="zh">最近使用的搜索</value>
> +    </property>
> +    <property key="OrderLimitPerCustomer">
> +        <value xml:lang="en">Limit ${limit} per customer. </value>
> +        <value xml:lang="fr">Limiter à ${limit} par client. </value>
> +    </property>
> +    <property key="OrderLimitPerPromotion">
> +        <value xml:lang="en">Limit ${limit} per promotion. </value>
> +        <value xml:lang="fr">Limiter à ${limit} par promotion. </value>
> +    </property>
> +    <property key="OrderLimitPerOrder">
> +        <value xml:lang="en">Limit ${limit} per order. </value>
> +        <value xml:lang="fr">Limiter à ${limit} par commande. </value>
>     </property>
>     <property key="OrderLinkedFromOrderItem">
>         <value xml:lang="de">Verlinkt von Auftragselement</value>
> @@ -7116,6 +7128,10 @@
>         <value xml:lang="zh">请求</value>
>         <value xml:lang="zh_CN">请求</value>
>     </property>
> +    <property key="OrderRequiresCodeToUse">
> +        <value xml:lang="en">Requires code to use. </value>
> +        <value xml:lang="fr">Nécessite un code. </value>
> +    </property>
>     <property key="OrderRequestContent">
>         <value xml:lang="de">Inhalt</value>
>         <value xml:lang="en">Content</value>
>
> 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=758562&r1=758561&r2=758562&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 Mar 26 08:55:05 2009
> @@ -68,6 +68,7 @@
> public class ProductPromoWorker {
>
>     public static final String module = ProductPromoWorker.class.getName();
> +    public static final String resource = "OrderUiLabels";
>     public static final String resource_error = "OrderErrorUiLabels";
>
>     public static final int decimals = UtilNumber.getBigDecimalScale("order.decimals");
> @@ -659,22 +660,19 @@
>         }
>
>         if ("Y".equals(productPromo.getString("requireCode"))) {
> -            promoDescBuf.append("Requires code to use. ");
> +            promoDescBuf.append(UtilProperties.getMessage(resource, "OrderRequiresCodeToUse", locale));
>         }
>         if (productPromo.getLong("useLimitPerOrder") != null) {
> -            promoDescBuf.append("Limit ");
> -            promoDescBuf.append(productPromo.getLong("useLimitPerOrder"));
> -            promoDescBuf.append(" per order. ");
> +            promoDescBuf.append(UtilProperties.getMessage(resource, "OrderLimitPerOrder",
> +                    UtilMisc.toMap("limit", productPromo.getLong("useLimitPerOrder")), locale));
>         }
>         if (productPromo.getLong("useLimitPerCustomer") != null) {
> -            promoDescBuf.append("Limit ");
> -            promoDescBuf.append(productPromo.getLong("useLimitPerCustomer"));
> -            promoDescBuf.append(" per customer. ");
> +            promoDescBuf.append(UtilProperties.getMessage(resource, "OrderLimitPerCustomer",
> +                    UtilMisc.toMap("limit", productPromo.getLong("useLimitPerCustomer")), locale));
>         }
>         if (productPromo.getLong("useLimitPerPromotion") != null) {
> -            promoDescBuf.append("Limit ");
> -            promoDescBuf.append(productPromo.getLong("useLimitPerPromotion"));
> -            promoDescBuf.append(" per promotion. ");
> +            promoDescBuf.append(UtilProperties.getMessage(resource, "OrderLimitPerPromotion",
> +                    UtilMisc.toMap("limit", productPromo.getLong("useLimitPerPromotion")), locale));
>         }
>
>         return promoDescBuf.toString();
> @@ -1013,6 +1011,10 @@
>             BigDecimal orderSubTotal = cart.getSubTotalForPromotions();
>             if (Debug.verboseOn()) Debug.logVerbose("Doing order total compare: orderSubTotal=" + orderSubTotal, module);
>             compareBase = new Integer(orderSubTotal.compareTo(new BigDecimal(condValue)));
> +        } else if ("PPIP_SHIP_TOTAL".equals(inputParamEnumId)) {
> +            BigDecimal shippingTotal = cart.getTotalShipping();
> +            if (Debug.verboseOn()) Debug.logVerbose("Doing shipping total compare: shippingTotal=" + shippingTotal, module);
> +            compareBase = new Integer(shippingTotal.compareTo(new BigDecimal(condValue)));
>         } else if ("PPIP_ORST_HIST".equals(inputParamEnumId)) {
>             // description="Order sub-total X in last Y Months"
>             if (partyId != null && userLogin != null) {
> @@ -1058,9 +1060,9 @@
>                         Debug.logError("Error calling getOrderedSummaryInformation service for the PPIP_ORST_YEAR ProductPromo 
> condition input value: " + ServiceUtil.getErrorMessage(result), module);
>                         return false;
>                     } else {
> -                        Double orderSubTotal = (Double) result.get("totalSubRemainingAmount");
> +                        BigDecimal orderSubTotal = (BigDecimal) result.get("totalSubRemainingAmount");
>                         if (Debug.verboseOn()) Debug.logVerbose("Doing order history sub-total compare: orderSubTotal=" + 
> orderSubTotal + ", for the last " + monthsToInclude + " months.", module);
> -                        compareBase = new Integer(orderSubTotal.compareTo(Double.valueOf(condValue)));
> +                        compareBase = new Integer(orderSubTotal.compareTo(new BigDecimal((condValue))));
>                     }
>                 } catch (GenericServiceException e) {
>                     Debug.logError(e, "Error getting order history sub-total in the getOrderedSummaryInformation service, 
> evaluating condition to false.", module);
>
> Modified: ofbiz/trunk/applications/order/webapp/ordermgr/entry/cart/promotiondetails.ftl
> URL: 
> http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/webapp/ordermgr/entry/cart/promotiondetails.ftl?rev=758562&r1=758561&r2=758562&view=diff
> ==============================================================================
> --- ofbiz/trunk/applications/order/webapp/ordermgr/entry/cart/promotiondetails.ftl (original)
> +++ ofbiz/trunk/applications/order/webapp/ordermgr/entry/cart/promotiondetails.ftl Thu Mar 26 08:55:05 2009
> @@ -23,6 +23,6 @@
>     </div>
>     <div class="screenlet-body">
>         <div>${StringUtil.wrapString(productPromo.promoText?if_exists)}</div>
> -        <div>Generated Description: ${promoAutoDescription?if_exists}</div>
> +        <div>${uiLabelMap.EcommerceGeneratedDescription}  ${promoAutoDescription?if_exists}</div>
>     </div>
> </div>
>
> Modified: ofbiz/trunk/specialpurpose/ecommerce/config/EcommerceUiLabels.xml
> URL: 
> http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/ecommerce/config/EcommerceUiLabels.xml?rev=758562&r1=758561&r2=758562&view=diff
> ==============================================================================
> --- ofbiz/trunk/specialpurpose/ecommerce/config/EcommerceUiLabels.xml (original)
> +++ ofbiz/trunk/specialpurpose/ecommerce/config/EcommerceUiLabels.xml Thu Mar 26 08:55:05 2009
> @@ -887,6 +887,10 @@
>         <value xml:lang="ru">От сайта:</value>
>         <value xml:lang="th">จากที่ทำงาน</value>
>         <value xml:lang="zh">来自站点:</value>
> +    </property>
> +    <property key="EcommerceGeneratedDescription">
> +        <value xml:lang="en">Generated Description:</value>
> +        <value xml:lang="fr">Description générée : </value>
>     </property>
>     <property key="EcommerceGiftAmount">
>         <value xml:lang="de">Gutschein Betrag:</value>
>
>