Bug 26298

Summary: If MaxItemsToProcessForBatchMod is set to 1000, the max is actually 999
Product: Koha Reporter: Caroline Cyr La Rose <caroline.cyr-la-rose>
Component: ToolsAssignee: Nick Clemens (kidclamp) <nick>
Status: CLOSED FIXED QA Contact: Marcel de Rooy <m.de.rooy>
Severity: normal    
Priority: P5 - low CC: andrew, barbara.johnson, bwsdonna, fridolin.somers, m.de.rooy, mfuerst, nick, victor
Version: Main   
Hardware: All   
OS: All   
See Also: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=10163
Change sponsored?: --- Patch complexity: Trivial patch
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
21.05.00,20.11.03,20.05.09,19.11.15
Circulation function:
Attachments: Bug 26298: Don't set too_many_items_to_process if equal to limit
Bug 26298: Don't set too_many_items_to_process if equal to limit
Bug 26298: Don't set too_many_items_to_process if equal to limit

Description Caroline Cyr La Rose 2020-08-25 18:54:38 UTC
So this is similar to bug 10163, but I don't think it's the same thing. I noticed that if you have 1000 in MaxItemsToProcessForBatchMod, and you try to process 1000 items, there's an error message

"Too many items (1000): You are not allowed to edit more than 1000 items in a batch."

The message itself is a bit confusing because 1000 is not "more than" 1000. And you're probably thinking "well, just put 999 items in your file and voilĂ !", but if you batch modify using the reports, the options are 10, 20, 50, 100, 200, 300, 400, 500, and 1000. If you have a lot of batches to do, the difference between 500 and 1000 is double the work.

To reproduce:
1- Set MaxItemsToProcessForBatchMod to 1000
2- Go to Reports
3- Make a report for itemnumbers that will give you at least 1000 items (ex. SELECT itemnumber FROM items)
4- Save and run the report
5- In "Rows per page", choose 1000
6- Click on "Batch operations with 1000 visible records" > Batch item modification
7- Notice that the item modification form isn't there and that the message says "Too many items (1000): You are not allowed to edit more than 1000 items in a batch."
Comment 1 Donna 2021-01-26 22:29:35 UTC
While I can do a workaround by changing the syspref for MaxItemsToProcessForBatchMod to 1001, this seems a bit silly.  The button in reports states "Batch with 1000 visible records" so that is what the behavior should be.
Comment 2 Martha Fuerst 2021-01-27 20:10:48 UTC
Confirmed that this is also an issue when you paste a list of barcodes into the batch modification tool as opposed to getting to it from the report results.

-Marti Fuerst, Huntsville-Madison County Public Library
Comment 3 Nick Clemens (kidclamp) 2021-01-28 19:00:09 UTC
Created attachment 115988 [details] [review]
Bug 26298: Don't set too_many_items_to_process if equal to limit

In the code we prepare items for display if less than or equal to the pref, but we don't allow
the edit if greater than or equal to the pref. The second case should be only 'greater than'

To test:
 1- Set MaxItemsToProcessForBatchMod to 1000
 2- Go to Reports
 3- Make a report for itemnumbers that will give you at least 1000 items (ex. SELECT itemnumber FROM items)
 4- Save and run the report
 5- In "Rows per page", choose 1000
 6- Click on "Batch operations with 1000 visible records" > Batch item modification
 7- Notice that the item modification form isn't there and that the message says "Too many items (1000): You are not allowed to edit more than 1000 items in a batch."
 8- Apply patch
 9- Restart all the things
10- Run the report again and display 1000 rows
11- Click on "Batch operations with 1000 visible records" > Batch item modification
12 - Sucess!
Comment 4 PTFS Europe Sandboxes 2021-01-28 21:59:00 UTC
Created attachment 115994 [details] [review]
Bug 26298: Don't set too_many_items_to_process if equal to limit

In the code we prepare items for display if less than or equal to the pref, but we don't allow
the edit if greater than or equal to the pref. The second case should be only 'greater than'

To test:
 1- Set MaxItemsToProcessForBatchMod to 1000
 2- Go to Reports
 3- Make a report for itemnumbers that will give you at least 1000 items (ex. SELECT itemnumber FROM items)
 4- Save and run the report
 5- In "Rows per page", choose 1000
 6- Click on "Batch operations with 1000 visible records" > Batch item modification
 7- Notice that the item modification form isn't there and that the message says "Too many items (1000): You are not allowed to edit more than 1000 items in a batch."
 8- Apply patch
 9- Restart all the things
10- Run the report again and display 1000 rows
11- Click on "Batch operations with 1000 visible records" > Batch item modification
12 - Sucess!

Signed-off-by: Barbara Johnson <barbara.johnson@bedfordtx.gov>
Comment 5 Marcel de Rooy 2021-01-29 10:47:58 UTC
Created attachment 116018 [details] [review]
Bug 26298: Don't set too_many_items_to_process if equal to limit

In the code we prepare items for display if less than or equal to the pref, but we don't allow
the edit if greater than or equal to the pref. The second case should be only 'greater than'

To test:
 1- Set MaxItemsToProcessForBatchMod to 1000
 2- Go to Reports
 3- Make a report for itemnumbers that will give you at least 1000 items (ex. SELECT itemnumber FROM items)
 4- Save and run the report
 5- In "Rows per page", choose 1000
 6- Click on "Batch operations with 1000 visible records" > Batch item modification
 7- Notice that the item modification form isn't there and that the message says "Too many items (1000): You are not allowed to edit more than 1000 items in a batch."
 8- Apply patch
 9- Restart all the things
10- Run the report again and display 1000 rows
11- Click on "Batch operations with 1000 visible records" > Batch item modification
12 - Sucess!

Signed-off-by: Barbara Johnson <barbara.johnson@bedfordtx.gov>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Comment 6 Jonathan Druart 2021-02-01 16:26:24 UTC
Pushed to master for 21.05, thanks to everybody involved!
Comment 7 Fridolin Somers 2021-02-05 15:45:13 UTC
Pushed to 20.11.x for 20.11.03
Comment 8 Andrew Fuerste-Henry 2021-02-09 12:51:22 UTC
Pushed to 20.05.x for 20.05.09
Comment 9 Victor Grousset/tuxayo 2021-02-11 01:49:02 UTC
Backported: Pushed to 19.11.x branch for 19.11.15