[Koha-patches] [PATCH] Bug 9456 [Alternate] Add callnumber column to the cart

Owen Leonard oleonard at myacpl.org
Fri Jan 25 16:18:04 CET 2013


This patch adds call-number sorting to the staff client  cart on a
title-by-title basis. Item information (library, shelving location, and
call number) is moved to a table nested in each row. Location and call
number columns in this table are sortable.

The patch converts table sorting to DataTables (in a race with Bug
9449). The patch does not attempt to make the larger table of titles
sortable by call number.

To test, add multiple titles to the staff client cart which have
multiple items each. The table of titles should still be sortable by
title and item type. The table of items in each row should be sortable
by location and call number.
---
 .../intranet-tmpl/prog/en/modules/basket/basket.tt |   81 +++++++++++++++-----
 1 file changed, 63 insertions(+), 18 deletions(-)

diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/basket/basket.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/basket/basket.tt
index 9989194..85bfa20 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/basket/basket.tt
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/basket/basket.tt
@@ -9,9 +9,35 @@
     @import url([% themelang %]/css/print.css);
 </style>
     [% ELSE %][% INCLUDE 'doc-head-close.inc' %]
+    <style type="text/css">
+        td table {
+            font-size: 85%;
+            border: 0;
+        }
+        td table th:first-child,
+        td table th.sorting:first-child,
+        td table th.sorting_asc:first-child,
+        td table th.sorting_desc:first-child {
+            border-right : 1px solid #99BEC9;
+        }
+        td table th,
+        td table th.sorting,
+        td table th.sorting_asc,
+        td table th.sorting_desc {
+            background-color: #E6F0F2;
+            border-color: #99BEC9;
+            border-width: 0px 0px 1px 0px;
+        }
+        td table td {
+            border-width: 0px 0px 1px 0px;
+            border-color: #B8D7E0;
+        }
+    </style>
 	<script type="text/javascript" src="[% themelang %]/lib/jquery/plugins/jquery.checkboxes.min.js"></script>
-	<script type="text/javascript" src="[% themelang %]/lib/jquery/plugins/jquery.tablesorter.min.js"></script>
-	<script type="text/javascript">
+<link rel="stylesheet" type="text/css" href="/intranet-tmpl/prog/en/css/datatables.css" />
+<script type="text/javascript" src="/intranet-tmpl/prog/en/lib/jquery/plugins/jquery.dataTables.min.js"></script>
+[% INCLUDE 'datatables-strings.inc' %]
+<script type="text/javascript" src="/intranet-tmpl/prog/en/js/datatables.js"></script>	<script type="text/javascript">
 	//<![CDATA[
 
 function placeHold () {
@@ -65,9 +91,19 @@ function placeHold () {
         $(".hold").text(_("Place Hold"));
         $("#downloadcartc").empty();
         yuiToolbar();
-        $("#itemst").tablesorter({
-            headers: { 0: { sorter: false }}
-        });
+        $("#itemst").dataTable($.extend(true, {}, dataTablesDefaults, {
+            "sDom": 't',
+            "aoColumnDefs": [
+                { "aTargets": [ 0,3 ], "bSortable": false, "bSearchable": false },
+            ],
+            "aaSorting": [[ 1, "asc" ]],
+            "bPaginate": false
+        }));
+        $(".itemstable").dataTable($.extend(true, {}, dataTablesDefaults, {
+            "sDom": 't',
+            "bPaginate": false
+        }));
+
 	});
 
 function yuiToolbar() {
@@ -321,15 +357,11 @@ function yuiToolbar() {
 	    [% UNLESS ( print_basket ) %]<th> </th>[% END %]
 	    <th>Title</th>
         <th>Item type</th>
-	    <th>Location</th>
+        <th>Items</th>
         </tr></thead>
 
         [% FOREACH BIBLIO_RESULT IN BIBLIO_RESULTS %]
-            [% IF ( BIBLIO_RESULT.even ) %]
-                <tr class="highlight">
-            [% ELSE %]
                 <tr>
-            [% END %]
             [% UNLESS ( print_basket ) %]<td>
                         <input type="checkbox" value="[% BIBLIO_RESULT.biblionumber %]" name="bib[% BIBLIO_RESULT.biblionumber %]" id="bib[% BIBLIO_RESULT.biblionumber %]" onclick="selRecord(value,checked);" />
 
@@ -351,14 +383,27 @@ function yuiToolbar() {
 
 						</td>
             <td>[% BIBLIO_RESULT.description %]</td>
-                <td>[% IF ( BIBLIO_RESULT.ITEM_RESULTS ) %][% FOREACH ITEM_RESULT IN BIBLIO_RESULT.ITEM_RESULTS %]
-                    <p>
-                        [% ITEM_RESULT.branchname %] [% ITEM_RESULT.location_description %]
-                        [% IF ( ITEM_RESULT.itemcallnumber ) %]
-                            ([% ITEM_RESULT.itemcallnumber %])
-                        [% END %]
-                    </p>
-                    [% END %][% ELSE %]This record has no items.[% END %]</td>
+            <td>[% IF ( BIBLIO_RESULT.ITEM_RESULTS ) %]
+                <table class="itemstable">
+                <thead>
+                    <th>Location</th>
+                    <th>Call number</th>
+                </thead>
+                <tbody>
+                    [% FOREACH ITEM_RESULT IN BIBLIO_RESULT.ITEM_RESULTS %]
+                        <tr>
+                            <td>[% ITEM_RESULT.branchname %] <span class="shelvingloc">[% ITEM_RESULT.location_description %]</span></td>
+                            <td>
+                                [% IF ( ITEM_RESULT.itemcallnumber ) %]
+                                    ([% ITEM_RESULT.itemcallnumber %])
+                                [% END %]
+                            </td>
+                        </tr>
+                    [% END %]
+                </tbody>
+                </table>
+                [% ELSE %]This record has no items.[% END %]
+            </td>
             </tr>
         [% END %]
     </table></form>
-- 
1.7.9.5


More information about the Koha-patches mailing list