Bug 36459

Summary: Backdating checkouts on circ/circulation.pl not working properly
Product: Koha Reporter: Lucas Gass (lukeg) <lucas>
Component: CirculationAssignee: Lucas Gass (lukeg) <lucas>
Status: RESOLVED FIXED QA Contact: Emily Lamancusa (emlam) <emily.lamancusa>
Severity: normal    
Priority: P5 - low CC: andrew, Chip.Halvorsen, david, emily.lamancusa, fridolin.somers, gmcharlt, kyle.m.hall, phil, thibaud.guillot, victor, wainuiwitikapark
Version: Main   
Hardware: All   
OS: All   
Change sponsored?: --- Patch complexity: Trivial patch
Documentation contact: Documentation submission:
Text to go in the release notes:
This fixes setting a due date in the past when checking out an item to a patron. The date entered was not remembered and not displayed on the "Please confirm checkout" message - you had to select and add the date again.
Version(s) released in:
24.11.00,24.05.02,23.11.07
Circulation function:
Bug Depends on: 36494, 18885    
Bug Blocks:    
Attachments: Bug 36459: Do not set an empty flatpickr explicitly
Bug 36459: Do not set an empty flatpickr explicitly
Bug 36459: Do not duplicate duedatespec IDs
Bug 36459: Do not duplicate duedatespec IDs
Bug 36459: Do not duplicate duedatespec IDs

Description Lucas Gass (lukeg) 2024-03-28 16:42:26 UTC
To recreate: 

1. Go to circ/circulation.pl and check an item out to a patron.
2. Backdate it to sometime in the past using the "Specify due date (MM/DD/YYYY) : " input
3. A modal appears to "Please confirm checkout". The date is no longer populated in that field. 
4. You must add the date again here. 


This is due to Bug 18885.
Comment 1 Lucas Gass (lukeg) 2024-03-28 18:15:33 UTC
This highlights the fact that there are multiple '#duedatespec' on the same page.
Comment 2 Lucas Gass (lukeg) 2024-05-23 16:38:45 UTC Comment hidden (obsolete)
Comment 3 Lucas Gass (lukeg) 2024-05-23 16:41:15 UTC
(In reply to Lucas Gass from comment #1)
> This highlights the fact that there are multiple '#duedatespec' on the same
> page.

I didn't address this with my patch but we should do so.
Comment 4 David Nind 2024-05-23 19:47:03 UTC Comment hidden (obsolete)
Comment 5 Emily Lamancusa (emlam) 2024-06-12 16:27:09 UTC
This does break 18885, I'm afraid:

1. Have OnSiteCheckouts enabled and OnSiteAutoCheck disabled
2. Go to circulation.pl
3. Check the checkbox for on-site checkout
--> The checkout date is auto-populated with today's date
4. Check out an item
--> When the page reloads, the checkbox is no longer checked, but the checkout date is still populated

In the use case you're aiming to fix here, though, on-site checkouts was never checked in the first place...so why is #duedatespec being cleared at all? I think there's something deeper going on here.
Comment 6 Lucas Gass (lukeg) 2024-06-12 16:39:55 UTC
(In reply to Emily Lamancusa from comment #5)
> This does break 18885, I'm afraid:
> 
> 1. Have OnSiteCheckouts enabled and OnSiteAutoCheck disabled
> 2. Go to circulation.pl
> 3. Check the checkbox for on-site checkout
> --> The checkout date is auto-populated with today's date
> 4. Check out an item
> --> When the page reloads, the checkbox is no longer checked, but the
> checkout date is still populated
> 
> In the use case you're aiming to fix here, though, on-site checkouts was
> never checked in the first place...so why is #duedatespec being cleared at
> all? I think there's something deeper going on here.

Are you sure? In my testing steps 1-4 only work when my patch from this bug is applied. Without this patch:

-I check the on-site checkbox, today's date is populated. 
-I checkout an item, both the checkbox and the due date is cleared

With my patch:
-I check the on-site checkbox, today's date is populated. 
-I checkout an item, the checkbox is cleared but the date remains.
Comment 7 Lucas Gass (lukeg) 2024-06-12 19:41:10 UTC
Created attachment 167676 [details] [review]
Bug 36459: Do not duplicate duedatespec IDs

To test;
1. Go to circ/circulation.pl and check an item out to a patron.
2. Backdate it to sometime in the past using the "Specify due date (MM/DD/YYYY) : " input
3. A modal appears to "Please confirm checkout". The date is no longer populated in that field.
4. You must add the date again here.
5. APPLY PATCH
6. Try again and this time the confimration date should be set correctly.
7. Follow the test plan from Bug 18885 to make sure on site checkouts still work correctly.
Comment 8 Lucas Gass (lukeg) 2024-06-12 19:41:50 UTC
Completely new patch, so resetting to NSO.
Comment 9 Owen Leonard 2024-06-13 11:31:39 UTC
Created attachment 167684 [details] [review]
Bug 36459: Do not duplicate duedatespec IDs

To test;
1. Go to circ/circulation.pl and check an item out to a patron.
2. Backdate it to sometime in the past using the "Specify due date
   (MM/DD/YYYY) : " input
3. A modal appears to "Please confirm checkout". The date is no longer
   populated in that field.
4. You must add the date again here.
5. APPLY PATCH
6. Try again and this time the confimration date should be set
   correctly.
7. Follow the test plan from Bug 18885 to make sure on site checkouts
   still work correctly.

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Comment 10 Emily Lamancusa (emlam) 2024-06-13 17:26:33 UTC
Created attachment 167693 [details] [review]
Bug 36459: Do not duplicate duedatespec IDs

To test;
1. Go to circ/circulation.pl and check an item out to a patron.
2. Backdate it to sometime in the past using the "Specify due date
   (MM/DD/YYYY) : " input
3. A modal appears to "Please confirm checkout". The date is no longer
   populated in that field.
4. You must add the date again here.
5. APPLY PATCH
6. Try again and this time the confimration date should be set
   correctly.
7. Follow the test plan from Bug 18885 to make sure on site checkouts
   still work correctly.

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Emily Lamancusa <emily.lamancusa@montgomerycountymd.gov>
Comment 11 Emily Lamancusa (emlam) 2024-06-13 17:35:50 UTC
Thanks for the new patch and signoff! Looks good and works as expected. Passing QA
Comment 12 Martin Renvoize (ashimema) 2024-06-14 10:16:24 UTC
Thanks for all the hard work!

Pushed to main for the next 24.11.00 release as RM Assistant
Comment 13 Lucas Gass (lukeg) 2024-07-11 19:04:06 UTC
*** Bug 37332 has been marked as a duplicate of this bug. ***
Comment 14 Lucas Gass (lukeg) 2024-07-11 19:29:17 UTC
Backported to 24.05.x for upcoming 24.05.02
Comment 15 Fridolin Somers 2024-07-17 14:24:47 UTC
Pushed to 23.11.x for 23.11.07
Comment 16 Wainui Witika-Park 2024-07-19 03:40:14 UTC
not backporting to 23.05.x unless requested
Comment 17 Phil Ringnalda 2024-11-15 01:15:42 UTC
Backporting to 23.05.x actually was sort of requested by comment 0, since this bug was filed because Lucas wasn't going to backport bug 18885 to 23.05.x unless this was fixed.
Comment 18 Wainui Witika-Park 2024-11-18 05:45:41 UTC
(In reply to Phil Ringnalda from comment #17)
> Backporting to 23.05.x actually was sort of requested by comment 0, since
> this bug was filed because Lucas wasn't going to backport bug 18885 to
> 23.05.x unless this was fixed.

Sorry, 23.05.x is no longer maintained now.