[ofbiz-framework] branch release17.12 updated: Improved: Remove hardcoded product category on CategoryWorker.getCatalogTopCategory (OFBIZ-12078)

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

[ofbiz-framework] branch release17.12 updated: Improved: Remove hardcoded product category on CategoryWorker.getCatalogTopCategory (OFBIZ-12078)

jleroux@apache.org
This is an automated email from the ASF dual-hosted git repository.

jleroux pushed a commit to branch release17.12
in repository https://gitbox.apache.org/repos/asf/ofbiz-framework.git


The following commit(s) were added to refs/heads/release17.12 by this push:
     new d13264b  Improved: Remove hardcoded product category on CategoryWorker.getCatalogTopCategory (OFBIZ-12078)
d13264b is described below

commit d13264b584e0bc1ef8db320c2078e8a30314fd64
Author: Jacques Le Roux <[hidden email]>
AuthorDate: Fri Dec 25 17:02:52 2020 +0100

    Improved: Remove hardcoded product category on CategoryWorker.getCatalogTopCategory (OFBIZ-12078)
   
    When you call the java function
    org.apache.ofbiz.product.category.CategoryWorker.getCatalogTopCategory()
    the catalog returned if the system failed found it is hardcoded and don't use an
    existing property : catalog->top.category.default
   
    Thanks: Nicolas
   
    Conflicts handled by hand:
    applications/product/src/main/java/org/apache/ofbiz/product/category/CategoryWorker.java
---
 .../main/java/org/apache/ofbiz/product/category/CategoryWorker.java   | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/applications/product/src/main/java/org/apache/ofbiz/product/category/CategoryWorker.java b/applications/product/src/main/java/org/apache/ofbiz/product/category/CategoryWorker.java
index 0453abb..a5c63d6 100644
--- a/applications/product/src/main/java/org/apache/ofbiz/product/category/CategoryWorker.java
+++ b/applications/product/src/main/java/org/apache/ofbiz/product/category/CategoryWorker.java
@@ -44,6 +44,7 @@ import org.apache.ofbiz.entity.condition.EntityCondition;
 import org.apache.ofbiz.entity.condition.EntityOperator;
 import org.apache.ofbiz.entity.util.EntityQuery;
 import org.apache.ofbiz.entity.util.EntityUtil;
+import org.apache.ofbiz.entity.util.EntityUtilProperties;
 import org.apache.ofbiz.product.product.ProductWorker;
 import org.apache.ofbiz.service.DispatchContext;
 import org.apache.ofbiz.service.ServiceUtil;
@@ -75,7 +76,8 @@ public final class CategoryWorker {
         if (topCatName == null)
             topCatName = defaultTopCategory;
         if (topCatName == null)
-            topCatName = "CATALOG1";
+            topCatName = EntityUtilProperties.getPropertyValue("catalog", "top.category.default", "CATALOG1",
+                    (Delegator) request.getAttribute("delegator"));
 
         if (!fromSession) {
             if (Debug.infoOn()) Debug.logInfo("[CategoryWorker.getCatalogTopCategory] Setting new top category: " + topCatName, module);