Bugzilla – Attachment 189451 Details for
Bug 35211
Make it possible to split holdings tab using library groups in intranet
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 35211: (QA follow-up) Fix counting
Bug-35211-QA-follow-up-Fix-counting.patch (text/plain), 4.46 KB, created by
Lisette Scheer
on 2025-11-10 21:24:53 UTC
(
hide
)
Description:
Bug 35211: (QA follow-up) Fix counting
Filename:
MIME Type:
Creator:
Lisette Scheer
Created:
2025-11-10 21:24:53 UTC
Size:
4.46 KB
patch
obsolete
>From 0bf15b789464a92cd14052e41ae49b38b7c7dc12 Mon Sep 17 00:00:00 2001 >From: Lisette Scheer <lisette@bywatersolutions.com> >Date: Mon, 10 Nov 2025 21:19:34 +0000 >Subject: [PATCH] Bug 35211: (QA follow-up) Fix counting > >This patch updates detail.pl and detail.tt to correctly count the number of items for each tab. >--- > catalogue/detail.pl | 31 ++++++++++--------- > .../prog/en/modules/catalogue/detail.tt | 4 +-- > 2 files changed, 19 insertions(+), 16 deletions(-) > >diff --git a/catalogue/detail.pl b/catalogue/detail.pl >index 0ff7b590c5a..9aea2a670b4 100755 >--- a/catalogue/detail.pl >+++ b/catalogue/detail.pl >@@ -333,6 +333,21 @@ if ( defined $dat->{'itemtype'} ) { > } > > my $total_group_holdings_count = 0; >+my $other_holdings_count = 0; >+my $branch_holdings_count = 0; >+if ( C4::Context->preference('SeparateHoldings') ) { >+ my $SeparateHoldingsBranch = C4::Context->preference('SeparateHoldingsBranch') || 'homebranch'; >+ $branch_holdings_count = >+ $items_to_display->search( { $SeparateHoldingsBranch => { '=' => C4::Context->userenv->{branch} } } )->count; >+ $other_holdings_count = $items_to_display->count - $branch_holdings_count; >+} >+$template->param( >+ count => $all_items->count, # FIXME 'count' is used in catalog-strings.inc >+ other_holdings_count => $other_holdings_count, # But it's not a meaningful variable, we should rename it there >+ all_items_count => $all_items->count, >+ items_to_display_count => $items_to_display->count, >+ branch_holdings_count => $branch_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' } ); >@@ -367,6 +382,7 @@ if ( C4::Context->preference('SeparateHoldingsByGroup') ) { > $total_group_holdings_count += $group_holdings_count; > > push @lib_groups, $group; >+ $other_holdings_count = ( $items_to_display->count ) - $total_group_holdings_count; > } > } > } >@@ -376,23 +392,10 @@ if ( C4::Context->preference('SeparateHoldingsByGroup') ) { > branchcodes => \%branchcode_hash, > holdings_count_hash => \%holdings_count, > total_group_holdings_count => $total_group_holdings_count, >+ other_holdings_count => $other_holdings_count, > ); > } > >-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 >- all_items_count => $all_items->count, >- items_to_display_count => $items_to_display->count, >-); >- > my $some_private_shelves = Koha::Virtualshelves->get_some_shelves( > { > borrowernumber => $borrowernumber, >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt >index a673a4062ba..e59c5371cf2 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt >@@ -322,9 +322,9 @@ > [% WRAPPER tabs id= "bibliodetails" %] > [% WRAPPER tabs_nav %] > [% IF Koha.Preference('SeparateHoldings') %] >- [% IF items_to_display_count - ( other_holdings_count || 0 ) - ( total_group_holdings_count || 0 ) %] >+ [% IF branch_holdings_count %] > [% WRAPPER tab_item tabname= "holdings" %] >- <span>[% Branches.GetLoggedInBranchname | html %] holdings ([% items_to_display_count - ( other_holdings_count || 0 ) - ( total_group_holdings_count || 0 ) - ( hidden_count || 0 ) || 0 | html %])</span> >+ <span>[% Branches.GetLoggedInBranchname | html %] holdings ([% branch_holdings_count | html %])</span> > [% END %] > [% END %] > [% ELSE %] >-- >2.39.5
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 35211
:
183075
|
183099
|
183143
|
183144
|
183420
|
183615
|
183642
|
183643
|
183901
|
183945
|
183949
|
183950
|
183966
|
183967
|
183968
|
184016
|
185336
|
185515
|
185525
|
185526
|
185527
|
185528
|
185529
|
185530
|
185531
|
188553
|
188554
|
188555
|
188556
|
188557
|
188558
|
188559
|
189379
|
189442
|
189443
|
189444
|
189445
|
189446
|
189447
|
189448
|
189449
|
189450
| 189451