Bug 18011

Summary: Enrollment period date on patron category can be set in the past without any error/warning messages
Product: Koha Reporter: Alex Buckley <alexbuckley>
Component: System AdministrationAssignee: Owen Leonard <oleonard>
Status: CLOSED FIXED QA Contact: Testopia <testopia>
Severity: normal    
Priority: P3 CC: gmcharlt, hayleypelham, lucas, martin.renvoize, nick
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:
19.05.00, 18.11.05
Circulation function:
Attachments: Bug 18011: Enrollment period date on patron category can be set in the past without any error/warning messages
Bug 18011: Enrollment period date on patron category can be set in the past without any error/warning messages
Bug 18011: Enrollment period date on patron category can be set in the past without any error/warning messages

Description Alex Buckley 2017-01-30 03:52:56 UTC
At present when creating a patron category the user can select a date from the date picker which is earlier than the current date, meaning patrons created from the patron category have a dateexpire before they were even created. 

The fix of this bug is to implement a javascript message informing the user that the date they selected from the datepicker is invalid and forcing them to choose a new date before they can submit the form.
Comment 1 Owen Leonard 2017-01-30 14:59:43 UTC
Check out the options for the datepicker widget which can limit the range of dates which will be accepted.

https://jqueryui.com/datepicker/#min-max

For instance, in returns.tt starting at line 60. That template also has some back-up date testing in case someone types an invalid date directly.
Comment 2 Katrin Fischer 2019-02-03 12:20:19 UTC
Still valid, resetting to master and rephrasing/shortening bug title a bit.
Comment 3 Hayley Pelham 2019-04-11 04:04:43 UTC
(In reply to Katrin Fischer from comment #2)
> Still valid, resetting to master and rephrasing/shortening bug title a bit.

I have tried to fix this to no avail. Min-max were specified but did not work. Am resetting to new as someone more familiar with Javascript may wish to have a crack at it.
Comment 4 Owen Leonard 2019-04-12 11:16:03 UTC
Created attachment 87878 [details] [review]
Bug 18011: Enrollment period date on patron category can be set in the past without any error/warning messages

This patch modifies the patron category edit form so that the enrollment
period datepicker widget cannot be used to select a date in the past.

The <input> element had a "datepicker" class, which triggers a default
datepicker configuration. This was overriding the configuration in the
page-specific JavaScript file.

To test, apply the patch and go to Administration -> Patron categories.

Click the "Enrollment period -> Until date" field and verify that dates
before today are disabled.
Comment 5 Pierre-Marc Thibault 2019-04-12 18:34:06 UTC
Created attachment 87935 [details] [review]
Bug 18011: Enrollment period date on patron category can be set in the past without any error/warning messages

This patch modifies the patron category edit form so that the enrollment
period datepicker widget cannot be used to select a date in the past.

The <input> element had a "datepicker" class, which triggers a default
datepicker configuration. This was overriding the configuration in the
page-specific JavaScript file.

To test, apply the patch and go to Administration -> Patron categories.

Click the "Enrollment period -> Until date" field and verify that dates
before today are disabled.

Signed-off-by: Pierre-Marc Thibault <pierre-marc.thibault@inLibro.com>
Comment 6 Chris Cormack 2019-04-15 00:36:39 UTC
Created attachment 87973 [details] [review]
Bug 18011: Enrollment period date on patron category can be set in the past without any error/warning messages

This patch modifies the patron category edit form so that the enrollment
period datepicker widget cannot be used to select a date in the past.

The <input> element had a "datepicker" class, which triggers a default
datepicker configuration. This was overriding the configuration in the
page-specific JavaScript file.

To test, apply the patch and go to Administration -> Patron categories.

Click the "Enrollment period -> Until date" field and verify that dates
before today are disabled.

Signed-off-by: Pierre-Marc Thibault <pierre-marc.thibault@inLibro.com>
Signed-off-by: Chris Cormack <chris@bigballofwax.co.nz>
Comment 7 Nick Clemens (kidclamp) 2019-04-16 13:22:53 UTC
Awesome work all!

Pushed to master for 19.05
Comment 8 Martin Renvoize (ashimema) 2019-04-25 14:07:51 UTC
Pushed to 18.11.x for 18.11.05
Comment 9 Lucas Gass (lukeg) 2019-05-10 20:17:14 UTC
backported to 18.05.x for 18.05.13