@@ -, +, @@ - Pass two new unformatted date variables to the template from circulation.pl so that sorting can be performed on this data. - Add DataTables configurations for the table of checkouts and the table of relatives' checkouts. - Add a new plugin to the main DataTables configuration script to allow sorting on data embedded in a 's 'title' attribute. - Add s to each table with a title attribute containing the unformatted date data which DataTables needs to perform correct sorting. This eliminates the need for a special sorting algorithm to accomodate various date and datetime formatting options. - Set a template variable for checking whether circ exports are enabled. This reduces repetition. DataTables configuration changes based on how many columns are present. - Having only checkouts from today - Having checkouts from today and previous days - Having checkouts only from previous days - Having relatives who have checkouts (from today, from previous days, from both) --- circ/circulation.pl | 2 + .../intranet-tmpl/prog/en/css/staff-global.css | 11 +- koha-tmpl/intranet-tmpl/prog/en/js/datatables.js | 25 +++- .../prog/en/modules/circ/circulation.tt | 120 +++++++++++--------- 4 files changed, 101 insertions(+), 57 deletions(-) --- a/circ/circulation.pl +++ a/circ/circulation.pl @@ -466,7 +466,9 @@ sub build_issue_data { $totalprice += $it->{'replacementprice'} || 0; $it->{'itemtype'} = $itemtypeinfo->{'description'}; $it->{'itemtype_image'} = $itemtypeinfo->{'imageurl'}; + $it->{'dd_sort'} = $it->{'date_due'}; $it->{'dd'} = output_pref($it->{'date_due'}); + $it->{'displaydate_sort'} = $it->{'issuedate'}; $it->{'displaydate'} = output_pref($it->{'issuedate'}); #$it->{'od'} = ( $it->{'date_due'} lt $todaysdate ) ? 1 : 0 ; $it->{'od'} = $it->{'overdue'}; --- a/koha-tmpl/intranet-tmpl/prog/en/css/staff-global.css +++ a/koha-tmpl/intranet-tmpl/prog/en/css/staff-global.css @@ -256,15 +256,18 @@ table+table { .highlighted-row { background-color: orange !important } -tr.highlight td, tr.highlight th, tr.odd td { +tr.highlight td, +tr.highlight th, +tr.odd td, +tr.odd.highlight td { background-color : #F3F3F3; - border : 1px solid #DDDDDD; - border-right : 1px solid #DDDDDD; + border : 1px solid #BCBCBC; + border-right : 1px solid #BCBCBC; } tr.even td, tr.even.highlight td { background-color: #FFF; - border-right : 1px solid #DDDDDD; + border-right : 1px solid #BCBCBC; } td.od { --- a/koha-tmpl/intranet-tmpl/prog/en/js/datatables.js +++ a/koha-tmpl/intranet-tmpl/prog/en/js/datatables.js @@ -470,4 +470,27 @@ jQuery.extend( jQuery.fn.dataTableExt.oSort, { } } ); -}()); +}()); +/* Plugin to allow sorting on data stored in a span's title attribute + * + * Ex: [% formatted_date %] + * + * 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)); + } +} ); --- a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt +++ a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt @@ -1,4 +1,7 @@ [% USE KohaDates %] +[% IF ( export_remove_fields OR export_with_csv_profile ) %] + [% SET exports_enabled = 1 %] +[% END %] [% USE KohaAuthorisedValues %] [% INCLUDE 'doc-head-open.inc' %] [% SET destination = "circ" %] @@ -9,45 +12,57 @@ [% INCLUDE 'doc-head-close.inc' %] [% INCLUDE 'calendar.inc' %] -[% IF ( UseTablesortForCirc ) %][% END %] +[% IF ( UseTablesortForCirc ) %] + +[% INCLUDE 'datatables-strings.inc' %] +[% END %]