svn commit: r1533601 - in /ofbiz/branches/release13.07: ./ applications/manufacturing/webapp/manufacturing/WEB-INF/actions/bom/FindProductBom.groovy

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

svn commit: r1533601 - in /ofbiz/branches/release13.07: ./ applications/manufacturing/webapp/manufacturing/WEB-INF/actions/bom/FindProductBom.groovy

jleroux@apache.org
Author: jleroux
Date: Fri Oct 18 19:31:05 2013
New Revision: 1533601

URL: http://svn.apache.org/r1533601
Log:
"Applied fix from trunk for revisions: 1524676 + 1524769"
------------------------------------------------------------------------
r1524769 | jleroux | 2013-09-19 17:20:17 +0200 (jeu. 19 sept. 2013) | 3 lignes

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/branches/release13.07/   (props changed)
    ofbiz/branches/release13.07/applications/manufacturing/webapp/manufacturing/WEB-INF/actions/bom/FindProductBom.groovy

Propchange: ofbiz/branches/release13.07/
------------------------------------------------------------------------------
  Merged /ofbiz/trunk:r1524676,1524769

Modified: ofbiz/branches/release13.07/applications/manufacturing/webapp/manufacturing/WEB-INF/actions/bom/FindProductBom.groovy
URL: http://svn.apache.org/viewvc/ofbiz/branches/release13.07/applications/manufacturing/webapp/manufacturing/WEB-INF/actions/bom/FindProductBom.groovy?rev=1533601&r1=1533600&r2=1533601&view=diff
==============================================================================
--- ofbiz/branches/release13.07/applications/manufacturing/webapp/manufacturing/WEB-INF/actions/bom/FindProductBom.groovy (original)
+++ ofbiz/branches/release13.07/applications/manufacturing/webapp/manufacturing/WEB-INF/actions/bom/FindProductBom.groovy Fri Oct 18 19:31:05 2013
@@ -17,42 +17,32 @@
  * under the License.
  */
 
-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;
 
-if (!parameters.productId && !parameters.productIdTo && !parameters.productAssocTypeId) {
+fieldToSelect = ["productId", "internalName", "productAssocTypeId"] as Set;
+orderBy = ["productId", "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);
-    fieldToSelect = UtilMisc.toSet("productId","internalName","productAssocTypeId");
-    bomListIterator = delegator.find("ProductAndAssoc", cond, null, fieldToSelect, null, 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);
-    fieldToSelect = UtilMisc.toSet("productId","internalName","productAssocTypeId");
-    bomListIterator = delegator.find("ProductAndAssoc", cond, null, fieldToSelect, null, 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;