From 56b675687f420ba1cefd323f81c8ff2de42058ba Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Tue, 9 Jan 2024 13:16:40 +0100 Subject: [PATCH] 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 Signed-off-by: Martin Renvoize Signed-off-by: Katrin Fischer (cherry picked from commit f7171c0a6c61769719afcd0d5e70d1aad3d2a27b) Signed-off-by: Fridolin Somers --- .../prog/en/modules/suggestion/suggestion.tt | 25 ++++++++++++++----- 1 file changed, 19 insertions(+), 6 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/suggestion/suggestion.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/suggestion/suggestion.tt index 657a2a5cbd..6b8ec6aacc 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/suggestion/suggestion.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/suggestion/suggestion.tt @@ -1299,12 +1299,25 @@ } function select_suggester(borrowernumber, borrower) { - var suggested = ''; - suggested += ''; - suggested += borrower.surname + ', ' + borrower.firstname + ' (' + borrower.cardnumber + ')'; - suggested += ' '; - 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 = ''; + suggested += ''; + suggested += data.surname + ', ' + data.firstname + ' (' + data.cardnumber + ')'; + suggested += ' '; + 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(){ -- 2.39.5