From 2ea65d916e4a37a52d98a27258be025262c5a1a3 Mon Sep 17 00:00:00 2001
From: Fridolyn SOMERS <fridolyn.somers@biblibre.com>
Date: Thu, 21 Feb 2013 16:27:49 +0100
Subject: [PATCH] [SIGNED-OFF] Bug 7019: Circulation History Sort Order Wrong
 (in datatable)
Content-Type: text/plain; charset="utf-8"

The return column sort is using the right sort algorithm because it was
confused by the combination of date data and text data ("Checked out").

This patch adds an explicit instruction to sort by date for UK and US
formats.

Test plan :
- set dateformat syspref to "dd/mm/yyyy"
- Go to members/readingrec.pl for a borrower having a old issues and
checked out issues
=> Check that sort of "Return date" is correct.
For example :
With patch :
  20/01/2011
  06/03/2011
  20/03/2011
  Checked Out
Without patch :
  06/03/2011
  20/01/2011
  20/03/2011
  Checked Out
- Test also with dateformat syspref "mm/dd/yyyy"

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
---
 .../prog/en/modules/members/readingrec.tt          |    7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/members/readingrec.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/members/readingrec.tt
index 32c91a7..9d57958 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/readingrec.tt
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/readingrec.tt
@@ -13,6 +13,13 @@
         dt_add_type_uk_date();
     [% END %]
     $("#table_readingrec").dataTable($.extend(true, {}, dataTablesDefaults, {
+        "aoColumnDefs": [
+        [% IF (dateformat == 'metric') %]
+            { "aTargets": [ -1 ], "sType": "uk_date" },
+        [% ELSIF (dateformat == 'us') %]
+            { "aTargets": [ -1 ], "sType": "date" },
+        [% END %]
+        ],
         "sPaginationType": "four_button",
     }));
  });
-- 
1.7.9.5