From fcfa6c9f521462b959949227916b96c6dafffde5 Mon Sep 17 00:00:00 2001
From: Fridolyn SOMERS <fridolyn.somers@biblibre.com>
Date: Thu, 11 Jul 2013 10:24:07 +0200
Subject: [PATCH] Bug 7019: Circulation History Sort Order Wrong (in datatable)

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

This patch adds the use of datatable "title-string" sort type.
With that, the date in ISO format are used for sorting and because letters are before numbers, "Checked out" rows are more recent than any date.

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: Srdjan <srdjan@catalyst.net.nz>
---
 .../intranet-tmpl/prog/en/modules/members/readingrec.tt    | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

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 f488234..f36e254 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/readingrec.tt
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/readingrec.tt
@@ -26,7 +26,7 @@
             null,
             null,
             null,
-            null
+            { "sType": "title-string" }
         ]
     }));
  });
@@ -92,12 +92,12 @@
                     [% issue.date_due | $KohaDates %]
                 [% ELSE %]&nbsp;[% END %]</td>
             <td>
-        [% IF  issue.returndate %]
-            [% issue.returndate | $KohaDates %]
-        [% ELSE %]
-            Checked Out
-        [% END %]
-	</td>
+                [% IF  issue.returndate %]
+                    <span title="[% issue.returndate %]">[% issue.returndate | $KohaDates %]</span>
+                [% ELSE %]
+                    <span title="Checked Out"><small>Checked Out</small></span>
+                [% END %]
+            </td>
 </tr>
 [% END %]
 </table>
-- 
1.8.1.2