Bugzilla – Attachment 185380 Details for
Bug 31698
Add ability to move a hold to a new bibliographic record/item
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 31698: Make searches return only exact matches for barcode/biblionumber
Bug-31698-Make-searches-return-only-exact-matches-.patch (text/plain), 4.32 KB, created by
Lucas Gass (lukeg)
on 2025-08-13 22:11:34 UTC
(
hide
)
Description:
Bug 31698: Make searches return only exact matches for barcode/biblionumber
Filename:
MIME Type:
Creator:
Lucas Gass (lukeg)
Created:
2025-08-13 22:11:34 UTC
Size:
4.32 KB
patch
obsolete
>From 8354daa0116e89ea4a7ffeee3139727afb0446dc Mon Sep 17 00:00:00 2001 >From: Lucas Gass <lucas@bywatersolutions.com> >Date: Wed, 13 Aug 2025 22:11:07 +0000 >Subject: [PATCH] Bug 31698: Make searches return only exact matches for > barcode/biblionumber > >--- > .../prog/en/modules/reserve/request.tt | 24 ++++++++++++------- > 1 file changed, 15 insertions(+), 9 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 4200d1d381e..8c307a112e0 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/reserve/request.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/reserve/request.tt >@@ -1901,9 +1901,11 @@ > method: "GET", > dataType: "json", > success: function (data) { >- if (data.length > 0) { >+ // Filter for exact matches only >+ let exactMatches = data.filter(item => item.external_id === externalID); >+ if (exactMatches.length > 0) { > let resultHtml = ""; >- $.each(data, function (index, item) { >+ $.each(exactMatches, function (index, item) { > resultHtml += ` > <div class="alert alert-success"> > <strong>Biblionumber:</strong> ${item.biblio_id} <br> >@@ -1929,7 +1931,7 @@ > event.preventDefault(); > $('#move_hold_biblio_confirm').prop('disabled' , true ); > >- let biblioID = $("#biblio_id").val(); >+ let biblioID = parseInt( $("#biblio_id").val() ); > let apiUrl = `/api/v1/biblios?q={"biblio_id":"${encodeURIComponent(biblioID)}"}`; > $.ajax({ > url: apiUrl, >@@ -1939,9 +1941,13 @@ > 'Accept': 'application/json' > }, > success: function (data) { >- if (data.length > 0) { >+ // Filter for exact matches only >+ let exactMatches = data.filter(item => item.biblio_id === biblioID); >+ >+ >+ if (exactMatches.length > 0) { > let resultHtml = ""; >- $.each(data, function (index, item) { >+ $.each(exactMatches, function (index, item) { > resultHtml += ` > <div class="alert alert-success"> > <strong>Biblionumber:</strong> ${item.biblio_id} <br> >@@ -1954,10 +1960,10 @@ > $("#biblioResultMessage").html(resultHtml); > } else { > $("#biblioResultMessage").html(` >- <div class="alert alert-warning">No item found with barcode: ${biblioID}.</div> >+ <div class="alert alert-warning">No record found with biblionumber: ${biblioID}.</div> > `); > } >- }, >+ } > }); > }); > >@@ -2093,7 +2099,7 @@ > $('#cancel_hold_alert').html( MSG_CANCEL_ALERT.format($('.holds_table .select_hold:checked').length)); > $('#cancel_hold_alert').show(); > localStorage.selectedHolds = $('.holds_table .select_hold:checked').toArray().map(el => $(el).data('id')); >- $('#item_record_choice').prop('disabled' , count ); >+ $('#item_record_choice').prop('disabled' , !$('.select_hold:checked').length ); > }); > > $('.holds_table .select_hold').click(function() { >@@ -2105,7 +2111,7 @@ > $('#cancel_hold_alert').html( MSG_CANCEL_ALERT.format($('.holds_table .select_hold:checked').length)); > $('#cancel_hold_alert').show(); > localStorage.selectedHolds = $('.holds_table .select_hold:checked').toArray().map(el => $(el).data('id')); >- $('#item_record_choice').prop('disabled' , count ); >+ $('#item_record_choice').prop('disabled' , !$('.select_hold:checked').length ); > }); > > $('.move_hold_item').click(function(e) { >-- >2.39.5
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 31698
:
179226
|
179235
|
179236
|
179279
|
179287
|
179290
|
179291
|
179292
|
179295
|
179704
|
179711
|
179713
|
181222
|
181223
|
181224
|
181225
|
181226
|
181228
|
181229
|
181230
|
181231
|
181232
|
181233
|
181234
|
181929
|
181930
|
181944
|
181945
|
181946
|
181947
|
181948
|
181951
|
181952
|
181953
|
181954
|
181955
|
181956
|
181957
|
181958
|
181959
|
181960
|
181961
|
181962
|
182639
|
182640
|
182641
|
184750
|
185050
|
185064
|
185065
|
185066
|
185067
|
185068
|
185069
|
185070
|
185121
|
185379
|
185380
|
185607
|
185608
|
185609
|
185610
|
185611
|
185612
|
185613
|
185614
|
185615
|
185616
|
185753
|
185754
|
185755
|
185756
|
185757
|
185758
|
185759
|
185760
|
185761
|
185762
|
185763
|
185764
|
185765
|
185766
|
185767
|
185768
|
185769
|
185770
|
185771
|
185772
|
185773
|
185774
|
185775
|
185776
|
185834