From 7c5fe2be923390a3254abbfa177b5031c28cc799 Mon Sep 17 00:00:00 2001 From: Lucas Gass Date: Wed, 4 Feb 2026 16:42:08 +0000 Subject: [PATCH] Bug 41624: Revert "Bug 35211: Removed local items from group tabs and removed group items from other holdings tab" This reverts commit 124c6c867065d4230ffa5553ca2b629e05b269a0. --- catalogue/detail.pl | 19 ++++++++++--------- .../tables/items/catalogue_detail.inc | 4 +--- 2 files changed, 11 insertions(+), 12 deletions(-) diff --git a/catalogue/detail.pl b/catalogue/detail.pl index 4115ae6c05c..b7b7c16d059 100755 --- a/catalogue/detail.pl +++ b/catalogue/detail.pl @@ -333,7 +333,13 @@ if ( defined $dat->{'itemtype'} ) { $dat->{imageurl} = getitemtypeimagelocation( 'intranet', $itemtypes->{ $dat->{itemtype} }->imageurl ); } -my $total_group_holdings_count = 0; +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 ); +} + if ( C4::Context->preference('SeparateHoldingsByGroup') ) { my $branchcode = C4::Context->userenv->{branch}; my @all_search_groups = Koha::Library::Groups->get_search_groups( { interface => 'staff' } ); @@ -358,6 +364,9 @@ 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; @@ -365,7 +374,6 @@ if ( C4::Context->preference('SeparateHoldingsByGroup') ) { my $group_holdings_count = $items_to_display->search( { $SeparateHoldingsBranch => { '-in' => \@libs_branchcodes } } )->count; $holdings_count{ $group->id } = $group_holdings_count; - $total_group_holdings_count += $group_holdings_count; push @lib_groups, $group; } @@ -380,13 +388,6 @@ 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 9ffce4036bd..5c25bff6d8d 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 @@ -328,9 +328,7 @@ if ( tab_id == 'holdings' ) { default_filters[branch] = '[% Branches.GetLoggedInBranchcode() | html %]'; } else { - let all_branchcodes = Object.values(branchcodes).flat(); - all_branchcodes.push('[% Branches.GetLoggedInBranchcode() | html %]'); - default_filters[branch] = { '-not_in' : all_branchcodes }; + default_filters[branch] = { '!=': '[% Branches.GetLoggedInBranchcode() | html %]' }; } [% END %] -- 2.39.5