Bug 14816: Fix multiple selection in item search
authorJulian Maurice <julian.maurice@biblibre.com>
Thu, 7 Jan 2016 14:38:57 +0000 (15:38 +0100)
committerFrédéric Demians <f.demians@tamil.fr>
Wed, 27 Apr 2016 14:56:44 +0000 (16:56 +0200)
Send each selected value as a separate parameter. Otherwise DataTables
(or jQuery ?) joins all values with a comma

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

I could not reproduce the bug when selecting multiple home libraries,
but I could by selecting multiple item types or collection codes. The
patch allowed those queries to complete correctly.

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

Signed-off-by: Brendan Gallagher <bredan@bywatersolutions.com>
(cherry picked from commit 9aa8bf46f6b45ebcd342c09bd3a09ae55f3dd4a8)
Signed-off-by: Julian Maurice <julian.maurice@biblibre.com>
(cherry picked from commit 47ebb4ffb1869b52f1c011e3a6b236b85b0e51ab)
Signed-off-by: Frédéric Demians <f.demians@tamil.fr>

koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/itemsearch.tt

index bc1ffb9..ed44d9f 100644 (file)
       $('#results-wrapper').empty().html(results_heading + table);
 
       var params = [];
-      $form.find('select,input[type="text"],input[type="hidden"]').not('[disabled]').each(function () {
+      $form.find('select').not('[disabled]').find('option:selected').each(function () {
+        var name = $(this).parent('select').attr('name');
+        var value = $(this).val();
+        params.push({ 'name': name, 'value': value });
+      });
+      $form.find('input[type="text"],input[type="hidden"]').not('[disabled]').each(function () {
         params.push({ 'name': $(this).attr('name'), 'value': $(this).val() });
       });
       $form.find('input[type="radio"]:checked').each(function() {