svn commit: r439953 - in /incubator/ofbiz/trunk/applications/order: config/OrderUiLabels.properties config/OrderUiLabels_it.properties src/org/ofbiz/order/shoppingcart/ShoppingCartItem.java

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

svn commit: r439953 - in /incubator/ofbiz/trunk/applications/order: config/OrderUiLabels.properties config/OrderUiLabels_it.properties src/org/ofbiz/order/shoppingcart/ShoppingCartItem.java

jleroux@apache.org
Author: jleroux
Date: Sun Sep  3 23:59:08 2006
New Revision: 439953

URL: http://svn.apache.org/viewvc?view=rev&rev=439953
Log:
This patch from Marco Risaliti fully localise ShoppingCartItem.java. Thanks to him and Tarlika Elisabeth Schmitz who reported this in http://jira.undersunconsulting.com/browse/OFBIZ-485.
This close http://jira.undersunconsulting.com/browse/OFBIZ-485 and https://issues.apache.org/jira/browse/OFBIZ-200

Modified:
    incubator/ofbiz/trunk/applications/order/config/OrderUiLabels.properties
    incubator/ofbiz/trunk/applications/order/config/OrderUiLabels_it.properties
    incubator/ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartItem.java

Modified: incubator/ofbiz/trunk/applications/order/config/OrderUiLabels.properties
URL: http://svn.apache.org/viewvc/incubator/ofbiz/trunk/applications/order/config/OrderUiLabels.properties?view=diff&rev=439953&r1=439952&r2=439953
==============================================================================
--- incubator/ofbiz/trunk/applications/order/config/OrderUiLabels.properties (original)
+++ incubator/ofbiz/trunk/applications/order/config/OrderUiLabels.properties Sun Sep  3 23:59:08 2006
@@ -541,6 +541,20 @@
 checkhelpertotalsdonotmatchordertotal = Totals do not match order total.
 help_also_interested_in = You might also be interested in :
 item.product_not_found = Product not found, not adding to cart. [productId: ${productId}]
+item.cannot_add_product_virtual=Tried to add the Virtual Product ${productName} (productId: ${productId}) to the cart, not adding.
+item.cannot_add_product_not_configured_correctly=Tried to add the Product ${productName} (productId: ${productId}) to the cart, not adding: the product is not configured correctly.
+item.cannot_add_product_not_yet_available=Tried to add the Product ${productName} (productId: ${productId}) to the cart. This product has not yet been made available for sale, so not adding.
+item.cannot_add_product_no_longer_available=Tried to add the Product ${productName} (productId: ${productId}) to the cart. This product is no longer available for sale, so not adding.
+item.missing_reservation_starting_date=The starting date of the reservation is missing....
+item.reservation_from_tomorrow=You can only make reservation starting tomorrow....
+item.number_of_days=Please enter a number of days, 1, or more....
+item.maximum_number_of_person_renting=The maximum number of persons renting this object is ${reservMaxPersons} however you have requested: ${reservPersons} !
+item.product_not_available=Product not available, ProductId: ${productId} message: ${availableMessage}
+item.cannot_find_Fixed_Asset=Could not find a related Fixed Asset for the product: ${productId}
+item.fixed_Asset_not_found=fixed_Asset_not_found. Fixed AssetId: ${fixedAssetId}
+item.availableOk=OK
+item.availableQnt=Quantity requested: ${quantityReq} Quantity available: ${quantityAvail}
+item.notAvailable=I am sorry, not available at these dates: ${resultMessage} item not added to the shopping cart.....
 shoppinglistevents.added_product_to_cart = Added product ${productId} to cart.
 shoppinglistevents.cannot_create_new_shopping_list = Cannot create new shopping list.
 shoppinglistevents.choose_shopping_list = Please choose a shopping list.

Modified: incubator/ofbiz/trunk/applications/order/config/OrderUiLabels_it.properties
URL: http://svn.apache.org/viewvc/incubator/ofbiz/trunk/applications/order/config/OrderUiLabels_it.properties?view=diff&rev=439953&r1=439952&r2=439953
==============================================================================
--- incubator/ofbiz/trunk/applications/order/config/OrderUiLabels_it.properties (original)
+++ incubator/ofbiz/trunk/applications/order/config/OrderUiLabels_it.properties Sun Sep  3 23:59:08 2006
@@ -534,7 +534,21 @@
 checkhelper_sales_order_lines_lookup_failed = ERRORE: Righe Ordine Vendita ricerca fallita.
 checkhelpertotalsdonotmatchordertotal = Totali non corrispondono al totale ordine.
 help_also_interested_in = Tu potresti essere interessato anche a :
-item.product_not_found = Produtto non trovato, non aggiungerelo al carrello. [productId: ${productId}]
+item.product_not_found = Prodotto non trovato, non verr\u00e0 aggiunto al carrello. [prodotto: ${productId}]
+item.cannot_add_product_virtual=Tentativo di aggiungere il Prodotto Virtuale ${productName} (prodotto: ${productId}) al carrello, non verr\u00e0 aggiunto.
+item.cannot_add_product_not_configured_correctly=Tentativo di aggiungere il Prodotto ${productName} (prodotto: ${productId}) al carrello, non verr\u00e0 aggiunto: il prodotto non \u00e8 configurato correttamente.
+item.cannot_add_product_not_yet_available=Tentativo di aggiungere il Prodotto ${productName} (prodotto: ${productId}) al carrello. Questo prodotto non \u00e8 stato ancora reso disponibile per la vendita, cos\u00ec non sar\u00e0 possibile aggiungerlo.
+item.cannot_add_product_no_longer_available=Tentativo di aggiungere il Prodotto ${productName} (prodotto: ${productId}) al carrello. Questo prodotto non \u00e8 pi\u00f9 disponibile per la vendita, cos\u00ec non sar\u00e0 possibile aggiungerlo.
+item.missing_reservation_starting_date=La data di inizio prenotazione \u00e8 mancante....
+item.reservation_from_tomorrow=Tu potrai effettuare la prenotazione solo da domani....
+item.number_of_days=Perfavore inserire un numero di giorni, 1, o pi\u00f9....
+item.maximum_number_of_person_renting=Il numero massimo di persone che affittano questo oggetto \u00e8 ${reservMaxPersons} comunque tu hai richiesto: ${reservPersons} !
+item.product_not_available=Prodotto non disponibile, Prodotto: ${productId} messaggio: ${availableMessage}
+item.cannot_find_Fixed_Asset=Non \u00e8 possibile trovare un Cespite per il prodotto: ${productId}
+item.fixed_Asset_not_found=Cespite non trovato. Cespite: ${fixedAssetId}
+item.availableOk=OK
+item.availableQnt=Quantit\u00e0 richiesta: ${quantityReq} Quantit\u00e0 disponibile: ${quantityAvail}
+item.notAvailable=Sono spiacente, nessuna disponibilit\u00e0 a queste date: ${resultMessage} prodotto non aggiunto al carrello.....
 shoppinglistevents.added_product_to_cart = Aggiunto ${productId} prodotto al carrello.
 shoppinglistevents.cannot_create_new_shopping_list = Non \u00e8 possibile creare una nuova lista di acquisto.
 shoppinglistevents.choose_shopping_list = Perfavore scegliere una lista di acquisto.

Modified: incubator/ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartItem.java
URL: http://svn.apache.org/viewvc/incubator/ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartItem.java?view=diff&rev=439953&r1=439952&r2=439953
==============================================================================
--- incubator/ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartItem.java (original)
+++ incubator/ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartItem.java Sun Sep  3 23:59:08 2006
@@ -179,9 +179,12 @@
 
         // check to see if product is virtual
         if ("Y".equals(product.getString("isVirtual"))) {
-            String excMsg = "Tried to add the Virtual Product " + product.getString("productName") +
-                " (productId: " + product.getString("productId") + ") to the cart, not adding.";
+            Map messageMap = UtilMisc.toMap("productName", product.getString("productName"),
+                                            "productId", product.getString("productId"));            
 
+            String excMsg = UtilProperties.getMessage(resource, "item.cannot_add_product_virtual",
+                                          messageMap , cart.getLocale() );
+                
             Debug.logWarning(excMsg, module);
             throw new CartItemModifyException(excMsg);
         }
@@ -191,9 +194,12 @@
         // check to see if the product is fully configured
         if ("AGGREGATED".equals(product.getString("productTypeId"))) {
             if (configWrapper == null || !configWrapper.isCompleted()) {
-                String excMsg = "Tried to add the Product " + product.getString("productName") +
-                    " (productId: " + product.getString("productId") + ") to the cart, not adding: the product is not configured correctly.";
+                Map messageMap = UtilMisc.toMap("productName", product.getString("productName"),
+                                                "productId", product.getString("productId"));            
 
+                String excMsg = UtilProperties.getMessage(resource, "item.cannot_add_product_not_configured_correctly",
+                                              messageMap , cart.getLocale() );
+                
                 Debug.logWarning(excMsg, module);
                 throw new CartItemModifyException(excMsg);
             }
@@ -347,9 +353,12 @@
         boolean triggerExternalOps = triggerExternalOpsBool == null ? true : triggerExternalOpsBool.booleanValue();
     
         // check to see if product is virtual
-        if ("Y".equals(product.getString("isVirtual"))) {
-            String excMsg = "Tried to add the Virtual Product " + product.getString("productName") +
-                " (productId: " + product.getString("productId") + ") to the cart, not adding.";
+        if ("Y".equals(product.getString("isVirtual"))) {            
+            Map messageMap = UtilMisc.toMap("productName", product.getString("productName"),
+                                            "productId", product.getString("productId"));            
+
+            String excMsg = UtilProperties.getMessage(resource, "item.cannot_add_product_virtual",
+                                          messageMap , cart.getLocale() );
 
             Debug.logWarning(excMsg, module);
             throw new CartItemModifyException(excMsg);
@@ -359,45 +368,58 @@
         
         // check to see if introductionDate hasn't passed yet
         if (product.get("introductionDate") != null && nowTimestamp.before(product.getTimestamp("introductionDate"))) {
-            String excMsg = "Tried to add the Product " + product.getString("productName") +
-                " (productId: " + product.getString("productId") + ") to the cart. This product has not yet been made available for sale, so not adding.";
+            Map messageMap = UtilMisc.toMap("productName", product.getString("productName"),
+                                            "productId", product.getString("productId"));            
 
+            String excMsg = UtilProperties.getMessage(resource, "item.cannot_add_product_not_yet_available",
+                                          messageMap , cart.getLocale() );            
+            
             Debug.logWarning(excMsg, module);
             throw new CartItemModifyException(excMsg);
         }
         
         // check to see if salesDiscontinuationDate has passed
         if (product.get("salesDiscontinuationDate") != null && nowTimestamp.after(product.getTimestamp("salesDiscontinuationDate"))) {
-            String excMsg = "Tried to add the Product " + product.getString("productName") +
-                " (productId: " + product.getString("productId") + ") to the cart. This product is no longer available for sale, so not adding.";
+            Map messageMap = UtilMisc.toMap("productName", product.getString("productName"),
+                                            "productId", product.getString("productId"));            
+
+            String excMsg = UtilProperties.getMessage(resource, "item.cannot_add_product_no_longer_available",
+                                          messageMap , cart.getLocale() );
 
             Debug.logWarning(excMsg, module);
             throw new CartItemModifyException(excMsg);
         }
-
+
         // check to see if the product is a rental item
         if ("ASSET_USAGE".equals(product.getString("productTypeId"))) {
             if (reservStart == null)    {
-                String excMsg = "The starting date of the reservation is missing....";
+                String excMsg = UtilProperties.getMessage(resource, "item.missing_reservation_starting_date",
+                                              cart.getLocale() );                
                 throw new CartItemModifyException(excMsg);
             }
 
             if (reservStart.before(UtilDateTime.nowTimestamp()))    {
-                String excMsg = "You can only make reservation starting tomorrow....";
+                String excMsg = UtilProperties.getMessage(resource, "item.reservation_from_tomorrow",
+                                              cart.getLocale() );
                 throw new CartItemModifyException(excMsg);
             }
             newItem.setReservStart(reservStart);
 
             if (reservLength < 1)    {
-                String excMsg = "Please enter a number of days, 1, or more....";
+                String excMsg = UtilProperties.getMessage(resource, "item.number_of_days",
+                                              cart.getLocale() );                
                 throw new CartItemModifyException(excMsg);
             }
             newItem.setReservLength(reservLength);
-
+            
             if (product.get("reservMaxPersons") != null) {
                  double reservMaxPersons = product.getDouble("reservMaxPersons").doubleValue();
                  if (reservMaxPersons < reservPersons)    {
-                     String excMsg = "The maximum number of persons renting this object is " + product.getString("reservMaxPersons") + " however you have requested: " + reservPersons + " !";
+                     Map messageMap = UtilMisc.toMap("reservMaxPersons", product.getString("reservMaxPersons"),
+                                                     "reservPersons", (new Double(reservPersons)).toString());
+                     String excMsg = UtilProperties.getMessage(resource, "item.maximum_number_of_person_renting",
+                                                   messageMap, cart.getLocale() );
+                    
                      Debug.logInfo(excMsg,module);
                      throw new CartItemModifyException(excMsg);
                  }
@@ -413,7 +435,10 @@
             // check to see if the related fixed asset is available for rent
             String isAvailable = checkAvailability(product.getString("productId"), quantity, reservStart, reservLength, cart);
             if(isAvailable.compareTo("OK") != 0) {
-                String excMsg = "Product not available, ProductId:" + product.getString("productId") + " message:" + isAvailable.toString();
+                Map messageMap = UtilMisc.toMap("productId", product.getString("productId"),
+                                                "availableMessage", isAvailable.toString());
+                String excMsg = UtilProperties.getMessage(resource, "item.product_not_available",
+                                              messageMap, cart.getLocale() );                
                 Debug.logInfo(excMsg, module);
                 throw new CartItemModifyException(isAvailable);
             }
@@ -421,10 +446,11 @@
         
         // check to see if the product is fully configured
         if ("AGGREGATED".equals(product.getString("productTypeId"))) {
-            if (configWrapper == null || !configWrapper.isCompleted()) {
-                String excMsg = "Tried to add the Product " + product.getString("productName") +
-                    " (productId: " + product.getString("productId") + ") to the cart, not adding: the product is not configured correctly.";
-
+            if (configWrapper == null || !configWrapper.isCompleted()) {                
+                Map messageMap = UtilMisc.toMap("productName", product.getString("productName"),
+                                                "productId", product.getString("productId"));
+                String excMsg = UtilProperties.getMessage(resource, "item.cannot_add_product_not_configured_correctly",
+                                              messageMap , cart.getLocale() );
                 Debug.logWarning(excMsg, module);
                 throw new CartItemModifyException(excMsg);
             }
@@ -712,13 +738,17 @@
             List allFixedAssetProduct = delegator.findByAnd("FixedAssetProduct", UtilMisc.toMap("productId", productId, "fixedAssetProductTypeId", "FAPT_USE"));
             selFixedAssetProduct = EntityUtil.filterByDate(allFixedAssetProduct, UtilDateTime.nowTimestamp(), "fromDate", "thruDate", true);
         } catch (GenericEntityException e) {
-            return "Could not find a related Fixed Asset for the product: " + productId;
+            Map messageMap = UtilMisc.toMap("productId", productId);
+            String msg = UtilProperties.getMessage(resource, "item.cannot_find_Fixed_Asset", messageMap , cart.getLocale());                                      
+            return msg;
         }
         if (selFixedAssetProduct != null && selFixedAssetProduct.size() > 0) {
             Iterator firstOne = selFixedAssetProduct.iterator();
             fixedAssetProduct = (GenericValue) firstOne.next();
         } else {
-            return "Could not find a related Fixed Asset for the product: " + productId;
+            Map messageMap = UtilMisc.toMap("productId", productId);
+            String msg = UtilProperties.getMessage(resource, "item.cannot_find_Fixed_Asset", messageMap , cart.getLocale());
+            return msg;
         }
 
         // find the fixed asset itself
@@ -726,10 +756,14 @@
         try {
             fixedAsset = fixedAssetProduct.getRelatedOne("FixedAsset");
         } catch (GenericEntityException e) {
-            return "fixed_Asset_not_found. Fixed AssetId: " + fixedAssetProduct.getString("fixedAssetId");
+            Map messageMap = UtilMisc.toMap("fixedAssetId", fixedAssetProduct.getString("fixedAssetId"));
+            String msg = UtilProperties.getMessage(resource, "item.fixed_Asset_not_found", messageMap , cart.getLocale());
+            return msg;
         }
         if (fixedAsset == null) {
-            return "fixed_Asset_not_found. Fixed AssetId: " + fixedAssetProduct.getString("fixedAssetId");
+            Map messageMap = UtilMisc.toMap("fixedAssetId", fixedAssetProduct.getString("fixedAssetId"));
+            String msg = UtilProperties.getMessage(resource, "item.fixed_Asset_not_found", messageMap , cart.getLocale());
+            return msg;            
         }
         //Debug.logInfo("Checking availability for product: " + productId.toString() + " and related FixedAsset: " + fixedAssetProduct.getString("fixedAssetId"),module);
 
@@ -740,9 +774,13 @@
         } catch (GenericEntityException e) {
             // no calendar ok, when not more that total capacity
             if (fixedAsset.getDouble("productionCapacity").doubleValue() >= quantity) {
-                return "OK";
+                String msg = UtilProperties.getMessage(resource, "item.availableOk", cart.getLocale());
+                return msg;
             } else {
-                return "Quantity requested: " + quantity + " Quantity available: " + fixedAsset.getString("productionCapacity");
+                Map messageMap = UtilMisc.toMap("quantityReq", (new Double(quantity)).toString(),
+                                                "quantityAvail", fixedAsset.getString("productionCapacity"));
+                String msg = UtilProperties.getMessage(resource, "item.availableQnt", messageMap , cart.getLocale());
+                return msg;
             }
         }
         // now find all the dates and check the availabilty for each date
@@ -785,10 +823,15 @@
                 }
             }
         }
-        if (resultMessage.compareTo("") == 0)
-            return "OK";
-        else
-            return "I am sorry, not available at these dates: " + resultMessage + "item not added to the shopping cart.....";
+        if (resultMessage.compareTo("") == 0) {        
+            String msg = UtilProperties.getMessage(resource, "item.availableOk", cart.getLocale());
+            return msg;
+        }
+        else {
+            Map messageMap = UtilMisc.toMap("resultMessage", resultMessage);
+            String msg = UtilProperties.getMessage(resource, "item.notAvailable", messageMap, cart.getLocale());
+            return msg;            
+        }
     }
 
     protected void setQuantity(int quantity, LocalDispatcher dispatcher, ShoppingCart cart, boolean triggerExternalOps, boolean resetShipGroup, boolean updateProductPrice) throws CartItemModifyException {