From a2399db4c0e67cb24252016b080fdd35f9307251 Mon Sep 17 00:00:00 2001 From: Tomas Cohen Arazi Date: Tue, 29 Jul 2025 11:23:26 -0300 Subject: [PATCH] Bug 40530: Use +strings and simplify JS Signed-off-by: Tomas Cohen Arazi Signed-off-by: Kyle M Hall --- .../prog/en/modules/members/holdshistory.tt | 19 ++++--------------- 1 file changed, 4 insertions(+), 15 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/members/holdshistory.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/members/holdshistory.tt index 12f55399e6c..98ac161708d 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/holdshistory.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/holdshistory.tt @@ -165,19 +165,8 @@ //Remove item type column settings table_settings['columns'] = table_settings['columns'].filter(function(c){return c['columnname'] != 'itemtype';}); [% END %] - const hold_cancellation_reasons = {}; - $.getJSON("/api/v1/authorised_value_categories/HOLD_CANCELLATION/authorised_values?_per_page=-1") - .done(function(data) { - // Convert the array into an associative array for ease of lookup - data.forEach(function(item) { - if (item.value !== undefined) { - hold_cancellation_reasons[item.value] = item.description; - } - }); - - let current_holds_table = build_holds_table("#table_holdshistory"); - let old_holds_table = build_holds_table("#table_oldholdshistory", 1); - }); + let current_holds_table = build_holds_table("#table_holdshistory"); + let old_holds_table = build_holds_table("#table_oldholdshistory", 1); function build_holds_table(table_id, old){ let additional_filters = { "-or": function(){ @@ -214,7 +203,7 @@ }; let table_url = '/api/v1/patrons/[% patron.borrowernumber | uri %]/holds'; - let table_embeds = ['biblio', 'item', 'pickup_library', 'pickup_library.branchname']; + let table_embeds = ['+strings', 'biblio', 'item', 'pickup_library', 'pickup_library.branchname']; if (old){ table_url += '?old=1'; table_embeds.push('deleted_biblio'); @@ -331,7 +320,7 @@ } else if (row.cancellation_date) { let r = _("Cancelled"); if (row.cancellation_reason){ - r += " (%s)".format(hold_cancellation_reasons[row.cancellation_reason]); + r += " (%s)".format(row._strings.cancellation_reason.str); } return r; } else if (row.status == 'W') { -- 2.39.5 (Apple Git-154)