Author: mridulpathak
Date: Sat Jun 18 10:28:22 2016
New Revision: 1748953

URL: http://svn.apache.org/viewvc?rev=1748953&view=rev
Log:
[OFBIZ-7186] Find Facility Inventory Items shows same 20 items on all 
pagination page. Thanks Arvind Singh Tomar for reporting the issue and 
providing the patch. Thanks Montalbano Florian for your contribution. Migrating 
fix from trunk r1748950.

Modified:
    
ofbiz/branches/release15.12/applications/product/webapp/facility/WEB-INF/actions/facility/ViewFacilityInventoryByProduct.groovy
    
ofbiz/branches/release15.12/applications/product/widget/facility/FacilityForms.xml
    
ofbiz/branches/release15.12/applications/product/widget/facility/FacilityScreens.xml

Modified: 
ofbiz/branches/release15.12/applications/product/webapp/facility/WEB-INF/actions/facility/ViewFacilityInventoryByProduct.groovy
URL: 
http://svn.apache.org/viewvc/ofbiz/branches/release15.12/applications/product/webapp/facility/WEB-INF/actions/facility/ViewFacilityInventoryByProduct.groovy?rev=1748953&r1=1748952&r2=1748953&view=diff
==============================================================================
--- 
ofbiz/branches/release15.12/applications/product/webapp/facility/WEB-INF/actions/facility/ViewFacilityInventoryByProduct.groovy
 (original)
+++ 
ofbiz/branches/release15.12/applications/product/webapp/facility/WEB-INF/actions/facility/ViewFacilityInventoryByProduct.groovy
 Sat Jun 18 10:28:22 2016
@@ -39,6 +39,7 @@ hasOffsetQOH = false;
 hasOffsetATP = false;
 
 rows = [] as ArrayList;
+int listSize = 0; // The complete size of the list of result (for pagination)
 
 if (action) {
     // ------------------------------
@@ -124,11 +125,15 @@ if (action) {
     whereCondition = EntityCondition.makeCondition(whereConditionsList, 
EntityOperator.AND);
 
     beganTransaction = false;
+    // get the indexes for the partial list
+    lowIndex = ((viewIndex.intValue() * viewSize.intValue()) + 1);
+    highIndex = (viewIndex.intValue() + 1) * viewSize.intValue();
     List prods = null;
     try {
         beganTransaction = TransactionUtil.begin();
         prodsEli = 
from(prodView).where(whereCondition).orderBy("productId").cursorScrollInsensitive().distinct().queryIterator();
-        prods = prodsEli.getCompleteList();
+        prods = prodsEli.getPartialList(lowIndex, highIndex);
+        listSize = prodsEli.getResultsSizeAfterPartialList();
         prodsEli.close();
     } catch (GenericEntityException e) {
         errMsg = "Failure in operation, rolling back transaction";
@@ -198,6 +203,7 @@ if (action) {
         }
     }
 }
-context.overrideListSize = rows.size();
+
+context.overrideListSize = listSize;
 context.inventoryByProduct = rows;
 context.searchParameterString = searchParameterString;

Modified: 
ofbiz/branches/release15.12/applications/product/widget/facility/FacilityForms.xml
URL: 
http://svn.apache.org/viewvc/ofbiz/branches/release15.12/applications/product/widget/facility/FacilityForms.xml?rev=1748953&r1=1748952&r2=1748953&view=diff
==============================================================================
--- 
ofbiz/branches/release15.12/applications/product/widget/facility/FacilityForms.xml
 (original)
+++ 
ofbiz/branches/release15.12/applications/product/widget/facility/FacilityForms.xml
 Sat Jun 18 10:28:22 2016
@@ -433,7 +433,7 @@ under the License.
         <field name="productsSoldThruTimestamp" 
title="${uiLabelMap.ProductShowProductsSoldThruTimestamp}">
             <date-time default-value="${groovy: 
org.ofbiz.base.util.UtilDateTime.nowTimestamp()}"/>
         </field>
-        <field name="VIEW_SIZE" entry-name="viewSize" 
title="${uiLabelMap.ProductShowProductsPerPage}"><text/></field>
+        <field name="VIEW_SIZE_1" entry-name="viewSize" 
title="${uiLabelMap.ProductShowProductsPerPage}"><text/></field>
         <field name="monthsInPastLimit" 
entry-name="monthsInPastLimit"><text/></field>
         <field name="fromDateSellThrough" 
title="${uiLabelMap.ProductFromDateSellThrough}"><date-time/></field>
         <field name="thruDateSellThrough" 
title="${uiLabelMap.ProductThruDateSellThrough}"><date-time/></field>

Modified: 
ofbiz/branches/release15.12/applications/product/widget/facility/FacilityScreens.xml
URL: 
http://svn.apache.org/viewvc/ofbiz/branches/release15.12/applications/product/widget/facility/FacilityScreens.xml?rev=1748953&r1=1748952&r2=1748953&view=diff
==============================================================================
--- 
ofbiz/branches/release15.12/applications/product/widget/facility/FacilityScreens.xml
 (original)
+++ 
ofbiz/branches/release15.12/applications/product/widget/facility/FacilityScreens.xml
 Sat Jun 18 10:28:22 2016
@@ -433,7 +433,8 @@ under the License.
         <section>
             <actions>
                 <set field="tabButtonItem" 
value="ViewFacilityInventoryByProduct"/>
-                <set field="viewSize" from-field="parameters.VIEW_SIZE"/>
+                <set field="viewSize" from-field="parameters.VIEW_SIZE_1" 
type="Integer" default-value="20"/>
+                <set field="viewIndex" from-field="parameters.VIEW_INDEX_1" 
type="Integer" default-value="0"/>
                 <!-- This is the target of the search form-->
                 <set field="facilityInventoryByProductScreen" 
value="ViewFacilityInventoryByProduct"/>
                 <set field="facilityId" from-field="parameters.facilityId"/>


Reply via email to