From 0c16eab8a794ef57487bffaa5ac28f679489cdfa Mon Sep 17 00:00:00 2001 From: Dobrica Pavlinusic Date: Thu, 4 Sep 2014 15:16:57 +0200 Subject: [PATCH] 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 --- koha-tmpl/intranet-tmpl/prog/en/js/checkouts.js | 4 +--- svc/checkouts | 2 ++ 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/en/js/checkouts.js b/koha-tmpl/intranet-tmpl/prog/en/js/checkouts.js index 6efe9f9..4424d3a 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/js/checkouts.js +++ b/koha-tmpl/intranet-tmpl/prog/en/js/checkouts.js @@ -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 "" + oObj.date_due_formatted + ""; } else { return oObj.date_due_formatted; diff --git a/svc/checkouts b/svc/checkouts index abe2c0e..f56bdff 100755 --- a/svc/checkouts +++ b/svc/checkouts @@ -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, -- 1.7.2.5