svn commit: r1245324 - in /ofbiz/trunk: applications/product/src/org/ofbiz/product/price/PriceServices.java framework/entity/src/org/ofbiz/entity/util/EntityUtilProperties.java

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

svn commit: r1245324 - in /ofbiz/trunk: applications/product/src/org/ofbiz/product/price/PriceServices.java framework/entity/src/org/ofbiz/entity/util/EntityUtilProperties.java

hansbak-2
Author: hansbak
Date: Fri Feb 17 06:13:28 2012
New Revision: 1245324

URL: http://svn.apache.org/viewvc?rev=1245324&view=rev
Log:
OFBIZ-4698: the price service check the currency.uom.id.default property from a system propery. Thanks Chattree for the contribution

Modified:
    ofbiz/trunk/applications/product/src/org/ofbiz/product/price/PriceServices.java
    ofbiz/trunk/framework/entity/src/org/ofbiz/entity/util/EntityUtilProperties.java

Modified: ofbiz/trunk/applications/product/src/org/ofbiz/product/price/PriceServices.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/src/org/ofbiz/product/price/PriceServices.java?rev=1245324&r1=1245323&r2=1245324&view=diff
==============================================================================
--- ofbiz/trunk/applications/product/src/org/ofbiz/product/price/PriceServices.java (original)
+++ ofbiz/trunk/applications/product/src/org/ofbiz/product/price/PriceServices.java Fri Feb 17 06:13:28 2012
@@ -44,6 +44,7 @@ import org.ofbiz.entity.GenericValue;
 import org.ofbiz.entity.condition.EntityCondition;
 import org.ofbiz.entity.condition.EntityOperator;
 import org.ofbiz.entity.util.EntityUtil;
+import org.ofbiz.entity.util.EntityUtilProperties;
 import org.ofbiz.product.product.ProductWorker;
 import org.ofbiz.service.DispatchContext;
 import org.ofbiz.service.GenericServiceException;
@@ -147,7 +148,7 @@ public class PriceServices {
         String currencyDefaultUomId = (String) context.get("currencyUomId");
         String currencyUomIdTo = (String) context.get("currencyUomIdTo");
         if (UtilValidate.isEmpty(currencyDefaultUomId)) {
-            currencyDefaultUomId = UtilProperties.getPropertyValue("general", "currency.uom.id.default", "USD");
+            currencyDefaultUomId = EntityUtilProperties.getPropertyValue("general", "currency.uom.id.default", "USD", delegator);
         }
 
         // productPricePurposeId is null assume "PURCHASE", which is equivalent to what prices were before the purpose concept

Modified: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/util/EntityUtilProperties.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/util/EntityUtilProperties.java?rev=1245324&r1=1245323&r2=1245324&view=diff
==============================================================================
--- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/util/EntityUtilProperties.java (original)
+++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/util/EntityUtilProperties.java Fri Feb 17 06:13:28 2012
@@ -46,8 +46,13 @@ public class EntityUtilProperties implem
     public final static String module = EntityUtilProperties.class.getName();
     
     protected static String getSystemPropertyValue(String resource, String name, Delegator delegator) {
+        if (resource == null || resource.length() <= 0) {
+            return null;
+        }
         if (name == null || name.length() <= 0) return null;
         
+        resource = resource.replace(".properties", "");
+        
         // find system property
         try {
             GenericValue systemProperty = delegator.findOne("SystemProperty", UtilMisc.toMap("systemResourceId", resource, "systemPropertyId", name), false);
@@ -81,7 +86,7 @@ public class EntityUtilProperties implem
         if (UtilValidate.isEmpty(value)) {
             value = UtilProperties.getPropertyValue(resource, name);
         }
-        return UtilProperties.getPropertyValue(resource, name, defaultValue);
+        return value;
     }
 
     public static double getPropertyNumber(String resource, String name, double defaultValue) {