Bug 9887 [Revised] Use DataTables on circulation page
authorOwen Leonard <oleonard@myacpl.org>
Thu, 21 Mar 2013 15:31:43 +0000 (11:31 -0400)
committerJared Camins-Esakov <jcamins@cpbibliography.com>
Mon, 15 Apr 2013 13:10:09 +0000 (09:10 -0400)
commitec9fc2fce4fef573cc337ff3de9b102d6dad3ded
tree6b4271dc9fb0a264a0295593bcf509c5acc0e856
parentb43124750c2bc08647244a07beb942dec0ad64fb
Bug 9887 [Revised] Use DataTables on circulation page

The circulation page, when the  UseTablesortForCirc preference is
enabled, uses the old tablesorter plugin. It should use DataTables
instead.

This patch removes references to the tablesorter plugin and makes these
changes to enable use of DataTables:

- 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 <span>'s 'title' attribute.
- Add <span>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.

To test, load the circulation page for patrons who match various
conditions:

- 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)

Test these situations with UseTablesortForCirc enabled and disabled.
Test these situations with circ exports enabled or disabled (with
ExportRemoveFields filled or empty, for instance).

Sorting should work correctly on all columns with the dateformat
preference set to any option.

All other circulation functions should work normally.

Revision adds missing include for table footer when there are previous
checkouts and removes &nbsp; from empty table header cells which were
messing up auto-detection of numeric data. The global CSS for table
borders has been tightened up to improve handling of alternating row
colors in DataTables-sorted tables.

Signed-off-by: Chris Cormack <chris@bigballofwax.co.nz>
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
All tests and QA script pass.
Note: Don't forget it's the checkout tab and to turn on the
preference to allow sorting there.
Also, while checkouts sorts dates correctly, sorting on the
details tabs was not always correct in my tests.
Signed-off-by: Jared Camins-Esakov <jcamins@cpbibliography.com>
circ/circulation.pl
koha-tmpl/intranet-tmpl/prog/en/css/staff-global.css
koha-tmpl/intranet-tmpl/prog/en/js/datatables.js
koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt