Bug 36534

Summary: Batch operations when using limit in report
Product: Koha Reporter: Mikko Liimatainen <mikko.liimatainen>
Component: ReportsAssignee: Katariina Pohto <katariina.pohto>
Status: Pushed to oldstable --- QA Contact: Testopia <testopia>
Severity: minor    
Priority: P5 - low CC: fridolin.somers, katariina.pohto, lucas, magnus
Version: unspecified   
Hardware: All   
OS: All   
Change sponsored?: --- Patch complexity: Trivial patch
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
24.05.00,23.11.06,23.05.12
Attachments: Bug 36534: Batch operations when using limit in report
Bug 36534: Batch operations when using limit in report
Bug 36534: Batch operations when using limit in report

Description Mikko Liimatainen 2024-04-05 07:25:53 UTC
When running a report with defined limit larger than 20, batch operations reads "Batch operations with 20 visible records" even though more records are visible. However when doing a batch operation it is done to all visible records.

To reproduce:
1. Create a report of items with a limit of over 20
2. Run report
3. See that number of results shown exceeds 20
4. Dropdown reads "Batch operations with 20 visible records"
5. Start Batch item modification
6. Batch modification opens with all visible records
Comment 1 Magnus Enger 2024-04-24 09:21:18 UTC
Confirmed.
Comment 2 Katariina Pohto 2024-05-02 12:43:25 UTC
Created attachment 166068 [details] [review]
Bug 36534: Batch operations when using limit in report

The issue appears also outside of using the SQL limit. The last page of results is usually smaller than the results-per-page setting, but the link for batch operations will show the results-per-page limit in that case too.

The batch operations will open with all visible records, and the page already has a variable for visible records. This patch changes the variable to the visible records one.

Test plan:
1) Create a report of items with a limit of e.g., 26.
2) Run report.
3) See that number of results shown exceeds 20 but the link says "Batch operations with 20 visible records".
4) See that the second page shows 6 results but the link is still for 20 records.
5) Apply patch.
6) Run report again.
7) See that the link texts will show correctly 26 records on the first page and 6 records on the second.
Comment 3 Owen Leonard 2024-05-03 17:25:44 UTC
Created attachment 166154 [details] [review]
Bug 36534: Batch operations when using limit in report

When report results number exceeds the result per page limit, batch
operations link reads "Batch operations with (page limit) records" even
if there are more or less shown records (more when using limit in SQL or
less in the last page of result). This patch fixes the link text to
actual shown records.

To test:
1) Create a report of items with a limit of e.g., 26.
2) Run report.
3) See that number of results shown exceeds 20 but the link says "Batch
   operations with 20 visible records".
4) See that the second page shows 6 results but the link is still for 20
   records.
5) Apply patch.
6) Run report again.
7) See that the link texts will show correctly 26 records on the first
   page and 6 records on the second.

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Comment 4 Nick Clemens (kidclamp) 2024-05-08 12:37:11 UTC
Created attachment 166403 [details] [review]
Bug 36534: Batch operations when using limit in report

When report results number exceeds the result per page limit, batch
operations link reads "Batch operations with (page limit) records" even
if there are more or less shown records (more when using limit in SQL or
less in the last page of result). This patch fixes the link text to
actual shown records.

To test:
1) Create a report of items with a limit of e.g., 26.
2) Run report.
3) See that number of results shown exceeds 20 but the link says "Batch
   operations with 20 visible records".
4) See that the second page shows 6 results but the link is still for 20
   records.
5) Apply patch.
6) Run report again.
7) See that the link texts will show correctly 26 records on the first
   page and 6 records on the second.

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Comment 5 Katrin Fischer 2024-05-08 16:25:08 UTC
Pushed for 24.05!

Well done everyone, thank you!
Comment 6 Fridolin Somers 2024-05-24 14:59:31 UTC
Pushed to 23.11.x for 23.11.06
Comment 7 Lucas Gass 2024-05-28 21:51:45 UTC
Backported to 23.05.x for upcoming 23.05.12