[Koha-patches] [PATCH] Bug 11711 - Use new DataTables include in circ templates

Owen Leonard oleonard at myacpl.org
Fri Feb 7 20:23:56 CET 2014


Bug 10649 introduced a new include file for adding DataTables-related
JavaScript assets. This patch adds use of this include file to all
circ-related pages which use DataTables.

Apply the patch and test the following pages to confirm that table
sorting works correctly:

- Circulation
  - The UseTablesortForCirc system preference must be enabled.
  - Check out to a patron with existing checkouts. Choose a patron who
    is a guarantor to another patron with checkouts in order to test the
    relatives' checkouts table.
  - The checkouts and relatives' checkouts tables have been modified to
    exclude articles when sorting of titles.

- Hold ratios - The title column has been configured to exclude articles
  from sorting

- Transfer to receive

- Holds queue
  - The title column has been configured to exclude articles when
    sorting
  - The date column has been modified to use the title-string filter for
    sorting. An unformatted date is now passed from C4::HoldsQueue.pm to
    the template, where the KohaDates filter is used for formatting.
    Sorting is based on the unformatted date.

- Holds awaiting pickup
  - The "available since" column has been configured for sorting on an
    unformatted date. waitingreserves.pl now passes the unformatted
    date to the template, and formatting is done using the KohaDates
    filter.
  - The title column has been configured to exclude articles when
    sorting.
---
 C4/HoldsQueue.pm                                   |    1 -
 circ/waitingreserves.pl                            |    2 +-
 .../prog/en/modules/circ/circulation.tt            |    8 +++-----
 .../prog/en/modules/circ/reserveratios.tt          |    7 +++----
 .../prog/en/modules/circ/transferstoreceive.tt     |    6 ++----
 .../prog/en/modules/circ/view_holdsqueue.tt        |   20 +++++++++-----------
 .../prog/en/modules/circ/waitingreserves.tt        |   12 +++++++-----
 7 files changed, 25 insertions(+), 31 deletions(-)

diff --git a/C4/HoldsQueue.pm b/C4/HoldsQueue.pm
index 7062cbe..453cf6b 100755
--- a/C4/HoldsQueue.pm
+++ b/C4/HoldsQueue.pm
@@ -135,7 +135,6 @@ sub GetHoldsQueueItems {
     $sth->execute(@bind_params);
     my $items = [];
     while ( my $row = $sth->fetchrow_hashref ){
-        $row->{reservedate} = format_date($row->{reservedate});
         my $record = GetMarcBiblio($row->{biblionumber});
         if ($record){
             $row->{subtitle} = GetRecordValue('subtitle',$record,'')->[0]->{subfield};
diff --git a/circ/waitingreserves.pl b/circ/waitingreserves.pl
index 1ec6b2d..fb7a3d1 100755
--- a/circ/waitingreserves.pl
+++ b/circ/waitingreserves.pl
@@ -105,7 +105,7 @@ foreach my $num (@getreserves) {
     $gettitle->{'itemtype'} = C4::Context->preference('item-level_itypes') ? $gettitle->{'itype'} : $gettitle->{'itemtype'};
     my $getborrower = GetMember(borrowernumber => $num->{'borrowernumber'});
     my $itemtypeinfo = getitemtypeinfo( $gettitle->{'itemtype'} );  # using the fixed up itype/itemtype
-    $getreserv{'waitingdate'} = format_date( $num->{'waitingdate'} );
+    $getreserv{'waitingdate'} = $num->{'waitingdate'};
     my ( $waiting_year, $waiting_month, $waiting_day ) = split (/-/, $num->{'waitingdate'});
     ( $waiting_year, $waiting_month, $waiting_day ) =
       Add_Delta_Days( $waiting_year, $waiting_month, $waiting_day,
diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt
index 5a6a82d..c5b3937 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt
@@ -14,9 +14,7 @@
 [% INCLUDE 'doc-head-close.inc' %]
 [% INCLUDE 'calendar.inc' %]
 [% IF ( UseTablesortForCirc ) %]<link rel="stylesheet" type="text/css" href="[% themelang %]/css/datatables.css" />
-<script type="text/javascript" src="[% themelang %]/lib/jquery/plugins/jquery.dataTables.min.js"></script>
-[% INCLUDE 'datatables-strings.inc' %]
-<script type="text/javascript" src="[% themelang %]/js/datatables.js"></script>[% END %]
+[% INCLUDE 'datatables.inc' %][% END %]
 <script type="text/javascript" src="[% themelang %]/lib/jquery/plugins/jquery.checkboxes.min.js"></script>
 <script type="text/javascript" src="[% themelang %]/lib/jquery/plugins/jquery-ui-timepicker-addon.js"></script>
 <script type="text/javascript" src="[% themelang %]/js/pages/circulation.js"></script>
@@ -46,7 +44,7 @@ var MSG_EXPORT_SELECT_CHECKOUTS = _("You must select checkout(s) to export");
                 { "aTargets": [ -1, -2[% IF ( exports_enabled ) %], -3[% END %] ], "bSortable": false, "bSearchable": false }
             ],
             "aoColumns": [
-                { "sType": "title-string" },{ "sType": "html" },null,{ "sType": "title-string" },null,null,null,null,null,null[% IF ( exports_enabled ) %],null[% END %]
+                { "sType": "title-string" },{ "sType": "anti-the" },null,{ "sType": "title-string" },null,null,null,null,null,null[% IF ( exports_enabled ) %],null[% END %]
             ],
             "bPaginate": false
         }));
@@ -55,7 +53,7 @@ var MSG_EXPORT_SELECT_CHECKOUTS = _("You must select checkout(s) to export");
             "sDom": 't',
             "aaSorting": [],
             "aoColumns": [
-                { "sType": "title-string" },{ "sType": "html" },null,{ "sType": "title-string" },null,null,null,null,{ "sType": "html" }
+                { "sType": "title-string" },{ "sType": "anti-the" },null,{ "sType": "title-string" },null,null,null,null,{ "sType": "html" }
             ],
             "bPaginate": false
         }));
diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/reserveratios.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/reserveratios.tt
index d55382e..1742e30 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/reserveratios.tt
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/reserveratios.tt
@@ -3,9 +3,7 @@
 [% INCLUDE 'doc-head-close.inc' %]
 [% INCLUDE 'calendar.inc' %]
 <link rel="stylesheet" type="text/css" href="[% themelang %]/css/datatables.css" />
-<script type="text/javascript" src="[% themelang %]/lib/jquery/plugins/jquery.dataTables.min.js"></script>
-[% INCLUDE 'datatables-strings.inc' %]
-<script type="text/javascript" src="[% themelang %]/js/datatables.js"></script>
+[% INCLUDE 'datatables.inc' %]
 <script type="text/javascript">
 //<![CDATA[
      $(document).ready(function() {
@@ -18,7 +16,8 @@
         );
         $("#holdst").dataTable($.extend(true, {}, dataTablesDefaults, {
             "aoColumnDefs": [
-                { "aTargets": [ 8 ], "sType": "natural" }
+                { "aTargets": [ 8 ], "sType": "natural" },
+                { "aTargets": [ 3 ], "sType": "anti-the" }
             ],
             "aLengthMenu": [[10, 20, 50, 100, -1], [10, 20, 50, 100, "All"]],
             "iDisplayLength": 20,
diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/transferstoreceive.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/transferstoreceive.tt
index d0286ca..d3cc93b 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/transferstoreceive.tt
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/transferstoreceive.tt
@@ -2,10 +2,8 @@
 [% INCLUDE 'doc-head-open.inc' %]
 <title>Koha › Circulation › Transfers to your library</title>
 [% INCLUDE 'doc-head-close.inc' %]
-<link rel="stylesheet" type="text/css" href="[% interface %]/[% theme %]/en/css/datatables.css" />
-<script type="text/javascript" src="[% interface %]/[% theme %]/en/lib/jquery/plugins/jquery.dataTables.min.js"></script>
-[% INCLUDE 'datatables-strings.inc' %]
-<script type="text/javascript" src="[% interface %]/[% theme %]/en/js/datatables.js"></script>
+<link rel="stylesheet" type="text/css" href="[% themelang %]/css/datatables.css" />
+[% INCLUDE 'datatables.inc' %]
 <script type="text/javascript">
 //<![CDATA[
 [% IF (dateformat == 'metric') %]
diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/view_holdsqueue.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/view_holdsqueue.tt
index f42bb47..cc2a694 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/view_holdsqueue.tt
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/view_holdsqueue.tt
@@ -1,3 +1,4 @@
+[% USE KohaDates %]
 [% USE ItemTypes %]
 [% USE AuthorisedValues %]
 [% INCLUDE 'doc-head-open.inc' %]
@@ -8,20 +9,17 @@
 <body id="circ_view_holdsqueue" class="circ">
 [% INCLUDE 'header.inc' %]
 [% INCLUDE 'cat-search.inc' %]
-<link rel="stylesheet" type="text/css" href="[% interface %]/[% theme %]/en/css/datatables.css" />
-<script type="text/javascript" src="[% interface %]/[% theme %]/en/lib/jquery/plugins/jquery.dataTables.min.js"></script>
-[% INCLUDE 'datatables-strings.inc' %]
-<script type="text/javascript" src="[% interface %]/[% theme %]/en/js/datatables.js"></script>
+<link rel="stylesheet" type="text/css" href="[% themelang %]/css/datatables.css" />
+[% INCLUDE 'datatables.inc' %]
 <script type="text/javascript">//<![CDATA[
 $(document).ready(function() {
     $("#holdst").dataTable({
         "aaSorting": [[ 3, "asc" ]],
-        "bPaginate": false,
-        "bLengthChange": false,
-        "bFilter": false,
-        "bSort": true,
-        "bInfo": false,
-        "bAutoWidth": false
+        "aoColumns": [
+            { "sType": "anti-the" },null,null,null,null,null,null,null,null,{ "sType": "title-string" },null
+        ],
+        "sDom": 't',
+        "bPaginate": false
     });
 });
 //]]>
@@ -91,7 +89,7 @@ $(document).ready(function() {
             </td>
 			<td class="hq-patron"><p><a href="/cgi-bin/koha/circ/circulation.pl?findborrower=[% itemsloo.cardnumber %]#reserves">[% itemsloo.surname %], [% itemsloo.firstname %] ([% itemsloo.cardnumber %])</a></p> <p>[% itemsloo.phone %]</p></td>
             <td class="hq-sendto">[% itemsloo.pickbranch %]</td>
-            <td class="hq-date">[% itemsloo.reservedate %]</td>
+            <td class="hq-date"><span title="[% itemsloo.reservedate %]">[% itemsloo.reservedate | $KohaDates %]</span></td>
             <td class="hq-notes">[% itemsloo.notes %]</td>
         </tr>
     [% END %]</tbody>
diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/waitingreserves.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/waitingreserves.tt
index 10c6b8c..f9df7b3 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/waitingreserves.tt
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/waitingreserves.tt
@@ -1,10 +1,9 @@
+[% USE KohaDates %]
 [% INCLUDE 'doc-head-open.inc' %]
 <title>Koha › Circulation › Holds awaiting pickup</title>
 [% INCLUDE 'doc-head-close.inc' %]
-<link rel="stylesheet" type="text/css" href="[% interface %]/[% theme %]/en/css/datatables.css" />
-<script type="text/javascript" src="[% interface %]/[% theme %]/en/lib/jquery/plugins/jquery.dataTables.min.js"></script>
-[% INCLUDE 'datatables-strings.inc' %]
-<script type="text/javascript" src="[% interface %]/[% theme %]/en/js/datatables.js"></script>
+<link rel="stylesheet" type="text/css" href="[% themelang %]/css/datatables.css" />
+[% INCLUDE 'datatables.inc' %]
 <script type="text/javascript">
 //<![CDATA[
 [% IF (dateformat == 'metric') %]
@@ -17,6 +16,9 @@ dt_add_type_uk_date();
             "aoColumnDefs": [
                 { "aTargets": [ -1 ], "bSortable": false, "bSearchable": false },
             ],
+            "aoColumns": [
+                { "sType": "title-string" },{ "sType": "anti-the" },null,null,null,null,null
+            ],
             "aLengthMenu": [[10, 20, 50, 100, -1], [10, 20, 50, 100, "All"]],
             "iDisplayLength": 20,
             "sPaginationType": "four_button"
@@ -151,7 +153,7 @@ dt_add_type_uk_date();
                </tr></thead>
                <tbody>[% FOREACH overloo IN overloop %]
                     <tr>
-                        <td><p>[% overloo.waitingdate %]</p></td>
+                        <td><p><span title="[% overloo.waitingdate %]">[% overloo.waitingdate | $KohaDates %]</span></p></td>
                         <td>[% INCLUDE 'biblio-default-view.inc' biblionumber = overloo.biblionumber %][% overloo.title |html %] [% overloo.subtitle |html %]
                         </a>
                             [% UNLESS ( item_level_itypes ) %][% IF ( overloo.itemtype ) %]  (<b>[% overloo.itemtype %]</b>)[% END %][% END %]
-- 
1.7.9.5


More information about the Koha-patches mailing list