Bug 27975: Replace obsolete title-string sorting: Administration templates
authorOwen Leonard <oleonard@myacpl.org>
Wed, 17 Mar 2021 18:27:16 +0000 (18:27 +0000)
committerJonathan Druart <jonathan.druart@bugs.koha-community.org>
Tue, 6 Apr 2021 13:56:30 +0000 (15:56 +0200)
This patch modifies two administration 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:

- Administration -> Currencies and exchange rates
- Administration -> Budgets
  - Both the "Active budgets" and "Inactive budgets" tabs

Signed-off-by: Amit Gupta <amit.gupta@informaticsglobal.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
koha-tmpl/intranet-tmpl/prog/en/modules/admin/aqbudgetperiods.tt
koha-tmpl/intranet-tmpl/prog/en/modules/admin/currency.tt

index 1306d1a..753b2a3 100644 (file)
           <thead>
             <tr>
               <th>Budget name</th>
-              <th class="title-string">Start date</th>
-              <th class="title-string">End date</th>
+              <th>Start date</th>
+              <th>End date</th>
               <th>Locked</th>
               <th>Total</th>
               <th class="noExport">Actions</th>
               [% FOREACH period_active IN period_active_loop %]
                 <tr>
                 <td><a href="/cgi-bin/koha/admin/aqbudgets.pl?budget_period_id=[% period_active.budget_period_id | uri %]" title="View funds for [% period_active.budget_period_description | html %]">[% period_active.budget_period_description | html %]</a></td>
-                <td><span title="[% period_active.budget_period_startdate | html %]">[% period_active.budget_period_startdate | $KohaDates %]</span></td>
-                <td><span title="[% period_active.budget_period_enddate | html %]">[% period_active.budget_period_enddate | $KohaDates %]</span></td>
+                <td data-order="[% period_active.budget_period_startdate | html %]">[% period_active.budget_period_startdate | $KohaDates %]</td>
+                <td data-order="[% period_active.budget_period_enddate | html %]">[% period_active.budget_period_enddate | $KohaDates %]</td>
                 <td>
                   [% IF ( period_active.budget_period_locked ) %]
                     <i class="fa fa-lock"></i> Locked</span>
           <thead>
               <tr>
                   <th>Budget name</th>
-                  <th class="title-string">Start date</th>
-                  <th class="title-string">End date</th>
+                  <th>Start date</th>
+                  <th>End date</th>
                   <th>Locked</th>
                   <th>Total</th>
                   <th class="noExport">Actions</th>
               [% FOREACH period_loo IN period_inactive_loop %]
                   <tr>
                   <td><a href="/cgi-bin/koha/admin/aqbudgets.pl?budget_period_id=[% period_loo.budget_period_id | uri %]" title="View funds for [% period_loo.budget_period_description | html %]">[% period_loo.budget_period_description | html %]</a></td>
-                  <td><span title="[% period_loo.budget_period_startdate | html %]">[% period_loo.budget_period_startdate | $KohaDates %]</span></td>
-                  <td><span title="[% period_loo.budget_period_enddate | html %]">[% period_loo.budget_period_enddate | $KohaDates %]</span></td>
+                  <td data-order="[% period_loo.budget_period_startdate | html %]">[% period_loo.budget_period_startdate | $KohaDates %]</td>
+                  <td data-order="[% period_loo.budget_period_enddate | html %]">[% period_loo.budget_period_enddate | $KohaDates %]</td>
                   <td>[% IF ( period_loo.budget_period_locked ) %]<i class="fa fa-lock"></i> Locked[% END %]</td>
                   <td class="data">[% period_loo.budget_period_total | $Price %]</td>
                   <td>
             $("#activeperiodst,#inactiveperiodst").dataTable($.extend(true, {}, dataTablesDefaults, {
                 "aoColumnDefs": [
                     { "aTargets": [ -1 ], "bSortable": false, "bSearchable": false },
-                    { "sType": "title-string", "aTargets" : [ "title-string" ] }
                 ],
                 "sPaginationType": "full",
                 'bAutoWidth': false
index 6fdb607..c257ff9 100644 (file)
             <th>Rate</th>
             <th>Symbol</th>
             <th>ISO code</th>
-            <th class="title-string">Last updated</th>
+            <th>Last updated</th>
             <th>Active</th>
             <th>Archived</th>
             <th class="NoSort noExport">Actions</th>
             <td>[% currency.rate | html %]</td>
             <td>[% currency.symbol | html %]</td>
             <td>[% currency.isocode | html %]</td>
-            <td><span title="[% currency.timestamp | html %]">[% currency.timestamp | $KohaDates %]</span></td>
+            <td data-order="[% currency.timestamp | html %]">[% currency.timestamp | $KohaDates %]</td>
             <td style="color:green;">[% IF currency.active %]✓[% END %]</td>
             <td>[% IF currency.archived %]Yes[% END %]</td>
             <td class="actions">