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!

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit 1a26837c74)
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
This commit is contained in:
Kyle M Hall 2025-07-28 10:36:39 -04:00 committed by Paul Derscheid
parent 567902f42d
commit 6a31993e2b
No known key found for this signature in database
GPG Key ID: C25F9FD44CED595B
1 changed files with 14 additions and 3 deletions

View File

@ -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 = {
"-and": 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') {