From 46413dcf4e63605cf424e278a39d5792ab8159a8 Mon Sep 17 00:00:00 2001 From: Kyle M Hall Date: Mon, 22 Jul 2013 07:43:13 -0400 Subject: [PATCH] Bug 9456 - Add callnumber column to the cart - QA Followup 2 - Sort on callnumber only --- koha-tmpl/intranet-tmpl/prog/en/js/datatables.js | 24 ++++++++++++++++++++ .../intranet-tmpl/prog/en/modules/basket/basket.tt | 2 +- 2 files changed, 25 insertions(+), 1 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/en/js/datatables.js b/koha-tmpl/intranet-tmpl/prog/en/js/datatables.js index 0ff05c4..fae0c17 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/js/datatables.js +++ b/koha-tmpl/intranet-tmpl/prog/en/js/datatables.js @@ -548,6 +548,13 @@ jQuery.fn.dataTableExt.oSort['callnumbers-asc'] = function(x,y) { x_array.shift(); y_array.shift(); + x_array = jQuery.map( x_array, function( a ) { + return parse_callnumber( a ); + }); + y_array = jQuery.map( y_array, function( a ) { + return parse_callnumber( a ); + }); + x_array.sort(); y_array.sort(); @@ -565,6 +572,13 @@ jQuery.fn.dataTableExt.oSort['callnumbers-desc'] = function(x,y) { x_array.shift(); y_array.shift(); + x_array = jQuery.map( x_array, function( a ) { + return parse_callnumber( a ); + }); + y_array = jQuery.map( y_array, function( a ) { + return parse_callnumber( a ); + }); + x_array.sort(); y_array.sort(); @@ -573,3 +587,13 @@ jQuery.fn.dataTableExt.oSort['callnumbers-desc'] = function(x,y) { return ((x < y) ? 1 : ((x > y) ? -1 : 0)); }; + +function parse_callnumber ( html ) { + var array = html.split(''); + if ( array[1] ) { + array = array[1].split(''); + } else { + return ""; + } + return array[0]; +} 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 f128711..a31a67a 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/basket/basket.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/basket/basket.tt @@ -326,7 +326,7 @@ function placeHold () { [% IF ( BIBLIO_RESULT.ITEM_RESULTS ) %] [% FOREACH ITEM_RESULT IN BIBLIO_RESULT.ITEM_RESULTS %] -
[% ITEM_RESULT.itemcallnumber %] [% ITEM_RESULT.branchname %] [% ITEM_RESULT.location_description %]
+
[% ITEM_RESULT.itemcallnumber %] [% ITEM_RESULT.branchname %] [% ITEM_RESULT.location_description %]
[% END %] [% ELSE %] This record has no items. -- 1.7.2.5