You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by ja...@apache.org on 2007/04/12 23:05:36 UTC

svn commit: r528234 - /ofbiz/trunk/applications/product/src/org/ofbiz/product/category/CategoryServices.java

Author: jaz
Date: Thu Apr 12 14:05:35 2007
New Revision: 528234

URL: http://svn.apache.org/viewvc?view=rev&rev=528234
Log:
fixed listsize index after filtering view allows

Modified:
    ofbiz/trunk/applications/product/src/org/ofbiz/product/category/CategoryServices.java

Modified: ofbiz/trunk/applications/product/src/org/ofbiz/product/category/CategoryServices.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/src/org/ofbiz/product/category/CategoryServices.java?view=diff&rev=528234&r1=528233&r2=528234
==============================================================================
--- ofbiz/trunk/applications/product/src/org/ofbiz/product/category/CategoryServices.java (original)
+++ ofbiz/trunk/applications/product/src/org/ofbiz/product/category/CategoryServices.java Thu Apr 12 14:05:35 2007
@@ -182,10 +182,10 @@
         
         String prodCatalogId = (String) context.get("prodCatalogId");
 
-        boolean useCacheForMembers = (context.get("useCacheForMembers") != null ? ((Boolean) context.get("useCacheForMembers")).booleanValue() : true);
-        boolean activeOnly = (context.get("activeOnly") != null ? ((Boolean) context.get("activeOnly")).booleanValue() : true);
+        boolean useCacheForMembers = (context.get("useCacheForMembers") == null || ((Boolean) context.get("useCacheForMembers")).booleanValue());
+        boolean activeOnly = (context.get("activeOnly") == null || ((Boolean) context.get("activeOnly")).booleanValue());
         // checkViewAllow defaults to false, must be set to true and pass the prodCatalogId to enable
-        boolean checkViewAllow = (context.get("checkViewAllow") != null ? ((Boolean) context.get("checkViewAllow")).booleanValue() : false);
+        boolean checkViewAllow = (context.get("checkViewAllow") != null && ((Boolean) context.get("checkViewAllow")).booleanValue());
         
         Timestamp nowTimestamp = UtilDateTime.nowTimestamp();
 
@@ -219,6 +219,9 @@
             // get the indexes for the partial list
             lowIndex = (((viewIndex - 1) * viewSize) + 1);
             highIndex = viewIndex * viewSize;
+        } else {
+            lowIndex = 0;
+            highIndex = 0;
         }
         
         List productCategoryMembers = null;
@@ -282,6 +285,10 @@
                     String viewProductCategoryId = CatalogWorker.getCatalogViewAllowCategoryId(delegator, prodCatalogId);
                     if (viewProductCategoryId != null) {
                         productCategoryMembers = CategoryWorker.filterProductsInCategory(delegator, productCategoryMembers, viewProductCategoryId);
+                        listSize = productCategoryMembers.size();
+                        if (highIndex > listSize) {
+                            highIndex = listSize;
+                        }
                     }
                 }
             } catch (GenericEntityException e) {