Bug 25789

Summary: New expiration date on placing a hold in staff interface can be set to a date in the past
Product: Koha Reporter: George Williams (NEKLS) <george>
Component: Hold requestsAssignee: Emmi Takkinen <emmi.takkinen>
Status: Pushed to oldstable --- QA Contact: Testopia <testopia>
Severity: trivial    
Priority: P5 - low CC: aleisha, caroline.cyr-la-rose, emmi.takkinen, gmcharlt, jonathan.druart+koha, lucas, victor
Version: master   
Hardware: All   
OS: All   
Change sponsored?: --- Patch complexity: Trivial patch
Text to go in the release notes:
Version(s) released in:
20.11.00, 20.05.02, 19.11.08
Bug Depends on:    
Bug Blocks: 26429, 28124    
Attachments: Bug 25789: Don't allow past date as holds expiration date
Bug 25789: Don't allow past date as holds expiration date
Bug 25789: Don't allow past date as holds expiration date

Description George Williams (NEKLS) 2020-06-17 19:15:24 UTC
When creating a new request on request.pl, staff cannot set a hold expires on date in the past -- input name="expiration_date".

When editing an existing request, however, the new datepicker for editing the expiration date on request.pl does allow for a date to be set in the past -- input name="expirationdate".
Comment 1 Emmi Takkinen 2020-06-18 07:04:41 UTC
Created attachment 105996 [details] [review]
Bug 25789: Don't allow past date as holds expiration date

When editing existing holds expiration date it's possible to select
past date from datepicker. This patch changes expiration inputs class
as "datepickerto" to make past dates unselectable.

To test:
1.  Find item with holds
2.  Edit holds expiration date
=> Note that past dates are selectable
3. Apply patch
4. Edit again
=> Past dates are no longer selectable

Sponsored-by: Koha-Suomi Oy
Comment 2 Emmi Takkinen 2020-06-18 07:10:33 UTC
Also valid in master and patch provided is made against it. Changed version of this bug as 'master'.
Comment 3 Owen Leonard 2020-06-18 12:27:19 UTC
Created attachment 106005 [details] [review]
Bug 25789: Don't allow past date as holds expiration date

When editing existing holds expiration date it's possible to select
past date from datepicker. This patch changes expiration inputs class
as "datepickerto" to make past dates unselectable.

To test:
1.  Find item with holds
2.  Edit holds expiration date
=> Note that past dates are selectable
3. Apply patch
4. Edit again
=> Past dates are no longer selectable

Sponsored-by: Koha-Suomi Oy

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Comment 4 Katrin Fischer 2020-06-21 16:05:41 UTC
Created attachment 106131 [details] [review]
Bug 25789: Don't allow past date as holds expiration date

When editing existing holds expiration date it's possible to select
past date from datepicker. This patch changes expiration inputs class
as "datepickerto" to make past dates unselectable.

To test:
1.  Find item with holds
2.  Edit holds expiration date
=> Note that past dates are selectable
3. Apply patch
4. Edit again
=> Past dates are no longer selectable

Sponsored-by: Koha-Suomi Oy

Signed-off-by: Owen Leonard <oleonard@myacpl.org>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Comment 5 Jonathan Druart 2020-06-24 13:33:20 UTC
Pushed to master for 20.11, thanks to everybody involved!
Comment 6 Lucas Gass 2020-07-10 16:29:50 UTC
backported to 20.05.x for 20.05.02
Comment 7 Aleisha Amohia 2020-07-13 02:35:56 UTC
backported to 19.11.x for 19.11.08
Comment 8 Victor Grousset/tuxayo 2020-07-24 00:09:18 UTC
Can't backport to 19.05.x, the code doesn't seems to have that part here (a datepicker). Maybe the feature wasn't here, maybe it moved from another file
If interested, feel free to investigate further.
Comment 9 Caroline Cyr La Rose 2020-08-21 14:02:00 UTC
For the sake of the release notes, I'm classifying this as a bug rather than an enhancement. 

Feel free to change it back if you think this is wrong.