Bug 33345 - On-site checkout checkbox does not work since issue date using flatpickr
Summary: On-site checkout checkbox does not work since issue date using flatpickr
Status: CLOSED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: Templates (show other bugs)
Version: Main
Hardware: All All
: P5 - low normal (vote)
Assignee: Fridolin Somers
QA Contact: Katrin Fischer
URL:
Keywords:
Depends on: 30718
Blocks:
  Show dependency treegraph
 
Reported: 2023-03-27 21:03 UTC by Fridolin Somers
Modified: 2023-12-28 20:42 UTC (History)
2 users (show)

See Also:
Change sponsored?: ---
Patch complexity: Trivial patch
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:
23.05.00,22.11.05


Attachments
Bug 33345: On-site checkout checkbox does not work since issue date using flatpickr (1.94 KB, patch)
2023-03-27 21:30 UTC, Fridolin Somers
Details | Diff | Splinter Review
Bug 33345: On-site checkout checkbox does not work since issue date using flatpickr (2.60 KB, patch)
2023-03-27 21:48 UTC, Fridolin Somers
Details | Diff | Splinter Review
Bug 33345: On-site checkout checkbox does not work since issue date using flatpickr (2.65 KB, patch)
2023-04-08 19:03 UTC, David Nind
Details | Diff | Splinter Review
Bug 33345: On-site checkout checkbox does not work since issue date using flatpickr (2.70 KB, patch)
2023-04-09 12:19 UTC, Katrin Fischer
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Fridolin Somers 2023-03-27 21:03:01 UTC
Since Bug 30718, date due uses flatpickr.
The JavaScript code setting due date via on-site checkout checkbox needs to be adapted.
Sort of like Bug 30717.
Comment 1 Fridolin Somers 2023-03-27 21:30:02 UTC
Created attachment 148786 [details] [review]
Bug 33345: On-site checkout checkbox does not work since issue date using flatpickr

WIP
Comment 2 Fridolin Somers 2023-03-27 21:34:19 UTC
There are other places setting 'duedatespec' input, but they are hidden so not with flatpickr :

koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt:                    $("input[name=duedatespec]:hidden").val('[% HIGHHOLDS.returndate | html %]');
koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt:                        $("input[name=restoreduedatespec]:hidden").val('highholds_empty');
koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt:                        $("input[name=restoreduedatespec]:hidden").val('[% duedatespec | html %]');
koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt:                        $("input[name=duedatespec]:hidden").val('');
koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation_batch_checkouts.tt:                              $("input[name=duedatespec]:hidden").val('[% checkout_info.HIGHHOLDS.returndate | html %]');
koha-tmpl/intranet-tmpl/prog/en/modules/circ/offline.tt:            if ($('#duedatespec').val().length === 0) {
koha-tmpl/intranet-tmpl/prog/en/modules/circ/offline.tt:            var date_due = flatpickr.parseDate( $('#duedatespec').val(), flatpickr_datetime_string );
Comment 3 Fridolin Somers 2023-03-27 21:48:37 UTC
Created attachment 148787 [details] [review]
Bug 33345: On-site checkout checkbox does not work since issue date using flatpickr

Since Bug 30718, date due uses flatpickr.
The JavaScript code setting due date via on-site checkout checkbox needs to be adapted.
Sort of like Bug 30717.

This patch renames the variable sent to template
'today_due_date_and_time' to avoid confusion with variable 'todaysdate'
used in other templates.

Test plan :
1) Enable system preference 'OnSiteCheckouts'
2) Go to a patron circulation page /cgi-bin/koha/circ/circulation.pl
3) Click on settings icon inside barcode input
=> Check due date input is empty
4) Click on 'On-site checkout'
=> Check due date input is filled with today date at 23:59
5) Fill barcode input and do check-out
6) Check due date is correct
Comment 4 David Nind 2023-04-08 19:03:40 UTC
Created attachment 149298 [details] [review]
Bug 33345: On-site checkout checkbox does not work since issue date using flatpickr

Since Bug 30718, date due uses flatpickr.
The JavaScript code setting due date via on-site checkout checkbox needs to be adapted.
Sort of like Bug 30717.

This patch renames the variable sent to template
'today_due_date_and_time' to avoid confusion with variable 'todaysdate'
used in other templates.

Test plan :
1) Enable system preference 'OnSiteCheckouts'
2) Go to a patron circulation page /cgi-bin/koha/circ/circulation.pl
3) Click on settings icon inside barcode input
=> Check due date input is empty
4) Click on 'On-site checkout'
=> Check due date input is filled with today date at 23:59
5) Fill barcode input and do check-out
6) Check due date is correct

Signed-off-by: David Nind <david@davidnind.com>
Comment 5 David Nind 2023-04-08 19:10:08 UTC
Testing notes (using KTD):

1. If I understand this correctly, if OnSiteCheckouts is enabled:
   1.1 Go to check out an item for a patron
   1.2 Click on the settings icon in the barcode input field
   1.3 Click the tick box next to 'On-site checkouts'
   1.4 It should automatically fill in the 'Specify due date' field with today's date and 23:59 as the time
   1.5 Before the patch is applied, it doesn't (when it should)
   1.6 After the patch is applied, it does (which is what is expected)
Comment 6 Katrin Fischer 2023-04-09 12:19:18 UTC
Verified that this restores the previous behavior (tested in 20.11).
Comment 7 Katrin Fischer 2023-04-09 12:19:46 UTC
Created attachment 149363 [details] [review]
Bug 33345: On-site checkout checkbox does not work since issue date using flatpickr

Since Bug 30718, date due uses flatpickr.
The JavaScript code setting due date via on-site checkout checkbox needs to be adapted.
Sort of like Bug 30717.

This patch renames the variable sent to template
'today_due_date_and_time' to avoid confusion with variable 'todaysdate'
used in other templates.

Test plan :
1) Enable system preference 'OnSiteCheckouts'
2) Go to a patron circulation page /cgi-bin/koha/circ/circulation.pl
3) Click on settings icon inside barcode input
=> Check due date input is empty
4) Click on 'On-site checkout'
=> Check due date input is filled with today date at 23:59
5) Fill barcode input and do check-out
6) Check due date is correct

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Comment 8 Tomás Cohen Arazi 2023-04-14 14:20:11 UTC
Pushed to master for 23.05.

Nice work everyone, thanks!
Comment 9 Matt Blenkinsop 2023-04-18 12:06:16 UTC
Nice work everyone!

Pushed to stable for 22.11.x
Comment 10 Lucas Gass 2023-05-05 22:13:48 UTC
Missing 22.05.x dependencies, no backport.