You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by jl...@apache.org on 2013/09/19 12:17:46 UTC

svn commit: r1524676 - /ofbiz/trunk/applications/manufacturing/webapp/manufacturing/WEB-INF/actions/bom/FindProductBom.groovy

Author: jleroux
Date: Thu Sep 19 10:17:46 2013
New Revision: 1524676

URL: http://svn.apache.org/r1524676
Log:
A modified patch from  Anahita Goljahani  for "Overview of Bills of Material doesn't paginate" https://issues.apache.org/jira/browse/OFBIZ-5324

When having more than 20 BoM's in Manufacturing the overview doesn't paginate.

jleroux; I'm not quite sure why an orderBy was necessary but it works and is a simple enough solution. I refactored things a bit and kept find instead of proposed findList. So this just add an orderBy to the find

Modified:
    ofbiz/trunk/applications/manufacturing/webapp/manufacturing/WEB-INF/actions/bom/FindProductBom.groovy

Modified: ofbiz/trunk/applications/manufacturing/webapp/manufacturing/WEB-INF/actions/bom/FindProductBom.groovy
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/manufacturing/webapp/manufacturing/WEB-INF/actions/bom/FindProductBom.groovy?rev=1524676&r1=1524675&r2=1524676&view=diff
==============================================================================
--- ofbiz/trunk/applications/manufacturing/webapp/manufacturing/WEB-INF/actions/bom/FindProductBom.groovy (original)
+++ ofbiz/trunk/applications/manufacturing/webapp/manufacturing/WEB-INF/actions/bom/FindProductBom.groovy Thu Sep 19 10:17:46 2013
@@ -20,17 +20,16 @@
 import org.ofbiz.base.util.*;
 import org.ofbiz.entity.util.*;
 import org.ofbiz.entity.condition.*;
-import javolution.util.FastList;
-import javolution.util.FastSet;
-import javolution.util.FastMap;
+
+fieldToSelect = ["productId", "internalName", "productAssocTypeId"] as Set;
+orderBy = ["productId", "productAssocTypeId"];
 
 if (!parameters.productId && !parameters.productIdTo && !parameters.productAssocTypeId) {
     cond = EntityCondition.makeCondition([EntityCondition.makeCondition("productAssocTypeId", EntityOperator.EQUALS, "ENGINEER_COMPONENT"),
                                           EntityCondition.makeCondition("productAssocTypeId", EntityOperator.EQUALS, "MANUF_COMPONENT")
                                           ], EntityOperator.OR);
     findOpts = new EntityFindOptions(true, EntityFindOptions.TYPE_SCROLL_INSENSITIVE, EntityFindOptions.CONCUR_READ_ONLY, true);
-    fieldToSelect = UtilMisc.toSet("productId","internalName","productAssocTypeId");
-    bomListIterator = delegator.find("ProductAndAssoc", cond, null, fieldToSelect, null, findOpts);
+    bomListIterator = delegator.find("ProductAndAssoc", cond, null, fieldToSelect, orderBy, findOpts);
 } else {
     condList = [];
     if (parameters.productId) {
@@ -52,7 +51,6 @@ if (!parameters.productId && !parameters
     }
     cond =  EntityCondition.makeCondition(condList, EntityOperator.AND);
     findOpts = new EntityFindOptions(true, EntityFindOptions.TYPE_SCROLL_INSENSITIVE, EntityFindOptions.CONCUR_READ_ONLY, true);
-    fieldToSelect = UtilMisc.toSet("productId","internalName","productAssocTypeId");
-    bomListIterator = delegator.find("ProductAndAssoc", cond, null, fieldToSelect, null, findOpts);
+    bomListIterator = delegator.find("ProductAndAssoc", cond, null, fieldToSelect, orderBy, findOpts);
 }
 context.ListProductBom = bomListIterator;