svn commit: r1821013 - in /ofbiz/ofbiz-framework/branches/release17.12: ./ applications/order/template/entry/catalog/ applications/product/src/main/java/org/apache/ofbiz/product/product/

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

svn commit: r1821013 - in /ofbiz/ofbiz-framework/branches/release17.12: ./ applications/order/template/entry/catalog/ applications/product/src/main/java/org/apache/ofbiz/product/product/

jleroux@apache.org
Author: jleroux
Date: Fri Jan 12 18:23:22 2018
New Revision: 1821013

URL: http://svn.apache.org/viewvc?rev=1821013&view=rev
Log:
"Applied fix from trunk for revision: 1821012"
------------------------------------------------------------------------
r1821012 | jleroux | 2018-01-12 19:21:38 +0100 (ven., 12 janv. 2018) | 8 lines

Fixed: pagination errors in "KeywordSearch.ftl" and "ProductSearchSession.java"
(OFBIZ-10154)

To recreate the bug go to
Order->OrderEntry-> Search in the catalog for "g" -> check the amount of shown
pages and press "Next" -> press "back" -> note how many results you now have

Thanks: Karsten Tymann
------------------------------------------------------------------------


Modified:
    ofbiz/ofbiz-framework/branches/release17.12/   (props changed)
    ofbiz/ofbiz-framework/branches/release17.12/applications/order/template/entry/catalog/KeywordSearch.ftl
    ofbiz/ofbiz-framework/branches/release17.12/applications/order/template/entry/catalog/TagSearch.ftl
    ofbiz/ofbiz-framework/branches/release17.12/applications/product/src/main/java/org/apache/ofbiz/product/product/ProductSearchSession.java

Propchange: ofbiz/ofbiz-framework/branches/release17.12/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Fri Jan 12 18:23:22 2018
@@ -10,4 +10,4 @@
 /ofbiz/branches/json-integration-refactoring:1634077-1635900
 /ofbiz/branches/multitenant20100310:921280-927264
 /ofbiz/branches/release13.07:1547657
-/ofbiz/ofbiz-framework/trunk:1819499,1819598,1819800,1819805,1819811,1820038,1820262,1820374-1820375,1820441,1820457,1820644,1820658,1820790,1820823,1820949,1820966
+/ofbiz/ofbiz-framework/trunk:1819499,1819598,1819800,1819805,1819811,1820038,1820262,1820374-1820375,1820441,1820457,1820644,1820658,1820790,1820823,1820949,1820966,1821012

Modified: ofbiz/ofbiz-framework/branches/release17.12/applications/order/template/entry/catalog/KeywordSearch.ftl
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/branches/release17.12/applications/order/template/entry/catalog/KeywordSearch.ftl?rev=1821013&r1=1821012&r2=1821013&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/branches/release17.12/applications/order/template/entry/catalog/KeywordSearch.ftl (original)
+++ ofbiz/ofbiz-framework/branches/release17.12/applications/order/template/entry/catalog/KeywordSearch.ftl Fri Jan 12 18:23:22 2018
@@ -34,31 +34,32 @@ under the License.
 </#if>
 
 <#if productIds?has_content>
-    <div class="product-prevnext">
-        <#-- Start Page Select Drop-Down -->
-        <#assign viewIndexMax = Static["java.lang.Math"].ceil((listSize - 1)?double / viewSize?double)>
-        <select name="pageSelect" onchange="window.location=this[this.selectedIndex].value;">
-          <option value="#">${uiLabelMap.CommonPage} ${viewIndex?int + 1} ${uiLabelMap.CommonOf} ${viewIndexMax + 1}</option>
-          <#list 0..viewIndexMax as curViewNum>
-            <option value="<@ofbizUrl>keywordsearch/~VIEW_SIZE=${viewSize}/~VIEW_INDEX=${curViewNum?int}/~clearSearch=N</@ofbizUrl>">${uiLabelMap.CommonGotoPage} ${curViewNum + 1}</option>
-          </#list>
-        </select>
-        <#-- End Page Select Drop-Down -->
-        <b>
-        <#if (viewIndex?int > 0)>
-          <a href="<@ofbizUrl>keywordsearch/~VIEW_SIZE=${viewSize}/~VIEW_INDEX=${viewIndex?int - 1}/~clearSearch=N</@ofbizUrl>" class="buttontext">${uiLabelMap.CommonPrevious}</a> |
-        </#if>
-        <#if (listSize?int > 0)>
-          <span>${lowIndex+1} - ${highIndex} ${uiLabelMap.CommonOf} ${listSize}</span>
-        </#if>
-        <#if highIndex?int < listSize?int>
-          | <a href="<@ofbizUrl>keywordsearch/~VIEW_SIZE=${viewSize}/~VIEW_INDEX=${viewIndex+1}/~clearSearch=N</@ofbizUrl>" class="buttontext">${uiLabelMap.CommonNext}</a>
-        </#if>
-        </b>
-    </div>
-</#if>
+    <#macro paginationControls>
+            <div class="product-prevnext">
+                <#-- Start Page Select Drop-Down -->
+                <#assign viewIndexMax = Static["java.lang.Math"].ceil((listSize)?double / viewSize?double)>
+                <select name="pageSelect" onchange="window.location=this[this.selectedIndex].value;">
+                  <option value="#">${uiLabelMap.CommonPage} ${viewIndex?int + 1} ${uiLabelMap.CommonOf} ${viewIndexMax}</option>
+                  <#list 1..viewIndexMax as curViewNum>
+                    <option value="<@ofbizUrl>keywordsearch/~VIEW_SIZE=${viewSize}/~VIEW_INDEX=${curViewNum?int - 1}/~clearSearch=N</@ofbizUrl>">${uiLabelMap.CommonGotoPage} ${curViewNum}</option>
+                  </#list>
+                </select>
+                <#-- End Page Select Drop-Down -->
+                <b>
+                <#if (viewIndex?int > 0)>
+                  <a href="<@ofbizUrl>keywordsearch/~VIEW_SIZE=${viewSize}/~VIEW_INDEX=${viewIndex - 1}/~clearSearch=N</@ofbizUrl>" class="buttontext">${uiLabelMap.CommonPrevious}</a> |
+                </#if>
+                <#if (listSize?int > 0)>
+                  <span>${lowIndex+1} - ${highIndex} ${uiLabelMap.CommonOf} ${listSize}</span>
+                </#if>
+                <#if highIndex?int < listSize?int>
+                  | <a href="<@ofbizUrl>keywordsearch/~VIEW_SIZE=${viewSize}/~VIEW_INDEX=${viewIndex+1}/~clearSearch=N</@ofbizUrl>" class="buttontext">${uiLabelMap.CommonNext}</a>
+                </#if>
+                </b>
+            </div>
+    </#macro>
 
-<#if productIds?has_content>
+    <@paginationControls/>
     <div class="productsummary-container">
         <#list productIds as productId> <#-- note that there is no boundary range because that is being done before the list is put in the content -->
             ${setRequestAttribute("optProductId", productId)}
@@ -66,29 +67,5 @@ under the License.
             ${screens.render(productsummaryScreen)}
         </#list>
     </div>
-</#if>
-
-<#if productIds?has_content>
-    <div class="product-prevnext">
-        <#-- Start Page Select Drop-Down -->
-        <#assign viewIndexMax = Static["java.lang.Math"].ceil((listSize - 1)?double / viewSize?double)>
-        <select name="pageSelect" onchange="window.location=this[this.selectedIndex].value;">
-          <option value="#">${uiLabelMap.CommonPage} ${viewIndex?int + 1} ${uiLabelMap.CommonOf} ${viewIndexMax + 1}</option>
-          <#list 0..viewIndexMax as curViewNum>
-            <option value="<@ofbizUrl>keywordsearch/~VIEW_SIZE=${viewSize}/~VIEW_INDEX=${curViewNum?int}/~clearSearch=N</@ofbizUrl>">${uiLabelMap.CommonGotoPage} ${curViewNum + 1}</option>
-          </#list>
-        </select>
-        <#-- End Page Select Drop-Down -->
-        <b>
-        <#if (viewIndex?int > 0)>
-          <a href="<@ofbizUrl>keywordsearch/~VIEW_SIZE=${viewSize}/~VIEW_INDEX=${viewIndex?int - 1}/~clearSearch=N</@ofbizUrl>" class="buttontext">${uiLabelMap.CommonPrevious}</a> |
-        </#if>
-        <#if (listSize?int > 0)>
-          <span>${lowIndex+1} - ${highIndex} ${uiLabelMap.CommonOf} ${listSize}</span>
-        </#if>
-        <#if highIndex?int < listSize?int>
-          | <a href="<@ofbizUrl>keywordsearch/~VIEW_SIZE=${viewSize}/~VIEW_INDEX=${viewIndex+1}/~clearSearch=N</@ofbizUrl>" class="buttontext">${uiLabelMap.CommonNext}</a>
-        </#if>
-        </b>
-    </div>
+    <@paginationControls/>
 </#if>

Modified: ofbiz/ofbiz-framework/branches/release17.12/applications/order/template/entry/catalog/TagSearch.ftl
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/branches/release17.12/applications/order/template/entry/catalog/TagSearch.ftl?rev=1821013&r1=1821012&r2=1821013&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/branches/release17.12/applications/order/template/entry/catalog/TagSearch.ftl (original)
+++ ofbiz/ofbiz-framework/branches/release17.12/applications/order/template/entry/catalog/TagSearch.ftl Fri Jan 12 18:23:22 2018
@@ -24,31 +24,32 @@ under the License.
 </#if>
 
 <#if productIds?has_content>
-    <div class="product-prevnext">
-        <#-- Start Page Select Drop-Down -->
-        <#assign viewIndexMax = Static["java.lang.Math"].ceil((listSize - 1)?double / viewSize?double)>
-        <select name="pageSelect" onchange="window.location=this[this.selectedIndex].value;">
-          <option value="#">${uiLabelMap.CommonPage} ${viewIndex?int + 1} ${uiLabelMap.CommonOf} ${viewIndexMax + 1}</option>
-          <#list 0..viewIndexMax as curViewNum>
-            <option value="<@ofbizUrl>keywordsearch/~VIEW_SIZE=${viewSize}/~VIEW_INDEX=${curViewNum?int}/~clearSearch=N</@ofbizUrl>">${uiLabelMap.CommonGotoPage} ${curViewNum + 1}</option>
-          </#list>
-        </select>
-        <#-- End Page Select Drop-Down -->
-        <b>
-        <#if (viewIndex?int > 0)>
-          <a href="<@ofbizUrl>keywordsearch/~VIEW_SIZE=${viewSize}/~VIEW_INDEX=${viewIndex?int - 1}/~clearSearch=N</@ofbizUrl>" class="buttontext">${uiLabelMap.CommonPrevious}</a> |
-        </#if>
-        <#if (listSize?int > 0)>
-          <span>${lowIndex+1} - ${highIndex} ${uiLabelMap.CommonOf} ${listSize}</span>
-        </#if>
-        <#if highIndex?int < listSize?int>
-          | <a href="<@ofbizUrl>keywordsearch/~VIEW_SIZE=${viewSize}/~VIEW_INDEX=${viewIndex+1}/~clearSearch=N</@ofbizUrl>" class="buttontext">${uiLabelMap.CommonNext}</a>
-        </#if>
-        </b>
-    </div>
-</#if>
+    <#macro paginationControls>
+            <div class="product-prevnext">
+                <#-- Start Page Select Drop-Down -->
+                <#assign viewIndexMax = Static["java.lang.Math"].ceil((listSize)?double / viewSize?double)>
+                <select name="pageSelect" onchange="window.location=this[this.selectedIndex].value;">
+                  <option value="#">${uiLabelMap.CommonPage} ${viewIndex?int + 1} ${uiLabelMap.CommonOf} ${viewIndexMax}</option>
+                  <#list 1..viewIndexMax as curViewNum>
+                    <option value="<@ofbizUrl>keywordsearch/~VIEW_SIZE=${viewSize}/~VIEW_INDEX=${curViewNum?int - 1}/~clearSearch=N</@ofbizUrl>">${uiLabelMap.CommonGotoPage} ${curViewNum}</option>
+                  </#list>
+                </select>
+                <#-- End Page Select Drop-Down -->
+                <b>
+                <#if (viewIndex?int > 0)>
+                  <a href="<@ofbizUrl>keywordsearch/~VIEW_SIZE=${viewSize}/~VIEW_INDEX=${viewIndex - 1}/~clearSearch=N</@ofbizUrl>" class="buttontext">${uiLabelMap.CommonPrevious}</a> |
+                </#if>
+                <#if (listSize?int > 0)>
+                  <span>${lowIndex+1} - ${highIndex} ${uiLabelMap.CommonOf} ${listSize}</span>
+                </#if>
+                <#if highIndex?int < listSize?int>
+                  | <a href="<@ofbizUrl>keywordsearch/~VIEW_SIZE=${viewSize}/~VIEW_INDEX=${viewIndex+1}/~clearSearch=N</@ofbizUrl>" class="buttontext">${uiLabelMap.CommonNext}</a>
+                </#if>
+                </b>
+            </div>
+    </#macro>
 
-<#if productIds?has_content>
+    <@paginationControls/>
     <div class="productsummary-container">
         <#list productIds as productId> <#-- note that there is no boundary range because that is being done before the list is put in the content -->
             ${setRequestAttribute("optProductId", productId)}
@@ -56,29 +57,5 @@ under the License.
             ${screens.render(productsummaryScreen)}
         </#list>
     </div>
-</#if>
-
-<#if productIds?has_content>
-    <div class="product-prevnext">
-        <#-- Start Page Select Drop-Down -->
-        <#assign viewIndexMax = Static["java.lang.Math"].ceil((listSize - 1)?double / viewSize?double)>
-        <select name="pageSelect" onchange="window.location=this[this.selectedIndex].value;">
-          <option value="#">${uiLabelMap.CommonPage} ${viewIndex?int + 1} ${uiLabelMap.CommonOf} ${viewIndexMax + 1}</option>
-          <#list 0..viewIndexMax as curViewNum>
-            <option value="<@ofbizUrl>keywordsearch/~VIEW_SIZE=${viewSize}/~VIEW_INDEX=${curViewNum?int}/~clearSearch=N</@ofbizUrl>">${uiLabelMap.CommonGotoPage} ${curViewNum + 1}</option>
-          </#list>
-        </select>
-        <#-- End Page Select Drop-Down -->
-        <b>
-        <#if (viewIndex?int > 0)>
-          <a href="<@ofbizUrl>keywordsearch/~VIEW_SIZE=${viewSize}/~VIEW_INDEX=${viewIndex?int - 1}/~clearSearch=N</@ofbizUrl>" class="buttontext">${uiLabelMap.CommonPrevious}</a> |
-        </#if>
-        <#if (listSize?int > 0)>
-          <span>${lowIndex+1} - ${highIndex} ${uiLabelMap.CommonOf} ${listSize}</span>
-        </#if>
-        <#if highIndex?int < listSize?int>
-          | <a href="<@ofbizUrl>keywordsearch/~VIEW_SIZE=${viewSize}/~VIEW_INDEX=${viewIndex+1}/~clearSearch=N</@ofbizUrl>" class="buttontext">${uiLabelMap.CommonNext}</a>
-        </#if>
-        </b>
-    </div>
+    <@paginationControls/>
 </#if>

Modified: ofbiz/ofbiz-framework/branches/release17.12/applications/product/src/main/java/org/apache/ofbiz/product/product/ProductSearchSession.java
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/branches/release17.12/applications/product/src/main/java/org/apache/ofbiz/product/product/ProductSearchSession.java?rev=1821013&r1=1821012&r2=1821013&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/branches/release17.12/applications/product/src/main/java/org/apache/ofbiz/product/product/ProductSearchSession.java (original)
+++ ofbiz/ofbiz-framework/branches/release17.12/applications/product/src/main/java/org/apache/ofbiz/product/product/ProductSearchSession.java Fri Jan 12 18:23:22 2018
@@ -380,7 +380,6 @@ public class ProductSearchSession {
         HttpSession session = request.getSession();
         Delegator delegator = (Delegator) request.getAttribute("delegator");
         Map<String, Object> requestParams = UtilHttp.getParameterMap(request);
-        ProductSearchSession.processSearchParameters(requestParams, request);
 
         // get the current productStoreId
         String productStoreId = ProductStoreWorker.getProductStoreId(request);
@@ -513,11 +512,6 @@ public class ProductSearchSession {
         Delegator delegator = (Delegator) request.getAttribute("delegator");
         Boolean alreadyRun = (Boolean) request.getAttribute("processSearchParametersAlreadyRun");
         if (Boolean.TRUE.equals(alreadyRun)) {
-            // even if already run, check the VIEW_SIZE and VIEW_INDEX again, just for kicks
-            ProductSearchOptions productSearchOptions = getProductSearchOptions(request.getSession());
-            productSearchOptions.setViewIndex((String) parameters.get("VIEW_INDEX"));
-            productSearchOptions.setViewSize((String) parameters.get("VIEW_SIZE"));
-            productSearchOptions.setPaging((String) parameters.get("PAGING"));
             return;
         }
         request.setAttribute("processSearchParametersAlreadyRun", Boolean.TRUE);