Bugzilla – Attachment 22305 Details for
Bug 7019
Circulation History Sort Order Wrong
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 7019: [3.10.x] Circulation History Sort Order Wrong (in datatable)
Bug-7019-310x-Circulation-History-Sort-Order-Wrong.patch (text/plain), 3.69 KB, created by
Jonathan Druart
on 2013-10-23 09:35:27 UTC
(
hide
)
Description:
Bug 7019: [3.10.x] Circulation History Sort Order Wrong (in datatable)
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2013-10-23 09:35:27 UTC
Size:
3.69 KB
patch
obsolete
>From 62c6337f038acee392d623c5c0f0b45bc8b5bc01 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: [3.10.x] 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" >--- > koha-tmpl/intranet-tmpl/prog/en/js/datatables.js | 25 +++++++++++++++++++ > .../prog/en/modules/members/readingrec.tt | 26 ++++++++++++++------ > 2 files changed, 44 insertions(+), 7 deletions(-) > >diff --git a/koha-tmpl/intranet-tmpl/prog/en/js/datatables.js b/koha-tmpl/intranet-tmpl/prog/en/js/datatables.js >index b43f2f8..e89b3e7 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/js/datatables.js >+++ b/koha-tmpl/intranet-tmpl/prog/en/js/datatables.js >@@ -414,3 +414,28 @@ $.fn.dataTableExt.oSort['num-html-desc'] = function(a,b) { > y = parseFloat( y ); > return ((x < y) ? 1 : ((x > y) ? -1 : 0)); > }; >+ >+/* Plugin to allow sorting on data stored in a span's title attribute >+ * >+ * Ex: <td><span title="[% ISO_date %]">[% formatted_date %]</span></td> >+ * >+ * In DataTables config: >+ * "aoColumns": [ >+ * { "sType": "title-string" }, >+ * ] >+ * http://datatables.net/plug-ins/sorting#hidden_title_string >+ */ >+jQuery.extend( jQuery.fn.dataTableExt.oSort, { >+ "title-string-pre": function ( a ) { >+ return a.match(/title="(.*?)"/)[1].toLowerCase(); >+ }, >+ >+ "title-string-asc": function ( a, b ) { >+ return ((a < b) ? -1 : ((a > b) ? 1 : 0)); >+ }, >+ >+ "title-string-desc": function ( a, b ) { >+ return ((a < b) ? 1 : ((a > b) ? -1 : 0)); >+ } >+} ); >+ >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 e062fef..dd82548 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/readingrec.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/readingrec.tt >@@ -10,7 +10,19 @@ > $(document).ready(function() { > $("#table_readingrec").dataTable($.extend(true, {}, dataTablesDefaults, { > "sPaginationType": "four_button", >- "aaSorting": [] >+ "aaSorting": [], >+ "aoColumns": [ >+ null, >+ null, >+ null, >+ null, >+ null, >+ null, >+ null, >+ null, >+ null, >+ { "sType": "title-string" } >+ ] > })); > }); > }); </script> >@@ -74,12 +86,12 @@ > [% issue.date_due | $KohaDates %] > [% ELSE %] [% 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.7.10.4
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 7019
:
5874
|
5877
|
5891
|
15589
|
15710
|
19549
|
19707
|
19723
| 22305