Bug 40530: Use +strings and simplify JS

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit 81e92c5ae0)
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
This commit is contained in:
Tomas Cohen Arazi 2025-07-29 11:23:26 -03:00 committed by Paul Derscheid
parent cea9f8f639
commit a0af2fc321
No known key found for this signature in database
GPG Key ID: C25F9FD44CED595B
1 changed files with 4 additions and 15 deletions

View File

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