From 4ab069e35eddebe95be9ed9934493b7f4ee1af16 Mon Sep 17 00:00:00 2001 From: Lucas Gass Date: Fri, 9 Jan 2026 20:25:15 +0000 Subject: [PATCH] Bug 35211: (follow-up) Improve how branchcodes are handled -This patch is an attempt to improve how we retrive branchcodes. Too much of this logic is unnesseary done in the template. -This also removed the unneeded "use Koha::Library::Group;" --- catalogue/detail.pl | 3 +-- .../html_helpers/tables/items/catalogue_detail.inc | 10 +--------- 2 files changed, 2 insertions(+), 11 deletions(-) diff --git a/catalogue/detail.pl b/catalogue/detail.pl index 9aea2a670b4..caec6916630 100755 --- a/catalogue/detail.pl +++ b/catalogue/detail.pl @@ -60,7 +60,6 @@ use Koha::Reviews; use Koha::SearchEngine::Search; use Koha::SearchEngine::QueryBuilder; use Koha::Serial::Items; -use Koha::Library::Group; use Koha::Library::Groups; my $query = CGI->new(); @@ -389,7 +388,7 @@ if ( C4::Context->preference('SeparateHoldingsByGroup') ) { $template->param( lib_groups => \@lib_groups, - branchcodes => \%branchcode_hash, + branchcode_hash => \%branchcode_hash, holdings_count_hash => \%holdings_count, total_group_holdings_count => $total_group_holdings_count, other_holdings_count => $other_holdings_count, diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/html_helpers/tables/items/catalogue_detail.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/html_helpers/tables/items/catalogue_detail.inc index 01f57749716..76ad4b4b720 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/html_helpers/tables/items/catalogue_detail.inc +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/html_helpers/tables/items/catalogue_detail.inc @@ -297,15 +297,7 @@ otherholdings: "[% PROCESS 'build_table' tab="otherholdings" | collapse | $tojson %]", }; - const branchcodes = { - [% FOREACH key IN branchcodes.keys %] - "[% key | html %]": [ - [% FOREACH code IN branchcodes.$key %] - "[% code | html %]"[% UNLESS loop.last %], [% END %] - [% END %] - ][% UNLESS loop.last %], [% END %] - [% END %] - }; + const branchcodes = [% To.json(branchcode_hash) | $raw %]; function build_items_table (tab_id, add_filters, dt_options, drawcallback) { -- 2.39.5