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 <martin.renvoize@ptfs-europe.com>
Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz>

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
(cherry picked from commit 11885e75c0)
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
This commit is contained in:
Jonathan Druart 2018-08-13 13:23:00 -03:00 committed by Martin Renvoize
parent 3e77e7a4d6
commit 1d8a66ad01
No known key found for this signature in database
GPG Key ID: 422B469130441A0F
2 changed files with 4 additions and 4 deletions

View File

@ -1034,14 +1034,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' }),
};
}
}

View File

@ -71,7 +71,7 @@
[% END %]
[% IF alert.HIGHHOLDS %]
<div class="dialog message">High demand item. <b>Loan period was not shortened due to override.</b> Shortened due date would have been [% alert.HIGHHOLDS.returndate %] ([% alert.HIGHHOLDS.duration %] days).</div>
<div class="dialog message">High demand item. <b>Loan period was not shortened due to override.</b> Shortened due date would have been [% alert.HIGHHOLDS.returndate | $KohaDates %] ([% alert.HIGHHOLDS.duration | html %] days).</div>
[% END %]
[% IF ( nopermission ) %]
@ -180,7 +180,7 @@
[% END %]
[% IF HIGHHOLDS %]
<li>High demand item. Loan period shortened to [% HIGHHOLDS.duration %] days (due [% HIGHHOLDS.returndate %]). Check out anyway?</li>
<li>High demand item. Loan period shortened to [% HIGHHOLDS.duration | html %] days (due [% HIGHHOLDS.returndate | $KohaDates %]). Check out anyway?</li>
[% END %]
[% IF PREVISSUE %]