Author: jleroux Date: Thu Sep 19 15:20:17 2013 New Revision: 1524769 URL: http://svn.apache.org/r1524769 Log: A patch from Anahita Goljahani for "Overview of Bills of Material doesn't paginate" https://issues.apache.org/jira/browse/OFBIZ-5324
Just for seek of tidiness, I attached another patch that removes redundant code in FindProductBom.groovy, without changing its behavior. 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=1524769&r1=1524768&r2=1524769&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 15:20:17 2013 @@ -17,40 +17,32 @@ * under the License. */ -import org.ofbiz.base.util.*; import org.ofbiz.entity.util.*; import org.ofbiz.entity.condition.*; fieldToSelect = ["productId", "internalName", "productAssocTypeId"] as Set; orderBy = ["productId", "productAssocTypeId"]; -if (!parameters.productId && !parameters.productIdTo && !parameters.productAssocTypeId) { +condList = []; +if (parameters.productId) { + cond = EntityCondition.makeCondition("productId", EntityOperator.EQUALS, parameters.productId); + condList.add(cond); +} +if (parameters.productIdTo) { + cond = EntityCondition.makeCondition("productIdTo", EntityOperator.EQUALS, parameters.productIdTo); + condList.add(cond); +} +if (parameters.productAssocTypeId) { + cond = EntityCondition.makeCondition("productAssocTypeId", EntityOperator.EQUALS, parameters.productAssocTypeId); + condList.add(cond); +} else { 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); - bomListIterator = delegator.find("ProductAndAssoc", cond, null, fieldToSelect, orderBy, findOpts); -} else { - condList = []; - if (parameters.productId) { - cond = EntityCondition.makeCondition("productId", EntityOperator.EQUALS, parameters.productId); - condList.add(cond); - } - if (parameters.productIdTo) { - cond = EntityCondition.makeCondition("productIdTo", EntityOperator.EQUALS, parameters.productIdTo); - condList.add(cond); - } - if (parameters.productAssocTypeId) { - cond = EntityCondition.makeCondition("productAssocTypeId", EntityOperator.EQUALS, parameters.productAssocTypeId); - condList.add(cond); - } else { - cond = EntityCondition.makeCondition([EntityCondition.makeCondition("productAssocTypeId", EntityOperator.EQUALS, "ENGINEER_COMPONENT"), - EntityCondition.makeCondition("productAssocTypeId", EntityOperator.EQUALS, "MANUF_COMPONENT") - ], EntityOperator.OR); - condList.add(cond); - } - cond = EntityCondition.makeCondition(condList, EntityOperator.AND); - findOpts = new EntityFindOptions(true, EntityFindOptions.TYPE_SCROLL_INSENSITIVE, EntityFindOptions.CONCUR_READ_ONLY, true); - bomListIterator = delegator.find("ProductAndAssoc", cond, null, fieldToSelect, orderBy, findOpts); + condList.add(cond); } +cond = EntityCondition.makeCondition(condList, EntityOperator.AND); +findOpts = new EntityFindOptions(true, EntityFindOptions.TYPE_SCROLL_INSENSITIVE, EntityFindOptions.CONCUR_READ_ONLY, true); +bomListIterator = delegator.find("ProductAndAssoc", cond, null, fieldToSelect, orderBy, findOpts); + context.ListProductBom = bomListIterator;