Bug 35106: Add patron search autocomplete to Patron ID input

Test plan, k-t-d:
1) Install FreeForm and enable ILLmodule, run:
bash <(curl -s https://raw.githubusercontent.com/ammopt/koha-ill-dev/master/start-ill-dev.sh)
2) Visit /cgi-bin/koha/ill/ill-requests.pl
3) Create 'New ILL request'
4) Select the request type, input cardnumber '42' and select a library. Hit 'Create'
5) Manage the request created just now: click the request id or 'manage request' button from the table
6) Click "Edit request" from the top actions toolbar
7) Input text in Patron ID e.g. 'koha'. Notice you get patron suggestions.
8) Click one of the suggestions and save the request, notice the patron is saved correctly.

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Pedro Amorim <pedro.amorim@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
This commit is contained in:
Pedro Amorim 2023-10-19 09:35:32 +00:00 committed by Katrin Fischer
parent eebfb6d70a
commit fd450a86cb
No known key found for this signature in database
GPG Key ID: 0EF6E2C03357A834
1 changed files with 13 additions and 1 deletions

View File

@ -403,7 +403,7 @@
<!-- generic_confirm ends here -->
[% ELSIF op == 'edit_action' %]
<form method="POST" action="/cgi-bin/koha/ill/ill-requests.pl">
<form method="POST" id="ill_edit_action_form" action="/cgi-bin/koha/ill/ill-requests.pl">
[% INCLUDE 'csrf-token.inc' %]
<fieldset class="rows">
<legend>Request details</legend>
@ -978,6 +978,18 @@
$('.ill_checkout_due_date').show();
}
});
if ($("#ill_edit_action_form #borrowernumber").length) {
patron_autocomplete(
$('#ill_edit_action_form #borrowernumber'), {
'on-select-callback': function(event, ui) {
$("#ill_edit_action_form #borrowernumber").val(ui.item.patron_id);
return false;
}
}
);
}
</script>
[% INCLUDE 'ill-list-table-strings.inc' %]
[% INCLUDE 'ill-batch-table-strings.inc' %]