pagination errors in keywordsearch in the Order->OrderEntry->Search-Screen
With this patch I propose a fix for two bugs in the current OfBiz state.
1. The pagination for the "Order Entry" Search in the "Order" component
has an error on the underlying FreemarkerTemplate. The .ftl displays all
potential pages, plus one.
For example, if you have 19 results with a ViewSize of 10, you should see
2 pages, but in fact, 3 potential pages are shown.
This is a bug in the calculation of the pages on the .ftl.
The patch fixes the calculation by handling the variable "ListSize" as what it
is: the size of the list. There should be no subtraction for the listSize provided by
Note that this also adapts the file "KeywordSearch.ftl" to the equivalent pagination
.ftl "CategoryDetail.ftl". In the patching process I also changed the
"TagSearch.ftl" to adapt to the correct calculation of pagination.
2. The pagination for "KeywordSearch" triggers a completely new search if you search for an order, change the
page, and then press the "Previous page" button.
This occurs because the method "processSearchParameters" in "ProductSearchSession"
is called from the Groovy-Script of the Result-Screen
as well as from the method "checkDoKeywordOverride" which is triggered by
the Form-Submit-Search-Request "keywordsearch" (see controller.xml).
The additional call results in a new Search since the parameter "clearSearchString"
is not send on the second occasion. Therefore one call should be eliminated.
I chose to remove the method call from within "checkDoKeywordOverride"
since it is unique to the component and is only triggered by this exact event.
"KeywordSearch.groovy", in multiple components, always triggers the
another call is just not needed.
Additionally I also removed the block of rechecking the set View and Index size which
serves no purpose. Again, this block of actions is also not needed in similar
java classes such as "WorkEffortSearchSession.java".
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, from 19 to 35