From edda5077fe6db63ab424d6e38b9301760e70058e Mon Sep 17 00:00:00 2001 From: David Cook Date: Thu, 9 Jan 2014 17:12:26 +1100 Subject: [PATCH] Bug 11502 - Branch filter in "Holds To Pull" is too fuzzy This patch uses regex checking via the DataTables fnFilter API method to make the branch filter more precise on the "Holds to Pull" page. The ability to use regex is built into DataTables so this just adds the actual expression. _TEST PLAN_ Before applying: 1) Add library (branches) with codes of NM, NMH, and NB 2) Add items (that can be placed on hold) at all these branches 3) Place a hold on an item that is only available at NM 4) Place a hold on an item that is only available at NMH 5) Place a hold on an item that is only available at NM and NB 6) Go to "Holds to Pull" in the Circulation module 7) Filter by these three different values 8) Note that filtering by "NM" will incorrectly bring up all three holds, while "NMH" and "NB" will only pull up one (like they should). Apply the patch. 9) Shift+refresh the page so that your Javascript refreshes 10) Repeat step 7 (filtering by the different branch values) 11) Note that filtering by "NM" will now only bring up the hold for "NM" and the hold for "NM" and "NB", while the others still only bring up one hold. Signed-off-by: Chris Cormack --- koha-tmpl/intranet-tmpl/prog/en/modules/circ/pendingreserves.tt | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/pendingreserves.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/pendingreserves.tt index c14c165..9a00eab 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/pendingreserves.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/pendingreserves.tt @@ -42,7 +42,11 @@ $(document).ready(function() { $("#homebranchfilter").each( function () { $(this).html( createSelect( holdst.fnGetColumnData(4) ) ); $('select', this).change( function () { - holdst.fnFilter( $(this).val(), 4 ); + var filter_value = $(this).val(); + if(filter_value){ + filter_value = "(^|>)"+filter_value+"($|<)"; + } + holdst.fnFilter( filter_value, 4, true ); } ); } ); $("#itypefilter").each( function () { -- 1.8.5.2