From 36d96180aea6e71d24da116343cd37bd723e808f Mon Sep 17 00:00:00 2001 From: Fridolin Somers Date: Thu, 25 Jan 2024 09:50:28 +0100 Subject: [PATCH] Bug 35903: In cataloguing authority plugin using autocomplete must set operator exact When cataloguing and using authority plugin, there is auto-completion on inputs and default operator is "contains". When using auto-completion and selecting a result it would be logical to set operator "exact". See doc https://api.jqueryui.com/autocomplete/#event-select This patch also adds auto-completion missing on "Search all headings". Test plan: 1) Create a new authority Topical Term with heading "Cart" 2) Create a new authority Topical Term with heading "Carthage" 3) Create a new biblio record 4) Use authority plugin on field 650 5) You see current operator are "contains" 6) Enter "Car" in "Search main heading ($a only):" 7) You see auto-completion showing "Cart" and "Carthage" 8) Click on "Cart" 9) You see operator changes to "is exactly" 10) Submit form to see the results 11) Clear form and repeat 6-9 for the three other inputs Signed-off-by: Michelle Spinney Signed-off-by: Marcel de Rooy Signed-off-by: Katrin Fischer --- .../prog/en/includes/auth-finder-search.inc | 3 +- .../prog/js/auth-finder-search.js | 42 ++++++++++++++++++- 2 files changed, 43 insertions(+), 2 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/auth-finder-search.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/auth-finder-search.inc index 5b5a8828e8..fe94cf0f8b 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/auth-finder-search.inc +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/auth-finder-search.inc @@ -89,7 +89,8 @@ [% END %] - + +
  • diff --git a/koha-tmpl/intranet-tmpl/prog/js/auth-finder-search.js b/koha-tmpl/intranet-tmpl/prog/js/auth-finder-search.js index d986723664..5bdf7db81a 100644 --- a/koha-tmpl/intranet-tmpl/prog/js/auth-finder-search.js +++ b/koha-tmpl/intranet-tmpl/prog/js/auth-finder-search.js @@ -9,7 +9,7 @@ $(document).ready(function(){ e.preventDefault(); finderjump('authorities.pl?index=' + index + '&authtypecode=' + authtypecode, 'full' ); }); - // marclist + // marclistanywhere $( "#value_any" ).autocomplete({ source: function(request, response) { $.ajax({ @@ -35,6 +35,40 @@ $(document).ready(function(){ } }); }, + select: function( event, ui ) { + $("#marclistanywhere").val("exact"); + }, + minLength: 3, + }); + // marclistheading + $( "#value_match" ).autocomplete({ + source: function(request, response) { + $.ajax({ + url: "/cgi-bin/koha/authorities/ysearch.pl", + dataType: "json", + data: { + authtypecode : authtypecode, + term: request.term, + op: "do_search", + type: "intranet", + and_or: "and", + operator: "start", + orderby: "HeadingAsc", + querytype: "match" + }, + success: function(data) { + response( $.map( data, function( item ) { + return { + label: item.summary, + value: item.summary + }; + })); + } + }); + }, + select: function( event, ui ) { + $("#marclistheading").val("exact"); + }, minLength: 3, }); // mainentry @@ -63,6 +97,9 @@ $(document).ready(function(){ } }); }, + select: function( event, ui ) { + $("#mainentry").val("exact"); + }, minLength: 3, }); // mainmainentry @@ -91,6 +128,9 @@ $(document).ready(function(){ } }); }, + select: function( event, ui ) { + $("#mainmainentry").val("exact"); + }, minLength: 3, }); $("#clear-form").click(function(){ -- 2.39.5