From bd4a0f3592df5dec55dcda6857bc613ddc8feaa8 Mon Sep 17 00:00:00 2001 From: Jacques Le Roux Date: Fri, 25 Dec 2020 17:02:52 +0100 Subject: [PATCH] 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 --- .../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 8e8aefcde7..b5f05bd6bd 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 @@ -42,6 +42,7 @@ import org.apache.ofbiz.entity.GenericValue; import org.apache.ofbiz.entity.condition.EntityCondition; 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; @@ -73,7 +74,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);