Bug 15832 - Fix filter and items split-up in pendingreserves.tt
authorAlex Arnaud <alex.arnaud@biblibre.com>
Tue, 16 Feb 2016 15:33:17 +0000 (16:33 +0100)
committerFrédéric Demians <f.demians@tamil.fr>
Wed, 27 Apr 2016 15:00:18 +0000 (17:00 +0200)
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>
(cherry picked from commit 82be93af1ccbd3544646a6345ab51183a62d05cb)
Signed-off-by: Julian Maurice <julian.maurice@biblibre.com>
(cherry picked from commit 4f699275a76107f3a210a199dc9cadd5da2560f3)
Signed-off-by: Frédéric Demians <f.demians@tamil.fr>

koha-tmpl/intranet-tmpl/prog/en/modules/circ/pendingreserves.tt

index 8db3011..901961b 100644 (file)
@@ -28,9 +28,10 @@ $(document).ready(function() {
     for ( j=0 ; j<cD.length ; j++ ) {
         var split_array = cD[j].split(/<br>/gi);
         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) {
-                new_array.push(split_array[k]);
+                new_array.push(str);
             }
         }
     }
@@ -50,9 +51,6 @@ $(document).ready(function() {
       $(this).html( createSelect( holdst.fnGetColumnData(4) ) );
       $('select', this).change( function () {
           var filter_value = $(this).val();
-          if(filter_value){
-                filter_value = "(^|>)"+filter_value+"($|<)";
-          }
           holdst.fnFilter( filter_value, 4, true );
       } );
   } );