Bug 15832 - Fix filter and items split-up in pendingreserves.tt

Test plan:

- Go to circ/pendingreserves.pl (Ensure that there are biblios with many
  items on different branches),
- Check the libraries filter at the bottom of datatable. There should be
  duplicates.
- Apply this patch and return to circ/pendingreserves.pl,
- check that libraries filter should not contain duplicate,
- check that the filter works.

Signed-off-by: Owen Leonard <oleonard@myacpl.org>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>

Signed-off-by: Brendan Gallagher <bredan@bywatersolutions.com>
This commit is contained in:
Alex Arnaud 2016-02-16 16:33:17 +01:00 committed by Brendan Gallagher
parent 88e8f60ebc
commit 82be93af1c

View file

@ -28,9 +28,10 @@ $(document).ready(function() {
for ( j=0 ; j<cD.length ; j++ ) { for ( j=0 ; j<cD.length ; j++ ) {
var split_array = cD[j].split(/<br>/gi); var split_array = cD[j].split(/<br>/gi);
for ( k=0 ; k<split_array.length ; k++ ){ for ( k=0 ; k<split_array.length ; k++ ){
var check_array = $.inArray(split_array[k], new_array); var str = $.trim(split_array[k].replace(/[\n\r]/g, ''));
var check_array = $.inArray(str, new_array);
if (check_array == -1) { if (check_array == -1) {
new_array.push(split_array[k]); new_array.push(str);
} }
} }
} }
@ -50,9 +51,6 @@ $(document).ready(function() {
$(this).html( createSelect( holdst.fnGetColumnData(4) ) ); $(this).html( createSelect( holdst.fnGetColumnData(4) ) );
$('select', this).change( function () { $('select', this).change( function () {
var filter_value = $(this).val(); var filter_value = $(this).val();
if(filter_value){
filter_value = "(^|>)"+filter_value+"($|<)";
}
holdst.fnFilter( filter_value, 4, true ); holdst.fnFilter( filter_value, 4, true );
} ); } );
} ); } );