Bug 9887

Summary: Use DataTables on circulation page
Product: Koha Reporter: Owen Leonard <oleonard>
Component: TemplatesAssignee: Owen Leonard <oleonard>
Status: CLOSED FIXED QA Contact:
Severity: normal    
Priority: P5 - low CC: dcook, jonathan.druart, katrin.fischer
Version: master   
Hardware: All   
OS: All   
URL: /cgi-bin/koha/circ/circulation.pl
Change sponsored?: --- Patch complexity: ---
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
Bug Depends on:    
Bug Blocks: 9463, 9903, 9905    
Attachments: Bug 9887 - Use DataTables on circulation page
Bug 9463 [Revised] Use DataTables on patron sent notices page
Bug 9887 [Revised] Use DataTables on circulation page
Bug 9887 [Revised] Use DataTables on circulation page
wrong date sorting
[PASSED QA] Bug 9887 [Revised] Use DataTables on circulation page

Description Owen Leonard 2013-03-21 13:58:06 UTC
Circulation uses the old tablesorter plugin when the UseTablesortForCirc preference is enabled. It should use DataTables instead.
Comment 1 Owen Leonard 2013-03-22 15:10:25 UTC Comment hidden (obsolete)
Comment 2 Owen Leonard 2013-04-01 14:35:12 UTC Comment hidden (obsolete)
Comment 3 David Cook 2013-04-03 00:05:35 UTC
This patch drops a reference to the 'checkouts-table-footer.inc' file when there are checkouts from previous days. This means that the table footer doesn't appear, which breaks the Return/Renew buttons as well as hiding the fine/price totals, the renewal due date textbox, and forgive fines on return checkbox.

--

I didn't readily have all the test conditions available, but the DataTable looks like it works for today's checkouts and today's and previous days checkouts. 

I'm not sure about just previous days or relatives who have checkouts. 

--

I also noticed that the right border on the right most cells seem to not appear for today checkouts, although that's already present and not caused by this patch.
Comment 4 Owen Leonard 2013-04-03 14:11:53 UTC Comment hidden (obsolete)
Comment 5 Chris Cormack 2013-04-07 03:06:05 UTC Comment hidden (obsolete)
Comment 6 Katrin Fischer 2013-04-07 21:24:22 UTC
Created attachment 17269 [details]
wrong date sorting

Hi Owen,

finding problems with this one too - I am sorry. The date sorting is not right (see screenshot). I tried refreshing and it works correctly with mm-dd-yyyy, but not with dd-mm-yyyy.
Comment 7 Katrin Fischer 2013-04-09 06:46:47 UTC
Created attachment 17303 [details] [review]
[PASSED QA] 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.
Comment 8 Katrin Fischer 2013-04-09 06:48:46 UTC
I was on the wrong tab, date sorting is off on the details tab.
Comment 9 Jared Camins-Esakov 2013-04-15 13:10:41 UTC
This patch has been pushed to master and 3.12.x.