From 51cb718b32783112c4b8958931936ed3cf02df3d Mon Sep 17 00:00:00 2001 From: Owen Leonard Date: Mon, 3 Feb 2025 13:40:15 +0000 Subject: [PATCH] Bug 39015: Fix sorting by date on cash register statistics page This patch adds a "data-sort" attribute to the columns in the results table which contain dates. This allows DataTables to sort using the unformatted date. The patch also adds the "anti-the" class to the column containing titles, ensuring that the sort excludes articles. To test, apply the patch and go to Reports -> Statistics wizards -> Cash register. You must have multiple entries in the results, which could be generated by using the "Create manual invoice" form under a patron's account tab. Unfortunately that won't create entries with multiple dates to sort on. I assume a proper test will require some manual SQL updates. To test title sorting you should have some transactions which are tied to an item. To generate this data: - Set the 'WhenLostChargeReplacementFee' system preference to "Charge" - Add a replacement cost to some items in the catalog. - Check those items out ot a patron. - From the "Item details" tab for those records, mark each item lost. - The charges should now be on the patron's account. - On the Cash register statistics page, submit the form using parameters which will return multiple results. - Test that the "Transaction date" and "Updated" columns work correctly with various settings of the "dateformat" system preference. - Test that the "Bibliographic record title" column sorts correctly, excluding initial articles (a, an, the) from the sort. Sponsored-by: Athens County Public Libraries --- .../prog/en/modules/reports/cash_register_stats.tt | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/reports/cash_register_stats.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/reports/cash_register_stats.tt index f0437f91edf..06974e9a6c4 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/reports/cash_register_stats.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/reports/cash_register_stats.tt @@ -168,7 +168,7 @@ Transaction type Notes Amount - Bibliographic record title + Bibliographic record title Barcode Item type @@ -179,8 +179,8 @@ [% loopresul.cardnumber | html %] [% loopresul.bfirstname | html %] [% loopresul.bsurname | html %] [% loopresul.branchname | html %] - [% loopresul.date | $KohaDates %] - [% loopresul.timestamp | $KohaDates with_hours = 1 %] + [% loopresul.date | $KohaDates %] + [% loopresul.timestamp | $KohaDates with_hours = 1 %] [% loopresul.type_description | html %] [% loopresul.note | html %] [% loopresul.amount | $Price %] @@ -221,7 +221,10 @@ $(document).ready(function() { $("#tbl_cash_register_stats").dataTable($.extend(true, {}, dataTablesDefaults, { "pageLength": 50, - "pagingType": "full_numbers" + "pagingType": "full_numbers", + "columnDefs": [ + { "type": "anti-the", "targets": [ "anti-the" ] } + ] })); $("#branch").on("change", function() { -- 2.39.5