From 681552470d4ccfbf3c42695593c30ac0e7cb9fbb Mon Sep 17 00:00:00 2001 From: Owen Leonard <oleonard@myacpl.org> Date: Thu, 18 Mar 2021 15:38:14 +0000 Subject: [PATCH] Bug 27983: Replace obsolete title-string sorting: Acquisitions templates part 2 This patch modifies several acquisitions templates to replace the use of the "title-string" DataTables sorting method with the newer "data-order" attribute. To test, apply the patch and view the following pages to confirm that columns containing dates sort correctly when using any setting of the "dateformat" system preference: - Acquisitions -> Late orders - Acquisitions -> Vendor -> Basket -> Add to basket -> From a subscription - Acquisitions -> "All available funds" table -> Click an "Ordered" value -> Click a "Spent" value - Acquisitions -> Vendor -> Receive shipments - Acquisitions -> Vendor -> test sorting of contracts in the "Contracts" table Signed-off-by: Amit Gupta <amit.gupta@informaticsglobal.com> --- .../prog/en/modules/acqui/lateorders.tt | 22 ++++++++++------------ .../prog/en/modules/acqui/newordersubscription.tt | 13 ++++--------- .../intranet-tmpl/prog/en/modules/acqui/ordered.tt | 6 +++--- .../intranet-tmpl/prog/en/modules/acqui/parcels.tt | 11 ++++------- .../intranet-tmpl/prog/en/modules/acqui/spent.tt | 12 ++++++------ .../prog/en/modules/acqui/supplier.tt | 8 ++++---- 6 files changed, 31 insertions(+), 41 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/lateorders.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/lateorders.tt index 58955f8..539c7ae 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/lateorders.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/lateorders.tt @@ -59,8 +59,8 @@ <tr> <th class="NoSort"></th> <th>Order line</th> - <th class="title-string">Order date</th> - <th class="title-string">Estimated delivery date</th> + <th>Order date</th> + <th>Estimated delivery date</th> <th>Vendor</th> <th class="anti-the">Information</th> <th>Quantity</th> @@ -71,7 +71,7 @@ <th>Budget</th> <th>Fund</th> <th>Claims count</th> - <th class="title-string">Claimed date</th> + <th>Claimed date</th> <th>Internal note</th> <th>Vendor note</th> <th>ISBN</th> @@ -86,14 +86,12 @@ <td> [% lateorder.ordernumber | $raw %] </td> - <td> - <span title="[% lateorder.basket.closedate | html %]">[% lateorder.basket.closedate | $KohaDates %] ([% lateorder.basket.late_since_days | html %] days)</span> + <td data-order="[% lateorder.basket.closedate | html %]"> + [% lateorder.basket.closedate | $KohaDates %] ([% lateorder.basket.late_since_days | html %] days) </td> - <td> - [% SET estimated_delivery_date = lateorder.get_column('estimated_delivery_date') %] - [% IF estimated_delivery_date %] - <span title="[% estimated_delivery_date | html %]">[% estimated_delivery_date | $KohaDates %]</span> - [% END %] + [% SET estimated_delivery_date = lateorder.get_column('estimated_delivery_date') %] + <td data-order="[% estimated_delivery_date | html %]"> + [% estimated_delivery_date | $KohaDates %] </td> <td> [% lateorder.basket.bookseller.name | html %] @@ -139,9 +137,9 @@ <td>[% lateorder.fund.budget.budget_period_description | html %]</td> <td>[% lateorder.fund.budget_name | html %]</td> <td>[% lateorder.claims.count | html %]</td> - <td> + <td data-order="[% lateorder.claims.last.claimed_on | html %]"> [% FOR claim IN lateorder.claims %] - <span title="[% lateorder.claims.last.claimed_on | html %]">[% claim.claimed_on | $KohaDates %]</span> + [% claim.claimed_on | $KohaDates %] [% UNLESS loop.last %]<br/>[% END %] [% END %] </td> diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/newordersubscription.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/newordersubscription.tt index dba4e4d..a0f120a 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/newordersubscription.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/newordersubscription.tt @@ -37,7 +37,7 @@ <th>Vendor</th> <th>Library</th> <th>Call number</th> - <th class="title-string">Expiration date</th> + <th>Expiration date</th> <th class="NoSort"></th> </tr> </thead> @@ -61,12 +61,8 @@ <td> [% IF (sub.callnumber) %][% sub.callnumber | html %][% END %] </td> - <td> - [% IF (sub.enddate) %] - <span title="[% sub.enddate | html %]">[% sub.enddate | $KohaDates %]</span> - [% ELSE %] - <span title="0000-00-00"></span> - [% END %] + <td data-order="[% sub.enddate | html %]"> + [% sub.enddate | $KohaDates %] </td> <td class="actions"> [% IF (sub.alreadyOnOrder) %] @@ -118,8 +114,7 @@ $("#srlt").dataTable($.extend(true, {}, dataTablesDefaults, { "aoColumnDefs": [ { "bSortable": false, "bSearchable": false, 'aTargets': [ 'NoSort' ] }, - { "sType": "anti-the", "aTargets" : [ "anti-the" ] }, - { "sType": "title-string", "aTargets" : [ "title-string" ] } + { "sType": "anti-the", "aTargets" : [ "anti-the" ] } ], "sPaginationType": "full" })); diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/ordered.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/ordered.tt index 1637752..ec75acd 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/ordered.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/ordered.tt @@ -33,7 +33,7 @@ <th> Item types </th> <th> Left on order </th> <th> Estimated cost per unit </th> - <th class="title-string"> Date ordered </th> + <th> Date ordered </th> <th> Subtotal </th> </tr> </thead> @@ -67,8 +67,8 @@ <td class="data cell"> [% order.ecost_tax_included | $Price %] </td> - <td class="cell"> - <span title="[% order.entrydate | html %]">[% order.entrydate | $KohaDates %]</span> + <td class="cell" data-order="[% order.entrydate | html %]"> + [% order.entrydate | $KohaDates %] </td> <td class="data cell"> [% order.subtotal | $Price %] diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/parcels.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/parcels.tt index 3ee304e..ef9aba4 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/parcels.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/parcels.tt @@ -66,7 +66,7 @@ <thead> <tr> <th>Line</th> - <th class="title-string">Date received</th> + <th>Date received</th> <th>Invoice number</th> <th>Item count</th> <th>Biblio count</th> @@ -80,8 +80,8 @@ <td> [% searchresult.number | html %] </td> - <td> - <span title="[% searchresult.datereceived | html %]">[% searchresult.datereceived | $KohaDates %]</span> + <td data-order="[% searchresult.datereceived | html %]"> + [% searchresult.datereceived | $KohaDates %] </td> <td> [% IF ( searchresult.code ) %] @@ -216,10 +216,7 @@ <script> $(document).ready(function() { var parcelst = $("#parcelst").dataTable($.extend(true, {}, dataTablesDefaults, { - "aoColumnDefs": [ - { "sType": "title-string", "aTargets" : [ "title-string" ] } - ], - 'bPaginate': false, + 'bPaginate': false })); //keep a copy of all budgets before removing the inactives diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/spent.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/spent.tt index 23661da..48b0029 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/spent.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/spent.tt @@ -34,8 +34,8 @@ <th>Item types</th> <th>Received</th> <th>Unit price</th> - <th class="title-string">Date ordered</th> - <th class="title-string">Date received</th> + <th>Date ordered</th> + <th>Date received</th> <th>Subtotal</th> </tr> </thead> @@ -68,11 +68,11 @@ <td class="cell"> [% order.unitprice_tax_included | $Price %] </td> - <td class="cell"> - <span title="[% order.entrydate | html %]">[% order.entrydate | $KohaDates %]</span> + <td class="cell" data-order="[% order.entrydate | html %]"> + [% order.entrydate | $KohaDates %] </td> - <td class="cell"> - <span title="[% order.datereceived | html %]">[% order.datereceived | $KohaDates %]</span> + <td class="cell" data-order="[% order.datereceived | html %]"> + [% order.datereceived | $KohaDates %] </td> <td class="data cell"> [% order.rowtotal | $Price %] diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/supplier.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/supplier.tt index 1a2bf9d..cb67dc7 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/supplier.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/supplier.tt @@ -355,8 +355,8 @@ <tr> <th scope="col">Name</th> <th scope="col">Description</th> - <th scope="col" class="title-string">Start date</th> - <th scope="col" class="title-string">End date</th> + <th scope="col">Start date</th> + <th scope="col">End date</th> [% IF CAN_user_acquisition_contracts_manage %] <th scope="col" class="NoSort noExport">Actions</th> [% END %] @@ -369,8 +369,8 @@ <a href="/cgi-bin/koha/admin/aqcontract.pl?op=add_form&contractnumber=[% contract.contractnumber | uri %]&booksellerid=[% contract.booksellerid | uri %]">[% contract.contractname | html %]</a> </td> <td>[% contract.contractdescription | html %]</td> - <td><span title="[% contract.contractstartdate | html %]">[% contract.contractstartdate | $KohaDates %]</span></td> - <td><span title="[% contract.contractenddate | html %]">[% contract.contractenddate | $KohaDates %]</span></td> + <td data-order="[% contract.contractstartdate | html %]">[% contract.contractstartdate | $KohaDates %]</td> + <td data-order="[% contract.contractenddate | html %]">[% contract.contractenddate | $KohaDates %]</td> [% IF CAN_user_acquisition_contracts_manage %] <td class="actions"> <a class="btn btn-default btn-xs" href="/cgi-bin/koha/admin/aqcontract.pl?op=add_form&contractnumber=[% contract.contractnumber | html %]&booksellerid=[% contract.booksellerid | html %]"><i class="fa fa-pencil"></i> Edit</a> -- 2.7.4