From adca564fbc3a08cd5a3ed1bca447d3daa86246f9 Mon Sep 17 00:00:00 2001 From: Pedro Amorim Date: Tue, 8 Nov 2022 14:53:07 -0100 Subject: [PATCH] Bug 30719: (QA Follow-up): - Fix wrong link in message in case there are no requests batch - Detail of batch update - View status of any request within a batch - Fix typo to correctly display status code on batch statuses list - 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 and input cardnumber instead of patronid. --- api/v1/swagger/definitions/illrequest.yaml | 2 +- .../prog/en/includes/ill-batch-modal.inc | 7 ++-- .../en/modules/admin/ill_batch_statuses.tt | 4 +- .../intranet-tmpl/prog/js/ill-batch-modal.js | 40 +++++++++++-------- 4 files changed, 30 insertions(+), 23 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 f0abfa8a64..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 @@ @@ -74,6 +74,7 @@ + diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/ill_batch_statuses.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/ill_batch_statuses.tt index 0bf6e5f53d..c47cc27e2c 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/ill_batch_statuses.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/ill_batch_statuses.tt @@ -132,7 +132,7 @@ [% FOREACH status IN statuses %] - + [% ELSE %]
    - There are no batch statuses defined. Create new batch status + There are no batch statuses defined. Create new batch status
    [% END %] [% END %] 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 70f9e29c5a..d8a6c563c7 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 @@ -299,6 +303,7 @@ tableContent.data = tableContent.data.map(function (row) { if (row.value === identifier) { row.requestId = data.illrequest_id; + row.requestStatus = data.status; } return row; }); @@ -893,6 +898,10 @@ return data.requestId || '-'; } + function createRequestStatus(x, y, data) { + return data.requestStatus || '-'; + } + function buildTable(identifiers) { table = KohaTable('identifier-table', { processing: true, @@ -918,9 +927,14 @@ }, { data: 'requestId', - width: '13%', + width: '6.5%', render: createRequestId }, + { + data: 'requestStatus', + width: '6.5%', + render: createRequestStatus + }, { width: '18%', render: createActions, @@ -1021,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.cardnumber ); 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