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 2008/11/07 16:43:57 UTC

svn commit: r712167 - in /ofbiz/trunk: applications/ecommerce/data/ applications/order/src/org/ofbiz/order/shoppingcart/product/ applications/product/config/ applications/product/data/ framework/common/config/

Author: jleroux
Date: Fri Nov  7 07:43:24 2008
New Revision: 712167

URL: http://svn.apache.org/viewvc?rev=712167&view=rev
Log:
2 new promotions rules conditions derived from "Order sub-total X in last Y Months" 
respectively 
    "Order sub-total X since beginning of current year" 
and  
    "Order sub-total X last year"
+ some French translation amendments

Modified:
    ofbiz/trunk/applications/ecommerce/data/DemoProductCategoriesI18nData.xml
    ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/product/ProductPromoWorker.java
    ofbiz/trunk/applications/product/config/ProductEntityLabels.xml
    ofbiz/trunk/applications/product/config/ProductUiLabels.xml
    ofbiz/trunk/applications/product/data/ProductTypeData.xml
    ofbiz/trunk/framework/common/config/CommonEntityLabels.xml
    ofbiz/trunk/framework/common/config/CommonUiLabels.xml

Modified: ofbiz/trunk/applications/ecommerce/data/DemoProductCategoriesI18nData.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/ecommerce/data/DemoProductCategoriesI18nData.xml?rev=712167&r1=712166&r2=712167&view=diff
==============================================================================
--- ofbiz/trunk/applications/ecommerce/data/DemoProductCategoriesI18nData.xml (original)
+++ ofbiz/trunk/applications/ecommerce/data/DemoProductCategoriesI18nData.xml Fri Nov  7 07:43:24 2008
@@ -276,7 +276,7 @@
     <DataResource dataResourceId="DRPROMO-001DESCFR" dataResourceTypeId="ELECTRONIC_TEXT" localeString="fr"/>   
     <DataResource dataResourceId="DRPROMO-001DESCEN" dataResourceTypeId="ELECTRONIC_TEXT" localeString="en"/>    
     
-    <ElectronicText dataResourceId="DRPROMO-001DESCFR" textData="Produits de démonstration"/>
+    <ElectronicText dataResourceId="DRPROMO-001DESCFR" textData="Articles de démonstration"/>
     <ElectronicText dataResourceId="DRPROMO-001DESCEN" textData="Featured products"/>
     
     <Content contentId="CPROMO-001DESCFR" contentTypeId="DOCUMENT" dataResourceId="DRPROMO-001DESCFR" description="DESCRIPTION FR Articles de démonstration" localeString="fr" />

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=712167&r1=712166&r2=712167&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 Fri Nov  7 07:43:24 2008
@@ -21,6 +21,7 @@
 import java.math.BigDecimal;
 import java.sql.Timestamp;
 import java.util.ArrayList;
+import java.util.Calendar;
 import java.util.HashMap;
 import java.util.HashSet;
 import java.util.Iterator;
@@ -45,8 +46,6 @@
 import org.ofbiz.entity.GenericEntityException;
 import org.ofbiz.entity.GenericValue;
 import org.ofbiz.entity.condition.EntityCondition;
-import org.ofbiz.entity.condition.EntityConditionList;
-import org.ofbiz.entity.condition.EntityExpr;
 import org.ofbiz.entity.condition.EntityOperator;
 import org.ofbiz.entity.util.EntityUtil;
 import org.ofbiz.order.shoppingcart.CartItemModifyException;
@@ -1037,6 +1036,72 @@
             } else {
                 return false;
             }
+        } else if ("PPIP_ORST_YEAR".equals(inputParamEnumId)) {
+            // description="Order sub-total X since beginning of current year"
+            if (partyId != null && userLogin != null) {
+                // call the getOrderedSummaryInformation service to get the sub-total
+                Calendar calendar = Calendar.getInstance();
+                calendar.setTime(nowTimestamp);
+                int monthsToInclude = calendar.get(Calendar.MONTH) + 1;                
+                Map serviceIn = UtilMisc.toMap("partyId", partyId, 
+                        "roleTypeId", "PLACING_CUSTOMER", 
+                        "orderTypeId", "SALES_ORDER", 
+                        "statusId", "ORDER_COMPLETED", 
+                        "monthsToInclude", new Integer(monthsToInclude), 
+                        "userLogin", userLogin);
+                try {
+                    Map result = dispatcher.runSync("getOrderedSummaryInformation", serviceIn);
+                    if (ServiceUtil.isError(result)) {
+                        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");
+                        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)));
+                    }
+                } catch (GenericServiceException e) {
+                    Debug.logError(e, "Error getting order history sub-total in the getOrderedSummaryInformation service, evaluating condition to false.", module);
+                    return false;
+                }
+            }
+        } else if ("PPIP_ORST_LAST_YEAR".equals(inputParamEnumId)) {
+            // description="Order sub-total X since beginning of last year"
+            if (partyId != null && userLogin != null) {
+                // call the getOrderedSummaryInformation service to get the sub-total
+                
+                Calendar calendar = Calendar.getInstance();
+                calendar.setTime(nowTimestamp);
+                int lastYear = calendar.get(Calendar.YEAR) - 1;               
+                Calendar fromDateCalendar = Calendar.getInstance();
+                fromDateCalendar.set(lastYear, 0, 0, 0, 0);
+                Timestamp fromDate = new Timestamp(fromDateCalendar.getTime().getTime());  
+                Calendar thruDateCalendar = Calendar.getInstance();
+                thruDateCalendar.set(lastYear, 12, 0, 0, 0);
+                Timestamp thruDate = new Timestamp(thruDateCalendar.getTime().getTime());  
+                Map serviceIn = UtilMisc.toMap("partyId", partyId, 
+                        "roleTypeId", "PLACING_CUSTOMER", 
+                        "orderTypeId", "SALES_ORDER", 
+                        "statusId", "ORDER_COMPLETED", 
+                        "fromDate", fromDate, 
+                        "thruDate", thruDate, 
+                        "userLogin", userLogin);
+                try {
+                    Map result = dispatcher.runSync("getOrderedSummaryInformation", serviceIn);
+                    if (ServiceUtil.isError(result)) {
+                        Debug.logError("Error calling getOrderedSummaryInformation service for the PPIP_ORST_LAST_YEAR ProductPromo condition input value: " + ServiceUtil.getErrorMessage(result), module);
+                        return false;
+                    } else {
+                        Double orderSubTotal = (Double) result.get("totalSubRemainingAmount");
+                        if (Debug.verboseOn()) Debug.logVerbose("Doing order history sub-total compare: orderSubTotal=" + orderSubTotal + ", for last year.", module);
+                        compareBase = new Integer(orderSubTotal.compareTo(Double.valueOf(condValue)));
+                    }
+                } catch (GenericServiceException e) {
+                    Debug.logError(e, "Error getting order history sub-total in the getOrderedSummaryInformation service, evaluating condition to false.", module);
+                    return false;
+                }
+            } else {
+                return false;
+            }
         } else if ("PPIP_RECURRENCE".equals(inputParamEnumId)) {
             compareBase = new Integer(1);
             GenericValue recurrenceInfo = delegator.findByPrimaryKeyCache("RecurrenceInfo", UtilMisc.toMap("recurrenceInfoId", condValue));

Modified: ofbiz/trunk/applications/product/config/ProductEntityLabels.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/config/ProductEntityLabels.xml?rev=712167&r1=712166&r2=712167&view=diff
==============================================================================
--- ofbiz/trunk/applications/product/config/ProductEntityLabels.xml (original)
+++ ofbiz/trunk/applications/product/config/ProductEntityLabels.xml Fri Nov  7 07:43:24 2008
@@ -1803,6 +1803,7 @@
     <property key="ProductPriceType.description.SPECIAL_PROMO_PRICE">
         <value xml:lang="de">Sonderaktionspreis</value>
         <value xml:lang="en">Special Promo Price</value>
+        <value xml:lang="en">Prix spécial promo</value>
         <value xml:lang="it">Prezzo Promozionale Speciale</value>
         <value xml:lang="ro">Pret Promotional Special</value>
         <value xml:lang="ru">Специальная цена</value>

Modified: ofbiz/trunk/applications/product/config/ProductUiLabels.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/config/ProductUiLabels.xml?rev=712167&r1=712166&r2=712167&view=diff
==============================================================================
--- ofbiz/trunk/applications/product/config/ProductUiLabels.xml (original)
+++ ofbiz/trunk/applications/product/config/ProductUiLabels.xml Fri Nov  7 07:43:24 2008
@@ -3807,7 +3807,7 @@
     <property key="FormFieldTitle_supplierPrefOrderId">
         <value xml:lang="de">Lieferant präferierte Auftragsnummer ID</value>
         <value xml:lang="en">Supplier Pref Order Id</value>
-        <value xml:lang="fr">Réf. de commande de fournisseur préféré</value>
+        <value xml:lang="fr">Réf. de fournisseur préféré</value>
         <value xml:lang="it">Preferenze Fornitore Numero Ordine</value>
         <value xml:lang="ro">Preferinte Furnizor Numar Comanda</value>
         <value xml:lang="ru">Пред код заказа поставщика</value>

Modified: ofbiz/trunk/applications/product/data/ProductTypeData.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/data/ProductTypeData.xml?rev=712167&r1=712166&r2=712167&view=diff
==============================================================================
--- ofbiz/trunk/applications/product/data/ProductTypeData.xml (original)
+++ ofbiz/trunk/applications/product/data/ProductTypeData.xml Fri Nov  7 07:43:24 2008
@@ -353,7 +353,9 @@
     <Enumeration description="Role Type" enumCode="ROLE_TYPE" enumId="PPIP_ROLE_TYPE" sequenceId="09" enumTypeId="PROD_PROMO_IN_PARAM"/>
     <Enumeration description="Order sub-total X in last Y Months" enumCode="ORST_HIST" enumId="PPIP_ORST_HIST" sequenceId="10" enumTypeId="PROD_PROMO_IN_PARAM"/>
     <Enumeration description="Promotion Recurrence" enumCode="PROMO_RECURRENCE" enumId="PPIP_RECURRENCE" sequenceId="11" enumTypeId="PROD_PROMO_IN_PARAM"/>
-
+    <Enumeration description="Order sub-total X since beginning of current year" enumCode="ORST_YEAR" enumId="PPIP_ORST_YEAR" sequenceId="12" enumTypeId="PROD_PROMO_IN_PARAM"/>
+    <Enumeration description="Order sub-total X last year" enumCode="ORST_LAST_YEAR" enumId="PPIP_ORST_LAST_YEAR" sequenceId="13" enumTypeId="PROD_PROMO_IN_PARAM"/>
+    
     <EnumerationType description="Product Promotion Condition" enumTypeId="PROD_PROMO_COND" hasTable="N" parentTypeId="PROD_PROMO"/>
     <!-- old style very technical ...
     <Enumeration description="==" enumCode="EQ" enumId="PPC_EQ" sequenceId="01" enumTypeId="PROD_PROMO_COND"/>

Modified: ofbiz/trunk/framework/common/config/CommonEntityLabels.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/common/config/CommonEntityLabels.xml?rev=712167&r1=712166&r2=712167&view=diff
==============================================================================
--- ofbiz/trunk/framework/common/config/CommonEntityLabels.xml (original)
+++ ofbiz/trunk/framework/common/config/CommonEntityLabels.xml Fri Nov  7 07:43:24 2008
@@ -1111,7 +1111,7 @@
     <property key="Enumeration.description.PPIP_ORST_HIST">
         <value xml:lang="de">Bestellung Zwischentotal X in den letzten Y Monaten</value>
         <value xml:lang="en">Order sub-total X in last Y Months</value>
-        <value xml:lang="fr">Sous-total X de commande dans les Y derniers mois</value>
+        <value xml:lang="fr">Sous-total X commandé dans les Y derniers mois</value>
         <value xml:lang="it">Sub-totale Ordine X negli ultimi Y Mesi</value>
         <value xml:lang="pt">Sub-total da Encomenda X nos últimos Y Meses</value>
         <value xml:lang="ro">Sub-total Comenzi X ultime Y Luni</value>
@@ -1119,6 +1119,14 @@
         <value xml:lang="th">ผลรวมย่อยรายการ X  ในสุดท้าย Y เดือน</value>
         <value xml:lang="zh">订单小计 X 在过去 Y 个月里</value>
     </property>
+    <property key="Enumeration.description.PPIP_ORST_LAST_YEAR">
+        <value xml:lang="en">Order sub-total X last year</value>
+        <value xml:lang="fr">Sous-total X commandé l'année dernière</value>
+    </property>
+    <property key="Enumeration.description.PPIP_ORST_YEAR">
+        <value xml:lang="en">Order sub-total X since beginning of current year</value>
+        <value xml:lang="fr">Sous-total X commandé depuis le début de l'année</value>
+    </property>
     <property key="Enumeration.description.PPIP_PARTY_CLASS">
         <value xml:lang="de">Akteur Klassifizierung</value>
         <value xml:lang="en">Party Classification</value>
@@ -1836,6 +1844,7 @@
     <property key="Enumeration.description.PROMO_PROD_SPPRC">
         <value xml:lang="de">Produkt zum [Spezial Aktions] Preis</value>
         <value xml:lang="en">Product for [Special Promo] Price</value>
+        <value xml:lang="fr">Un article au prix [spécial promo]</value>
         <value xml:lang="it">Prodotto per [Promozione Speciale] Prezzo</value>
         <value xml:lang="pt">Produto para [Promo Especial] Preço</value>
         <value xml:lang="ro">Produs pentru [Promovare Speciala] Pret</value>

Modified: ofbiz/trunk/framework/common/config/CommonUiLabels.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/common/config/CommonUiLabels.xml?rev=712167&r1=712166&r2=712167&view=diff
==============================================================================
--- ofbiz/trunk/framework/common/config/CommonUiLabels.xml (original)
+++ ofbiz/trunk/framework/common/config/CommonUiLabels.xml Fri Nov  7 07:43:24 2008
@@ -6272,7 +6272,7 @@
         <value xml:lang="de">Aktualisierung</value>
         <value xml:lang="en">Update</value>
         <value xml:lang="es">Actualizar</value>
-        <value xml:lang="fr">Mettre à jour</value>
+        <value xml:lang="fr">Màj</value>
         <value xml:lang="it">Aggiorna</value>
         <value xml:lang="nl">Wijzigen</value>
         <value xml:lang="pt">Actualizar</value>