From df602da35f516fde6ad5668f59c334988fb1bb3b Mon Sep 17 00:00:00 2001 From: Kyle M Hall Date: Mon, 28 Jul 2025 10:36:39 -0400 Subject: [PATCH] Bug 40530: Show hold cancellation reason in patron holds history Bug 35560 includes a FIXME noting that it does not properly maintain the display of hold cancellation reasons introduced in bug 26281. Test Plan: 1) Place a hold and cancel it with a reason 2) Browse to the patron's hold history, note the FIXME shown instead of the reason 3) Apply this patch 4) Reload the patch 5) You should now see the cancellation reason instead of FIXME! --- .../prog/en/modules/members/holdshistory.tt | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 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 602338097bc..e4d9bcafb00 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/holdshistory.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/holdshistory.tt @@ -165,8 +165,19 @@ //Remove item type column settings table_settings['columns'] = table_settings['columns'].filter(function(c){return c['columnname'] != 'itemtype';}); [% END %] - let current_holds_table = build_holds_table("#table_holdshistory"); - let old_holds_table = build_holds_table("#table_oldholdshistory", 1); + 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); + }); function build_holds_table(table_id, old){ let additional_filters = { "-or": function(){ @@ -320,7 +331,7 @@ } else if (row.cancellation_date) { let r = _("Cancelled"); if (row.cancellation_reason){ - r += "(%s)".format("FIXME"); //FIXME Add HOLD_CANCELLATION description + r += " ( %s )".format(hold_cancellation_reasons[row.cancellation_reason]); } return r; } else if (row.status == 'W') { -- 2.39.5 (Apple Git-154)