From 2f211e0e05a98360e5d72275308e655ef44e6c82 Mon Sep 17 00:00:00 2001 From: Eric Garcia Date: Thu, 10 Jul 2025 18:52:22 +0000 Subject: [PATCH] Bug 35211: Removed local items from group tabs and removed group items from other holdings tab Fixed the issues with tabs. I cannot replicate the issue in the attached screenshot. What steps did you take? --- catalogue/detail.pl | 19 +++++++++---------- .../tables/items/catalogue_detail.inc | 4 +++- 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/catalogue/detail.pl b/catalogue/detail.pl index 42d6704199..d6cdca7631 100755 --- a/catalogue/detail.pl +++ b/catalogue/detail.pl @@ -332,13 +332,7 @@ if ( defined $dat->{'itemtype'} ) { $dat->{imageurl} = getitemtypeimagelocation( 'intranet', $itemtypes->{ $dat->{itemtype} }->imageurl ); } -if ( C4::Context->preference('SeparateHoldings') ) { - my $SeparateHoldingsBranch = C4::Context->preference('SeparateHoldingsBranch') || 'homebranch'; - my $other_holdings_count = - $items_to_display->search( { $SeparateHoldingsBranch => { '!=' => C4::Context->userenv->{branch} } } )->count; - $template->param( other_holdings_count => $other_holdings_count ); -} - +my $total_group_holdings_count = 0; if ( C4::Context->preference('SeparateHoldingsByGroup') ) { my $branchcode = C4::Context->userenv->{branch}; my @all_search_groups = Koha::Library::Groups->get_search_groups( { interface => 'staff' } ); @@ -361,15 +355,13 @@ if ( C4::Context->preference('SeparateHoldingsByGroup') ) { push @libs_branchcodes, $lib->branchcode; } - # Push logged in branchcode - push @libs_branchcodes, $branchcode; - # Build group branchcode hash $branchcode_hash{ $group->id } = \@libs_branchcodes; my $group_holdings_count = $items_to_display->search( { homebranch => { '-in' => \@libs_branchcodes } } )->count; $holdings_count{ $group->id } = $group_holdings_count; + $total_group_holdings_count += $group_holdings_count; push @lib_groups, $group; } @@ -383,6 +375,13 @@ if ( C4::Context->preference('SeparateHoldingsByGroup') ) { ); } +if ( C4::Context->preference('SeparateHoldings') ) { + my $SeparateHoldingsBranch = C4::Context->preference('SeparateHoldingsBranch') || 'homebranch'; + my $other_holdings_count = + $items_to_display->search( { $SeparateHoldingsBranch => { '!=' => C4::Context->userenv->{branch} } } )->count; + $other_holdings_count -= $total_group_holdings_count; + $template->param( other_holdings_count => $other_holdings_count ); +} $template->param( count => $all_items->count, # FIXME 'count' is used in catalog-strings.inc # But it's not a meaningful variable, we should rename it there 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 6e1cc46bbf..e8839e8f1b 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 @@ -322,7 +322,9 @@ if ( tab_id == 'holdings' ) { default_filters[branch] = '[% Branches.GetLoggedInBranchcode() | html %]'; } else { - default_filters[branch] = { '!=': '[% Branches.GetLoggedInBranchcode() | html %]' }; + let all_branchcodes = Object.values(branchcodes).flat(); + all_branchcodes.push('[% Branches.GetLoggedInBranchcode() | html %]'); + default_filters[branch] = { '-not_in' : all_branchcodes }; } [% END %] -- 2.39.5