Bug 12729 - Overdue items won't show as overdue in red in circulation

It seems that Firefox date parser doesn't like our dates which are
formatted in ISO format like "2014-08-06 00:00:00". This results in
missing red color in overdue dates.

So intead of munching different date formats and JavaScript (and having
to support different browers) this patch moves check for overdue dates
back to mysql and just transfers boolean value to JavaScript so it can
show correct class for date_due.

Test scenario:
1. find borrower with overdue checkouts
2. verify that all dates are black (and are in ISO format)
3. apply this patch
4. reload page and verify that overdue dates turned red

Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Tested with different due dates (hourly and not) and different date formats.
Passes tests and QA script.

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
This commit is contained in:
Dobrica Pavlinusic 2014-09-04 15:16:57 +02:00 committed by Tomas Cohen Arazi
parent 09c4417216
commit b8fae8489f
2 changed files with 3 additions and 3 deletions

View File

@ -151,9 +151,7 @@ $(document).ready(function() {
{
"iDataSort": 1, // Sort on hidden unformatted date due column
"mDataProp": function( oObj ) {
var today = new Date();
var due = new Date( oObj.date_due );
if ( today > due ) {
if ( oObj.date_due_overdue ) {
return "<span class='overdue'>" + oObj.date_due_formatted + "</span>";
} else {
return oObj.date_due_formatted;

View File

@ -60,6 +60,7 @@ my $sql = '
SELECT
issuedate,
date_due,
date_due < now() as date_due_overdue,
biblionumber,
biblio.title,
@ -148,6 +149,7 @@ while ( my $c = $sth->fetchrow_hashref() ) {
biblionumber => $c->{biblionumber},
issuedate => $c->{issuedate},
date_due => $c->{date_due},
date_due_overdue => $c->{date_due_overdue} ? JSON::true : JSON::false,
renewals_count => $renewals_count,
renewals_allowed => $renewals_allowed,
renewals_remaining => $renewals_remaining,