From 94446917946de314302345f0b28503fcbea38c70 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Mon, 13 Aug 2018 13:23:00 -0300 Subject: [PATCH] Bug 21176: Fix due date calculation when high holds and TimeFormat is 12hr What we were doing was wrong and is still wrong. The output_pref should not be done in modules or script, only template side. Much more work would be needed to clean the situation. This patch provides less changes as possible to, hopefully, not introduce side-effects. To recreate: 1 - Enable decreaseLoanHighHolds, set to 1 day and more than 0 holds 2 - Set TimeFormat to 12 hour 3 - Find or create a record with two items 4 - Place a hold on one of them 5 - Checkout the other to a different patron 6 - Note the warning message display correct time 7 - Confirm the checkout 8 - Note the item is due at 11:59AM Signed-off-by: Martin Renvoize Signed-off-by: Chris Cormack Signed-off-by: Nick Clemens (cherry picked from commit 11885e75c04fa53cd88daae1ec0dc4a2a8ecd1f7) Signed-off-by: Martin Renvoize (cherry picked from commit 1d8a66ad010247c90a8930f4d2b48f96bbfe3b7e) Signed-off-by: Fridolin Somers --- C4/Circulation.pm | 4 ++-- koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/C4/Circulation.pm b/C4/Circulation.pm index 0da90779b7..7b7ecb7ce5 100644 --- a/C4/Circulation.pm +++ b/C4/Circulation.pm @@ -1043,14 +1043,14 @@ sub CanBookBeIssued { $alerts{HIGHHOLDS} = { num_holds => $check->{outstanding}, duration => $check->{duration}, - returndate => output_pref( $check->{due_date} ), + returndate => output_pref( { dt => dt_from_string($check->{due_date}), dateformat => 'iso', timeformat => '24hr' }), }; } else { $needsconfirmation{HIGHHOLDS} = { num_holds => $check->{outstanding}, duration => $check->{duration}, - returndate => output_pref( $check->{due_date} ), + returndate => output_pref( { dt => dt_from_string($check->{due_date}), dateformat => 'iso', timeformat => '24hr' }), }; } } diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt index 245bac1155..7436ed643a 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt @@ -174,7 +174,7 @@ $(document).ready(function() { [% END %] [% IF alert.HIGHHOLDS %] -
High demand item. Loan period was not shortened due to override. Shortened due date would have been [% alert.HIGHHOLDS.returndate %] ([% alert.HIGHHOLDS.duration %] days).
+
High demand item. Loan period was not shortened due to override. Shortened due date would have been [% alert.HIGHHOLDS.returndate | $KohaDates %] ([% alert.HIGHHOLDS.duration | html %] days).
[% END %] [% IF ( nopermission ) %] @@ -283,7 +283,7 @@ $(document).ready(function() { [% END %] [% IF HIGHHOLDS %] -
  • High demand item. Loan period shortened to [% HIGHHOLDS.duration %] days (due [% HIGHHOLDS.returndate %]). Check out anyway?
  • +
  • High demand item. Loan period shortened to [% HIGHHOLDS.duration | html %] days (due [% HIGHHOLDS.returndate | $KohaDates %]). Check out anyway?
  • [% END %] [% IF PREVISSUE %] -- 2.39.2