https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43623

--- Comment #4 from OpenFifth Sandboxes <[email protected]> ---
Created attachment 206885
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=206885&action=edit
Bug 43623: Fix negative LIMIT when report offset is greater than its limit

execute_query added the offset of the user supplied LIMIT to the
pagination offset before comparing it with the user supplied count. With
"LIMIT 100, 50" the computed limit was 50 - 100 = -50, resulting in a SQL
syntax error.

The pagination offset is relative to the user supplied offset, so compare
it with the user supplied count first and add the user offset afterwards.

Test plan:
1. Create a SQL report: SELECT itemnumber FROM items LIMIT 100, 50
2. Run it => SQL syntax error near '-50'
3. Apply this patch
4. Run the report again => 50 items are displayed, and the following
   pages stop at the 50th item
5. prove t/db_dependent/Reports/Guided.t

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Mathieu Saby <[email protected]>

-- 
You are receiving this mail because:
You are watching all bug changes.
_______________________________________________
Koha-bugs mailing list -- [email protected]
To unsubscribe send an email to [email protected]
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/

Reply via email to