svn commit: r465283 - in /incubator/ofbiz/trunk/applications/product: webapp/facility/WEB-INF/actions/facility/ViewFacilityInventoryByProduct.bsh webapp/facility/facility/FacilityForms.xml widget/facility/FacilityScreens.xml

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

svn commit: r465283 - in /incubator/ofbiz/trunk/applications/product: webapp/facility/WEB-INF/actions/facility/ViewFacilityInventoryByProduct.bsh webapp/facility/facility/FacilityForms.xml widget/facility/FacilityScreens.xml

jacopoc
Author: jacopoc
Date: Wed Oct 18 09:07:25 2006
New Revision: 465283

URL: http://svn.apache.org/viewvc?view=rev&rev=465283
Log:
Committed a modified version of the patch attached to OFBIZ-379 from Anil K Patel to improve the performance of the "view inventory by product" report: now pagination is manually done in the bsh script.

Modified:
    incubator/ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/facility/ViewFacilityInventoryByProduct.bsh
    incubator/ofbiz/trunk/applications/product/webapp/facility/facility/FacilityForms.xml
    incubator/ofbiz/trunk/applications/product/widget/facility/FacilityScreens.xml

Modified: incubator/ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/facility/ViewFacilityInventoryByProduct.bsh
URL: http://svn.apache.org/viewvc/incubator/ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/facility/ViewFacilityInventoryByProduct.bsh?view=diff&rev=465283&r1=465282&r2=465283
==============================================================================
--- incubator/ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/facility/ViewFacilityInventoryByProduct.bsh (original)
+++ incubator/ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/facility/ViewFacilityInventoryByProduct.bsh Wed Oct 18 09:07:25 2006
@@ -125,8 +125,31 @@
     try {
         beganTransaction = TransactionUtil.begin();
         prodsEli = delegator.findListIteratorByCondition(prodView, whereCondition, null, null, UtilMisc.toList("productId"), findOpts);
-        prods = prodsEli.getCompleteList();
+
+        // get the indexes for the partial list
+        lowIndex = ((viewIndex.intValue() * viewSize.intValue()) + 1);
+        highIndex = (viewIndex.intValue() + 1) * viewSize.intValue();
+
+        // attempt to get the full size
+        prodsEli.last();
+        productListSize = prodsEli.currentIndex();
+
+        if (highIndex > productListSize) {
+            highIndex = productListSize;
+        }
+
+        // get the partial list for this page
+        prodsEli.beforeFirst();
+        if (productListSize > 0) {
+            prods = prodsEli.getPartialList(lowIndex, highIndex);
+        } else {
+            prods = new ArrayList();
+        }
         prodsEli.close();
+        context.put("overrideFormListSize", productListSize);
+        context.put("highIndex", highIndex);
+        context.put("lowIndex", lowIndex);
+
     } catch (GenericEntityException e) {
         String errMsg = "Failure in operation, rolling back transaction";
         Debug.logError(e, errMsg, "ViewFacilityInventoryByProduct");

Modified: incubator/ofbiz/trunk/applications/product/webapp/facility/facility/FacilityForms.xml
URL: http://svn.apache.org/viewvc/incubator/ofbiz/trunk/applications/product/webapp/facility/facility/FacilityForms.xml?view=diff&rev=465283&r1=465282&r2=465283
==============================================================================
--- incubator/ofbiz/trunk/applications/product/webapp/facility/facility/FacilityForms.xml (original)
+++ incubator/ofbiz/trunk/applications/product/webapp/facility/facility/FacilityForms.xml Wed Oct 18 09:07:25 2006
@@ -59,7 +59,7 @@
         <field name="productsSoldThruTimestamp" title="${uiLabelMap.ProductShowProductsSoldThruTimestamp}" widget-style="inputBox">
             <date-time default-value="${bsh: org.ofbiz.base.util.UtilDateTime.nowTimestamp()}"/>
         </field>
-        <field name="VIEW_SIZE" title="${uiLabelMap.ProductShowProductsPerPage}" widget-style="inputBox"><text default-value="50"/></field>
+        <field name="VIEW_SIZE" entry-name="viewSize" title="${uiLabelMap.ProductShowProductsPerPage}" widget-style="inputBox"><text/></field>
         <field name="submitButton" title="${uiLabelMap.CommonFind}" widget-style="smallSubmit">
             <submit button-type="button"/>
         </field>
@@ -68,7 +68,7 @@
             target="" title="" list-name="inventoryByProduct" paginate-target="ViewFacilityInventoryByProduct"
             default-title-style="tableheadtext" default-widget-style="tabletext" default-tooltip-style="tabletext">
         <field name="items" widget-style="buttontext">
-            <hyperlink target="EditFacilityInventoryItems?productId=${productId}&amp;facilityId=${facilityId}" description="${productId}" link-style="buttontext"/>    
+            <hyperlink target="EditFacilityInventoryItems?productId=${productId}&amp;facilityId=${facilityId}" description="${productId}"/>    
         </field>
         <field name="productId" title="${uiLabelMap.CommonDescription}" widget-area-style="tabletext">
             <display-entity entity-name="Product" description="${internalName}">

Modified: incubator/ofbiz/trunk/applications/product/widget/facility/FacilityScreens.xml
URL: http://svn.apache.org/viewvc/incubator/ofbiz/trunk/applications/product/widget/facility/FacilityScreens.xml?view=diff&rev=465283&r1=465282&r2=465283
==============================================================================
--- incubator/ofbiz/trunk/applications/product/widget/facility/FacilityScreens.xml (original)
+++ incubator/ofbiz/trunk/applications/product/widget/facility/FacilityScreens.xml Wed Oct 18 09:07:25 2006
@@ -254,7 +254,7 @@
                 <set field="facilityInventoryByProductScreen" value="ViewFacilityInventoryByProductSimple"/>
 
                 <set field="titleProperty" value="PageTitleEditFacilityInventoryItems"/>
-                <set field="viewIndex" from-field="parameters.VIEW_INDEX" type="Integer"/>
+                <set field="viewIndex" from-field="parameters.VIEW_INDEX" type="Integer" default-value="0"/>
                 <set field="viewSize" from-field="parameters.VIEW_SIZE" type="Integer" default-value="500"/>
 
                 <set field="facilityId" from-field="parameters.facilityId"/>
@@ -295,7 +295,7 @@
                 <property-map resource="CommonUiLabels" map-name="uiLabelMap" global="true"/>
                 <set field="pageLayoutName" value="simple-landscape"/>
                 <set field="titleProperty" value="PageTitleEditFacilityInventoryItems"/>
-                <set field="viewIndex" from-field="parameters.VIEW_INDEX" type="Integer"/>
+                <set field="viewIndex" from-field="parameters.VIEW_INDEX" type="Integer" default-value="0"/>
                 <set field="viewSize" from-field="parameters.VIEW_SIZE" type="Integer" default-value="500"/>
 
                 <set field="facilityId" from-field="parameters.facilityId"/>
@@ -327,7 +327,7 @@
                 <property-map resource="CommonUiLabels" map-name="uiLabelMap" global="true"/>
 
                 <set field="titleProperty" value="PageTitleEditFacilityInventoryItems"/>
-                <set field="viewIndex" from-field="parameters.VIEW_INDEX" type="Integer"/>
+                <set field="viewIndex" from-field="parameters.VIEW_INDEX" type="Integer" default-value="0"/>
                 <set field="viewSize" from-field="parameters.VIEW_SIZE" type="Integer" default-value="500"/>
 
                 <set field="facilityId" from-field="parameters.facilityId"/>