From b8fae8489f013d55fac6c660e80bbd7aed31deff 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 Signed-off-by: Katrin Fischer Tested with different due dates (hourly and not) and different date formats. Passes tests and QA script. Signed-off-by: Kyle M Hall Signed-off-by: Tomas Cohen Arazi --- 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 6efe9f9c87..4424d3af59 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 abe2c0e085..f56bdffb83 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, -- 2.39.2