Bug 37483

Summary: Batch extend due dates tool not working
Product: Koha Reporter: Sara Brown <sbrown>
Component: ToolsAssignee: Nick Clemens (kidclamp) <nick>
Status: Needs documenting --- QA Contact: Marcel de Rooy <m.de.rooy>
Severity: major    
Priority: P5 - low CC: blawlor, catrina, emily.lamancusa, fridolin.somers, januszop, lucas, m.de.rooy, nick, phil
Version: Main   
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.11.00,24.05.05
Circulation function:
Bug Depends on: 34478    
Bug Blocks: 36192, 37941    
Attachments: Bug 37483: batch extend due dates list is a stateless action
Bug 37483: batch extend due dates list is a stateless action
Bug 37483: Use cud-list for extend due dates tool
Bug 37483: Use cud-list for extend due dates tool
Bug 37483: Use cud-list for extend due dates tool

Description Sara Brown 2024-07-25 20:06:09 UTC
The batch extend due dates tool isn't working with the following criteria in 24.05:

Selected: library, patron category, and item type (one each)
Due date range: input
Added X number of days to existing due date
Preview: same behavior whether it is deselected or selected

When I click Continue, I'm returned to a blank 'Batch extend due date' screen, and due dates are not updated in patrons' accounts.
Comment 1 Nick Clemens (kidclamp) 2024-08-01 19:08:07 UTC
Created attachment 169963 [details] [review]
Bug 37483: batch extend due dates list is a stateless action

Remove cud- from op and submit form as get

To test:
1 - Checkout some items to patrons of at least two libraries
2 - Tools -> Batch extend due dates
3 - Select nothing except 'preview' and submit
4 - Blank screen
5 - Apply patch, repeat
6 - It works!
7 - Filter by library and confirm it still works
8 - Sign off!
Comment 2 Brendan Lawlor 2024-08-02 19:38:16 UTC
Created attachment 170023 [details] [review]
Bug 37483: batch extend due dates list is a stateless action

Remove cud- from op and submit form as get

To test:
1 - Checkout some items to patrons of at least two libraries
2 - Tools -> Batch extend due dates
3 - Select nothing except 'preview' and submit
4 - Blank screen
5 - Apply patch, repeat
6 - It works!
7 - Filter by library and confirm it still works
8 - Sign off!

Signed-off-by: Brendan Lawlor <blawlor@clamsnet.org>
Comment 3 Emily Lamancusa (emlam) 2024-08-09 20:48:37 UTC
This one's a bit messy..."(cud-)list" is sent as the op regardless of whether "Preview results first" is checked or not. If "Preview results first" is not checked, then it is very much a CUD action!
Comment 4 Janusz Kaczmarek 2024-09-12 11:27:00 UTC
(In reply to Emily Lamancusa from comment #3)
> This one's a bit messy..."(cud-)list" is sent as the op regardless of
> whether "Preview results first" is checked or not. If "Preview results
> first" is not checked, then it is very much a CUD action!

How about making this the opposite way, i.e. just:

--- a/tools/batch_extend_due_dates.pl
+++ b/tools/batch_extend_due_dates.pl
@@ -46,7 +46,7 @@ my @issue_ids;
 if ( $op eq 'form' ) {
     $template->param( view => 'form', );
 }
-elsif ( $op eq 'list' ) {
+elsif ( $op eq 'cud-list' ) {

     my @categorycodes     = $input->multi_param('categorycodes');
     my @itemtypecodes     = $input->multi_param('itemtypecodes');


Nick, what do you think?
Comment 5 Janusz Kaczmarek 2024-09-12 11:31:25 UTC
In fact, if ! $preview_results then $op = 'cud-modify' (line 141) and the script continues with cud-modify (from line 145).
Comment 6 Nick Clemens (kidclamp) 2024-09-17 12:16:42 UTC
Created attachment 171610 [details] [review]
Bug 37483: Use cud-list for extend due dates tool

This patch switch the check in the script to 'cud-list' - we use the same form
submission if listing for preview or directly updating dates, so this may or may
not be a cud- action - assuming it is restores script functionality.

See bug 37941 for updating forms to not share actions

To test:
1 - Checkout some items to patrons of at least two libraries
2 - Tools -> Batch extend due dates
3 - Select nothing except 'preview' and submit
4 - Blank screen
5 - Apply patch, repeat
6 - It works!
7 - Filter by library and confirm it still works
8 - Sign off!
Comment 7 Janusz Kaczmarek 2024-09-17 12:28:37 UTC
Created attachment 171616 [details] [review]
Bug 37483: Use cud-list for extend due dates tool

This patch switch the check in the script to 'cud-list' - we use the same form
submission if listing for preview or directly updating dates, so this may or may
not be a cud- action - assuming it is restores script functionality.

See bug 37941 for updating forms to not share actions

To test:
1 - Checkout some items to patrons of at least two libraries
2 - Tools -> Batch extend due dates
3 - Select nothing except 'preview' and submit
4 - Blank screen
5 - Apply patch, repeat
6 - It works!
7 - Filter by library and confirm it still works
8 - Sign off!

Signed-off-by: Janusz Kaczmarek <januszop@gmail.com>
Comment 8 Marcel de Rooy 2024-09-20 09:23:14 UTC
Created attachment 171827 [details] [review]
Bug 37483: Use cud-list for extend due dates tool

This patch switch the check in the script to 'cud-list' - we use the same form
submission if listing for preview or directly updating dates, so this may or may
not be a cud- action - assuming it is restores script functionality.

See bug 37941 for updating forms to not share actions

To test:
1 - Checkout some items to patrons of at least two libraries
2 - Tools -> Batch extend due dates
3 - Select nothing except 'preview' and submit
4 - Blank screen
5 - Apply patch, repeat
6 - It works!
7 - Filter by library and confirm it still works
8 - Sign off!

Signed-off-by: Janusz Kaczmarek <januszop@gmail.com>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Comment 9 Katrin Fischer 2024-09-27 17:41:19 UTC
Pushed for 24.11!

Well done everyone, thank you!
Comment 10 Lucas Gass (lukeg) 2024-10-09 19:31:28 UTC
Backported to 24.05.x for upcoming 24.05.05
Comment 11 Fridolin Somers 2024-10-21 13:05:55 UTC
Depends on Bug 34478 not in 23.11.x