From e279cd0d3ac42ce054b3390003b9f0e8334f127d Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Mon, 22 Oct 2018 16:51:25 -0300 Subject: [PATCH] Bug 21562: Fix sort by checkout date in the circulation table The sort is done in SQL but resort by DataTables when displaying the results. iDataSort should be used to mimick date_due sort behavior. Test plan: - Check some items out - Modify the checkout and due dates, like: 2018-10-22 2018-01-23 2018-05-27 - Sort by checkout date, then due date. The sort should be correct for all values of the DateFormat syspref Followed test plan, patch works as described and passes QA test tool Signed-off-by: Alex Buckley Signed-off-by: Katrin Fischer Signed-off-by: Nick Clemens (cherry picked from commit f32ee27deb7abe531ad5e5db5242f7243e3baa8d) Signed-off-by: Martin Renvoize --- koha-tmpl/intranet-tmpl/prog/js/checkouts.js | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/js/checkouts.js b/koha-tmpl/intranet-tmpl/prog/js/checkouts.js index d6cd4b8fb4..17e0e4885a 100644 --- a/koha-tmpl/intranet-tmpl/prog/js/checkouts.js +++ b/koha-tmpl/intranet-tmpl/prog/js/checkouts.js @@ -293,7 +293,14 @@ $(document).ready(function() { { "mDataProp": "itemtype_description" }, { "mDataProp": "location" }, { "mDataProp": "homebranch" }, - { "mDataProp": "issuedate_formatted" }, + { + "mDataProp": "issuedate", + "bVisible": false, + }, + { + "iDataSort": 9, // Sort on hidden unformatted issuedate column + "mDataProp": "issuedate_formatted" + }, { "mDataProp": "branchname" }, { "mDataProp": "itemcallnumber" }, { @@ -537,7 +544,7 @@ $(document).ready(function() { "bVisible": false, }, { - "iDataSort": 1, // Sort on hidden unformatted date due column + "iDataSort": 0, // Sort on hidden unformatted date due column "mDataProp": function( oObj ) { var today = new Date(); var due = new Date( oObj.date_due ); @@ -608,7 +615,14 @@ $(document).ready(function() { }, { "mDataProp": "itemtype" }, { "mDataProp": "location" }, - { "mDataProp": "issuedate_formatted" }, + { + "mDataProp": "issuedate", + "bVisible": false, + }, + { + "iDataSort": 7, // Sort on hidden unformatted issuedate column + "mDataProp": "issuedate_formatted", + }, { "mDataProp": "branchname" }, { "mDataProp": "itemcallnumber" }, { -- 2.39.5