Author: jacopoc
Date: Tue Dec 13 07:05:25 2011
New Revision: 1213578
URL:
http://svn.apache.org/viewvc?rev=1213578&view=revLog:
Backported rev. 836279 to fix pagination and unconstrained searches of shipments; this also fixes OFBIZ-3002
Modified:
ofbiz/branches/release09.04/applications/product/webapp/facility/WEB-INF/actions/shipment/FindShipment.groovy
Modified: ofbiz/branches/release09.04/applications/product/webapp/facility/WEB-INF/actions/shipment/FindShipment.groovy
URL:
http://svn.apache.org/viewvc/ofbiz/branches/release09.04/applications/product/webapp/facility/WEB-INF/actions/shipment/FindShipment.groovy?rev=1213578&r1=1213577&r2=1213578&view=diff==============================================================================
--- ofbiz/branches/release09.04/applications/product/webapp/facility/WEB-INF/actions/shipment/FindShipment.groovy (original)
+++ ofbiz/branches/release09.04/applications/product/webapp/facility/WEB-INF/actions/shipment/FindShipment.groovy Tue Dec 13 07:05:25 2011
@@ -90,13 +90,14 @@ if (maxDate && maxDate.length() > 8) {
paramListBuffer.append(maxDate);
findShipmentExprs.add(EntityCondition.makeCondition("estimatedShipDate", EntityOperator.LESS_THAN_EQUAL_TO, ObjectType.simpleTypeConvert(maxDate, "Timestamp", null, null)));
}
-
if ("Y".equals(lookupFlag)) {
context.paramList = paramListBuffer.toString();
- if (findShipmentExprs.size() > 0) {
findOpts = new EntityFindOptions(true, EntityFindOptions.TYPE_SCROLL_INSENSITIVE, EntityFindOptions.CONCUR_READ_ONLY, true);
- mainCond = EntityCondition.makeCondition(findShipmentExprs, EntityOperator.AND);
+ mainCond = null;
+ if (findShipmentExprs.size() > 0) {
+ mainCond = EntityCondition.makeCondition(findShipmentExprs, EntityOperator.AND);
+ }
orderBy = ['-estimatedShipDate'];
beganTransaction = false;
@@ -107,8 +108,8 @@ if ("Y".equals(lookupFlag)) {
orli = delegator.find("Shipment", mainCond, null, null, orderBy, findOpts);
// get the indexes for the partial list
- lowIndex = (((viewIndex - 1) * viewSize) + 1);
- highIndex = viewIndex * viewSize;
+ lowIndex = viewIndex * viewSize + 1;
+ highIndex = (viewIndex + 1) * viewSize;
// attempt to get the full size
orli.last();
@@ -142,12 +143,6 @@ if ("Y".equals(lookupFlag)) {
// only commit the transaction if we started one... this will throw an exception if it fails
TransactionUtil.commit(beganTransaction);
}
- } else {
- shipmentList = [] as ArrayList;
- shipmentListSize = 0;
- highIndex = 0;
- lowIndex = 0;
- }
context.shipmentList = shipmentList;
context.listSize = shipmentListSize;