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>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
This commit is contained in:
Fridolin Somers 2023-03-27 11:29:01 -10:00 committed by Tomas Cohen Arazi
parent 74dd4dc281
commit dae97fd2b7
No known key found for this signature in database
GPG Key ID: 0A272EA1B2F3C15F
2 changed files with 3 additions and 2 deletions

View File

@ -627,7 +627,7 @@ $template->param(
debt_confirmed => $debt_confirmed,
SpecifyDueDate => $duedatespec_allow,
PatronAutoComplete => C4::Context->preference("PatronAutoComplete"),
todaysdate => dt_from_string()->set(hour => 23)->set(minute => 59),
today_due_date_and_time => dt_from_string()->set(hour => 23)->set(minute => 59),
restriction_types => scalar Koha::Patron::Restriction::Types->search(),
has_modifications => $has_modifications,
override_high_holds => $override_high_holds,

View File

@ -1083,7 +1083,8 @@
// On-site checkout
function toggle_onsite_checkout(){
if ( $("#onsite_checkout").prop('checked') ) {
$("#duedatespec").val("[% todaysdate | $KohaDates with_hours => 1 %]")
const duedatespec_fp = document.querySelector("#duedatespec")._flatpickr;
duedatespec_fp.setDate("[% today_due_date_and_time | $KohaDates dateformat => 'iso', with_hours => 1 %]");
}
}