svn commit: r1057000 - in /ofbiz/trunk/applications/order: config/OrderUiLabels.xml src/org/ofbiz/order/quote/QuoteServices.java src/org/ofbiz/order/shoppingcart/ShoppingCartHelper.java

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

svn commit: r1057000 - in /ofbiz/trunk/applications/order: config/OrderUiLabels.xml src/org/ofbiz/order/quote/QuoteServices.java src/org/ofbiz/order/shoppingcart/ShoppingCartHelper.java

mrisaliti
Author: mrisaliti
Date: Sun Jan  9 18:56:53 2011
New Revision: 1057000

URL: http://svn.apache.org/viewvc?rev=1057000&view=rev
Log:
Internationalization of ServiceUtil.returnSuccess, ServiceUtil.returnFailure, ServiceUtil.returnError (OFBIZ-4091)

Modified:
    ofbiz/trunk/applications/order/config/OrderUiLabels.xml
    ofbiz/trunk/applications/order/src/org/ofbiz/order/quote/QuoteServices.java
    ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartHelper.java

Modified: ofbiz/trunk/applications/order/config/OrderUiLabels.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/config/OrderUiLabels.xml?rev=1057000&r1=1056999&r2=1057000&view=diff
==============================================================================
--- ofbiz/trunk/applications/order/config/OrderUiLabels.xml (original)
+++ ofbiz/trunk/applications/order/config/OrderUiLabels.xml Sun Jan  9 18:56:53 2011
@@ -6298,6 +6298,14 @@
         <value xml:lang="zh_CN">平均成本</value>
         <value xml:lang="zh_TW">平均成本</value>
     </property>
+    <property key="OrderOrderQuoteCannotBeFound">
+        <value xml:lang="en">Could not find Quote with ID ${quoteId}</value>
+        <value xml:lang="it">Non è possibile trovare il preventivo ${quoteId}</value>
+    </property>
+    <property key="OrderOrderQuoteCannotBeStored">
+        <value xml:lang="en">Could not storing Quote</value>
+        <value xml:lang="it">Non è possibile registrare il preventivo</value>
+    </property>
     <property key="OrderOrderQuoteCoeffName">
         <value xml:lang="de">Koeffizient Name</value>
         <value xml:lang="en">Coeff. Name</value>
@@ -9140,6 +9148,10 @@
         <value xml:lang="zh_CN">制造需求按日期</value>
         <value xml:lang="zh_TW">按日期的生產需求</value>
     </property>
+    <property key="OrderRequirementDoesNotExists">
+        <value xml:lang="en">Requirement with id ${requirementId} doesn't exist.</value>
+        <value xml:lang="it">Fabbisogno ${requirementId} non esiste</value>
+    </property>
     <property key="OrderRequirementId">
         <value xml:lang="de">Bedarf ID</value>
         <value xml:lang="en">RequirementId</value>

Modified: ofbiz/trunk/applications/order/src/org/ofbiz/order/quote/QuoteServices.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/src/org/ofbiz/order/quote/QuoteServices.java?rev=1057000&r1=1056999&r2=1057000&view=diff
==============================================================================
--- ofbiz/trunk/applications/order/src/org/ofbiz/order/quote/QuoteServices.java (original)
+++ ofbiz/trunk/applications/order/src/org/ofbiz/order/quote/QuoteServices.java Sun Jan  9 18:56:53 2011
@@ -45,6 +45,7 @@ public class QuoteServices {
     public static final String module = QuoteServices.class.getName();
     public static final String resource = "OrderUiLabels";
     public static final String resource_error = "OrderErrorUiLabels";
+    public static final String resourceProduct = "ProductUiLabels";
 
     public static Map<String, Object> sendQuoteReportMail(DispatchContext dctx, Map<String, ? extends Object> context) {
         LocalDispatcher dispatcher = dctx.getDispatcher();
@@ -69,7 +70,9 @@ public class QuoteServices {
         }
 
         if (quote == null) {
-            return ServiceUtil.returnFailure("Could not find Quote with ID [" + quoteId + "]");
+            return ServiceUtil.returnError(UtilProperties.getMessage(resource,
+                    "OrderOrderQuoteCannotBeFound",
+                    UtilMisc.toMap("quoteId", quoteId), locale));
         }
 
         GenericValue productStoreEmail = null;
@@ -79,18 +82,25 @@ public class QuoteServices {
             Debug.logError(e, "Problem getting the ProductStoreEmailSetting for productStoreId=" + quote.get("productStoreId") + " and emailType=" + emailType, module);
         }
         if (productStoreEmail == null) {
-            return ServiceUtil.returnFailure("No valid email setting for store with productStoreId=" + quote.get("productStoreId") + " and emailType=" + emailType);
+            return ServiceUtil.returnFailure(UtilProperties.getMessage(resourceProduct,
+                    "ProductProductStoreEmailSettingsNotValid",
+                    UtilMisc.toMap("productStoreId", quote.get("productStoreId"),
+                            "emailType", emailType), locale));
         }
         String bodyScreenLocation = productStoreEmail.getString("bodyScreenLocation");
         if (UtilValidate.isEmpty(bodyScreenLocation)) {
-            return ServiceUtil.returnFailure("No valid bodyScreenLocation in email setting for store with productStoreId=" + quote.get("productStoreId") + " and emailType=" + emailType);
+            return ServiceUtil.returnFailure(UtilProperties.getMessage(resourceProduct,
+                    "ProductProductStoreEmailSettingsNotValidBodyScreenLocation",
+                    UtilMisc.toMap("productStoreId", quote.get("productStoreId"),
+                            "emailType", emailType), locale));
         }
         sendMap.put("bodyScreenUri", bodyScreenLocation);
         String xslfoAttachScreenLocation = productStoreEmail.getString("xslfoAttachScreenLocation");
         sendMap.put("xslfoAttachScreenLocation", xslfoAttachScreenLocation);
 
         if ((sendTo == null) || !UtilValidate.isEmail(sendTo)) {
-            return ServiceUtil.returnError("No sendTo email address found");
+            return ServiceUtil.returnError(UtilProperties.getMessage(resourceProduct,
+                    "ProductProductStoreEmailSettingsNoSendToFound", locale));
         }
 
         Map<String, Object> bodyParameters = UtilMisc.<String, Object>toMap("quoteId", quoteId, "userLogin", userLogin, "locale", locale);
@@ -132,7 +142,6 @@ public class QuoteServices {
     public static Map<String, Object> storeQuote(DispatchContext dctx, Map<String, ? extends Object> context) {
         LocalDispatcher dispatcher = dctx.getDispatcher();
         GenericValue userLogin = (GenericValue) context.get("userLogin");
-
         String quoteTypeId = (String) context.get("quoteTypeId");
         String partyId = (String) context.get("partyId");
         Timestamp issueDate = (Timestamp) context.get("issueDate");
@@ -150,6 +159,7 @@ public class QuoteServices {
         List<GenericValue> quoteRoles = UtilGenerics.checkList(context.get("quoteRoles"));
         List<GenericValue> quoteWorkEfforts = UtilGenerics.checkList(context.get("quoteWorkEfforts"));
         List<GenericValue> quoteAdjustments = UtilGenerics.checkList(context.get("quoteAdjustments"));
+        Locale locale = (Locale) context.get("locale");
         
         //TODO create Quote Terms still to be implemented
         //List<GenericValue> quoteTerms = UtilGenerics.cast(context.get("quoteTerms"));
@@ -261,7 +271,8 @@ public class QuoteServices {
                 //TODO create Quote Terms still to be implemented the base service createQuoteTerm
                 //TODO create Quote Term Attributes still to be implemented the base service createQuoteTermAttribute
             } else {
-                return ServiceUtil.returnFailure("Could not storing Quote");
+                return ServiceUtil.returnFailure(UtilProperties.getMessage(resource,
+                        "OrderOrderQuoteCannotBeStored", locale));
             }
         } catch (GenericServiceException e) {
             Debug.logError(e, "Problem storing Quote", module);

Modified: ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartHelper.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartHelper.java?rev=1057000&r1=1056999&r2=1057000&view=diff
==============================================================================
--- ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartHelper.java (original)
+++ ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartHelper.java Sun Jan  9 18:56:53 2011
@@ -495,7 +495,9 @@ public class ShoppingCartHelper {
                 } catch (GenericEntityException gee) {
                 }
                 if (requirement == null) {
-                    return ServiceUtil.returnError("Requirement with id [" + requirementId + "] doesn't exist.");
+                    return ServiceUtil.returnFailure(UtilProperties.getMessage(resource,
+                            "OrderRequirementDoesNotExists",
+                            UtilMisc.toMap("requirementId", requirementId), cart.getLocale()));
                 }
 
                 if (UtilValidate.isNotEmpty(quantStr)) {