Bug 14016: Restore correct date format on issue date (00:00 vs 23:59)

Introduced by bug 13601, and same fix used in bug 10423 and bug 12847:
the date_due retrieved from the DB is modified.

There are some problems:
1/ There is confusion between the iso and sql formats in the codebase.
2/ Since bug 13601, dt_from_string does not manage the iso format (there
are occurrences of 'iso' but it assumes that both formats are
identical).

To solve the issue, 2 solutions:
1/ Same as bug 10423 and bug 12847: try to get rid of the change done on
date_due in C4::Members::GetPendingIssues, it should be kept as the sql
value.
2/ Too many errors found and another fallback should be added to
dt_from_string (if 'iso' is passed, try sql then iso).

Test plan:
Go on the checkout list at the OPAC and confirm that the due dates are
correctly formatted.

Signed-off-by: Nicolas Legrand <nicolas.legrand@bulac.fr>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
(cherry picked from commit 9ad8b86643)
Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz>
This commit is contained in:
Jonathan Druart 2015-04-20 10:41:19 +02:00 committed by Chris Cormack
parent f6373d8172
commit 97efa0d1bc
2 changed files with 4 additions and 2 deletions

View File

@ -1201,6 +1201,8 @@ sub GetPendingIssues {
if ($_->{issuedate}) {
$_->{issuedate} = dt_from_string($_->{issuedate}, 'sql');
}
$_->{date_due_sql} = $_->{date_due};
# FIXME no need to have this value
$_->{date_due} or next;
$_->{date_due} = DateTime::Format::DateParse->parse_datetime($_->{date_due}, $tz->name());
if ( DateTime->compare($_->{date_due}, $today) == -1 ) {

View File

@ -191,14 +191,14 @@
<td class="date_due overdue">
<span title="[% ISSUE.date_due %]">
<span class="tdlabel">Date due:</span>
[% ISSUE.date_due | $KohaDates as_due_date => 1 %]
[% ISSUE.date_due_sql | $KohaDates as_due_date => 1 %]
</span>
</td>
[% ELSE %]
<td class="date_due">
<span title="[% ISSUE.date_due %]">
<span class="tdlabel">Date due:</span>
[% ISSUE.date_due | $KohaDates as_due_date => 1 %]
[% ISSUE.date_due_sql | $KohaDates as_due_date => 1 %]
</span>
</td>
[% END %]