Bug 35745: Fix 'Set suggester' of a suggestion

On the suggestion edit form, if a suggester is selected using the "Set
to patron" (and patron search), the details of the selected patron will
contained "undefined" for the library's name and patron's category
description.

Test plan:
Edit a suggestion, click "Set to patron", select a patron
Notice that with this patch the library's name and patron category is
correctly displayed.

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit f7171c0a6c)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
This commit is contained in:
Jonathan Druart 2024-01-09 13:16:40 +01:00 committed by Fridolin Somers
parent f9be00361c
commit 56b675687f

View file

@ -1299,12 +1299,25 @@
}
function select_suggester(borrowernumber, borrower) {
var suggested = '<input type="hidden" id="suggestedby" name="suggestedby" value="' + borrowernumber + '" />';
suggested += '<a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=' + borrowernumber + '">';
suggested += borrower.surname + ', ' + borrower.firstname + ' (' + borrower.cardnumber + ')';
suggested += '</a> ';
suggested += borrower.branchname + ' (' + borrower.category_description + ')';
$("#tdsuggestedby").html(suggested);
$.ajax({
type: 'GET',
url: '/api/v1/patrons/' + borrowernumber,
headers: {
"x-koha-embed": "+strings"
},
success: function (data) {
var suggested = '<input type="hidden" id="suggestedby" name="suggestedby" value="' + data.borrowernumber + '" />';
suggested += '<a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=' + data.borrowernumber + '">';
suggested += data.surname + ', ' + data.firstname + ' (' + data.cardnumber + ')';
suggested += '</a> ';
suggested += data._strings.library_id.str + ' (' + data._strings.category_id.str + ')';
$("#tdsuggestedby").html(suggested);
},
error: function (data) {
alert(_("Cannot retrieve info for this patron."));
},
});
return 0;
}
$(document).ready(function(){