From 51f42b87343f64638d6484218b3a23e579816bfa Mon Sep 17 00:00:00 2001 From: Tomas Cohen Arazi Date: Thu, 28 Oct 2021 15:32:04 -0300 Subject: [PATCH] Bug 29356: Pickup location dropdowns should perform 'contains' searches When placing a hold, the dropdowns for selecting a pickup library automatically right-truncate, so one can type "cen" and find Centerville. On the Libraries page in Admin, however, the search box both left- and right-truncates, so one can type "en" and find Centerville. This patch makes the search perform 'contains' searches. To test: 1. Try placing a hold. Make sure your rules allow Centerville to be a valid pickup location. 2. Search 'cen' => SUCCESS: Centerville shows 3. Search 'en => FAIL: Centerville doesn't show 4. Apply this patch and reload 5. Repeat 2 => SUCCESS: Works! 6. Repeat 3 => SUCCSS: Centerville shows! 7. Sign off :-D Signed-off-by: Tomas Cohen Arazi Signed-off-by: Andrew Fuerste-Henry Signed-off-by: Martin Renvoize Signed-off-by: Jonathan Druart --- koha-tmpl/intranet-tmpl/prog/en/modules/reserve/request.tt | 6 +++--- koha-tmpl/intranet-tmpl/prog/js/holds.js | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/reserve/request.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/reserve/request.tt index 7e3d05402b..e44016cf97 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/reserve/request.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/reserve/request.tt @@ -1260,7 +1260,7 @@ data: function (params) { var search_term = (params.term === undefined) ? '' : params.term; var query = { - "q": JSON.stringify({"name":{"-like":search_term+'%'}}), + "q": JSON.stringify({"name":{"-like":'%'+search_term+'%'}}), "_order_by": "name", "_per_page": -1 }; @@ -1322,7 +1322,7 @@ data: function (params) { var search_term = (params.term === undefined) ? '' : params.term; var query = { - "q": JSON.stringify({"name":{"-like":search_term+'%'}}), + "q": JSON.stringify({"name":{"-like":'%'+search_term+'%'}}), "_order_by": "name", "patron_id": patron_id, "_per_page": -1 @@ -1360,7 +1360,7 @@ data: function (params) { var search_term = (params.term === undefined) ? '' : params.term; var query = { - "q": JSON.stringify({"name":{"-like":search_term+'%'}}), + "q": JSON.stringify({"name":{"-like":'%'+search_term+'%'}}), "_order_by": "name", "patron_id": patron_id, "_per_page": -1 diff --git a/koha-tmpl/intranet-tmpl/prog/js/holds.js b/koha-tmpl/intranet-tmpl/prog/js/holds.js index 1f32a00f9f..a18b2641ed 100644 --- a/koha-tmpl/intranet-tmpl/prog/js/holds.js +++ b/koha-tmpl/intranet-tmpl/prog/js/holds.js @@ -249,7 +249,7 @@ $(document).ready(function() { data: function (params) { var search_term = (params.term === undefined) ? '' : params.term; var query = { - "q": JSON.stringify({"name":{"-like":search_term+'%'}}), + "q": JSON.stringify({"name":{"-like":'%'+search_term+'%'}}), "_order_by": "name", "_per_page": -1 }; -- 2.39.5