From ae28e2b1a4fe69dad16d6cb8bef9f782be428cbf Mon Sep 17 00:00:00 2001 From: Pedro Amorim Date: Fri, 27 Jan 2023 16:53:20 +0000 Subject: [PATCH] Bug 30719: (QA Follow-up): - Fixed an issue with illrequest api definition that prevented the listing of any ILL requests if if any had a status_alias - Updated "Add items to batch" css class to match new 22.11 style - Fixed conflict issue where it prevented the creation of a request in a backend that has JS field validation utilizing the #cardnumber selector - Added a check for metadata enrichment plugins and bail batches JS code if none are found, this prevents a console error - Remove ysearch from patron auto complete and use new standard one. FIXME: The dialog modal .modal has a z-index of 1050 but the autocomplete patron suggestions .ui-front has a z-index of 100, it's working but shows behind the modal and is unclickable. --- api/v1/swagger/definitions/illrequest.yaml | 2 +- .../prog/en/includes/ill-batch-modal.inc | 6 ++-- .../intranet-tmpl/prog/js/ill-batch-modal.js | 28 ++++++++----------- 3 files changed, 16 insertions(+), 20 deletions(-) diff --git a/api/v1/swagger/definitions/illrequest.yaml b/api/v1/swagger/definitions/illrequest.yaml index c37f7a30d3..78f9dc8385 100644 --- a/api/v1/swagger/definitions/illrequest.yaml +++ b/api/v1/swagger/definitions/illrequest.yaml @@ -128,7 +128,7 @@ properties: description: The request's current status status_alias: type: - - string + - object - "null" description: The ID of a user defined status for this request updated: diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/ill-batch-modal.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/ill-batch-modal.inc index d6df6f5bc7..b7587606e1 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/ill-batch-modal.inc +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/ill-batch-modal.inc @@ -18,8 +18,8 @@ value="" />
  • - - + +
  • @@ -65,7 +65,7 @@ diff --git a/koha-tmpl/intranet-tmpl/prog/js/ill-batch-modal.js b/koha-tmpl/intranet-tmpl/prog/js/ill-batch-modal.js index 829b344eee..6947499594 100644 --- a/koha-tmpl/intranet-tmpl/prog/js/ill-batch-modal.js +++ b/koha-tmpl/intranet-tmpl/prog/js/ill-batch-modal.js @@ -7,7 +7,7 @@ // Elements we work frequently with var textarea = document.getElementById("identifiers_input"); var nameInput = document.getElementById("name"); - var cardnumberInput = document.getElementById("cardnumber"); + var cardnumberInput = document.getElementById("batchcardnumber"); var branchcodeSelect = document.getElementById("branchcode"); var processButton = document.getElementById("process_button"); var createButton = document.getElementById("button_create_batch"); @@ -22,6 +22,10 @@ var statusesSelect = document.getElementById('statuscode'); + // Bail if there aren't any metadata enrichment plugins installed + if (typeof metadata_enrichment_services === 'undefined') { + return; + } // We need a data structure keyed on identifier type, which tells us how to parse that // identifier type and what services can get its metadata. We receive an array of // available services @@ -1031,23 +1035,15 @@ } function patronAutocomplete() { - // Add autocomplete for patron selection - $('#batch-form #cardnumber').autocomplete({ - appendTo: '#batch-form', - source: "/cgi-bin/koha/circ/ysearch.pl", - minLength: 3, - select: function (event, ui) { - var field = ui.item.cardnumber; - $('#batch-form #cardnumber').val(field) + patron_autocomplete( + $('#batch-form #batchcardnumber'), + { + 'on-select-callback': function( event, ui ) { + $("#batch-form #batchcardnumber").val( ui.item.patron_id ); return false; + } } - }) - .data("ui-autocomplete")._renderItem = function (ul, item) { - return $("
  • ") - .data("ui-autocomplete-item", item) - .append("" + item.surname + ", " + item.firstname + " (" + item.cardnumber + ") " + item.address + " " + item.city + " " + item.zipcode + " " + item.country + "") - .appendTo(ul); - }; + ); }; function createPatronLink() { -- 2.30.2