Bugzilla – Attachment 183075 Details for
Bug 35211
Make it possible to split holdings tab using library groups
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 35211: Add group_holdings tab to Holdings table
Bug-35211-Add-groupholdings-tab-to-Holdings-table.patch (text/plain), 5.44 KB, created by
Eric Garcia
on 2025-06-06 16:50:32 UTC
(
hide
)
Description:
Bug 35211: Add group_holdings tab to Holdings table
Filename:
MIME Type:
Creator:
Eric Garcia
Created:
2025-06-06 16:50:32 UTC
Size:
5.44 KB
patch
obsolete
>From c1e5c9422c4629ca5aff5cb78e1c0218ac106749 Mon Sep 17 00:00:00 2001 >From: Eric Garcia <cubingguy714@gmail.com> >Date: Fri, 6 Jun 2025 16:47:27 +0000 >Subject: [PATCH] Bug 35211: Add group_holdings tab to Holdings table > >--- > catalogue/detail.pl | 23 +++++++++++++++++++ > .../tables/items/catalogue_detail.inc | 6 ++++- > .../prog/en/modules/catalogue/detail.tt | 8 ++++++- > 3 files changed, 35 insertions(+), 2 deletions(-) > >diff --git a/catalogue/detail.pl b/catalogue/detail.pl >index c6445d4a20..85c2981f59 100755 >--- a/catalogue/detail.pl >+++ b/catalogue/detail.pl >@@ -60,6 +60,8 @@ 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(); > >@@ -335,7 +337,28 @@ if ( C4::Context->preference('SeparateHoldings') ) { > my $other_holdings_count = > $items_to_display->search( { $SeparateHoldingsBranch => { '!=' => C4::Context->userenv->{branch} } } )->count; > $template->param( other_holdings_count => $other_holdings_count ); >+ >+ my $branchcode = C4::Context->userenv->{branch}; >+ my @all_search_groups = Koha::Library::Groups->get_search_groups( { interface => 'staff' } ); >+ >+ my @libs_in_group; >+ foreach my $search_group (@all_search_groups) { >+ while ( my $group = $search_group->next ) { >+ my @all_libs = $group->all_libraries; >+ if ( grep { $_->branchcode eq $branchcode } @all_libs ) { >+ foreach my $lib (@all_libs) { >+ if ( $lib->branchcode ne $branchcode ) { >+ push @libs_in_group, $lib->branchcode; >+ } >+ } >+ } >+ } >+ } >+ >+ $template->param( libs_in_group => \@libs_in_group ); >+ > } >+ > $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 67440510e6..5dcb5aa322 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 >@@ -285,10 +285,12 @@ > otherholdings: [% TablesSettings.GetTableSettings('catalogue', 'detail','otherholdings_table','json') | $raw %], > }; > >- let user_colvis = {holdings: {}, otherholdings: {}}; >+ let user_colvis = {holdings: {}, otherholdings: {}, group_holdings: {}}; > let table_nodes = { > holdings: "[% PROCESS 'build_table' tab="holdings" | collapse | $tojson %]", > otherholdings: "[% PROCESS 'build_table' tab="otherholdings" | collapse | $tojson %]", >+ group_holdings: "[% PROCESS 'build_table' tab="group_holdings" | collapse | $tojson %]", >+ > }; > function build_items_table (tab_id, add_filters, dt_options, drawcallback) { > >@@ -310,6 +312,8 @@ > let branch = '[% IF SeparateHoldingsBranch == 'homebranch' %]me.home_library_id[% ELSE %]me.holding_library_id[% END %]'; > if ( tab_id == 'holdings' ) { > default_filters[branch] = '[% Branches.GetLoggedInBranchcode() | html %]'; >+ } else if ( tab_id == 'group_holdings') { >+ default_filters[branch] = [ [% FOREACH branchcode IN libs_in_group %]"[% branchcode | html %]"[% UNLESS loop.last %], [% END%][% END %] ]; > } else { > default_filters[branch] = { '!=': '[% Branches.GetLoggedInBranchcode() | html %]' }; > } >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 dd588e4874..3ca6eb0caa 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt >@@ -331,6 +331,9 @@ > [% WRAPPER tab_item tabname= "otherholdings" %] > <span>Other holdings ([% other_holdings_count || 0 | html %])</span> > [% END %] >+ [% WRAPPER tab_item tabname= "group_holdings" %] >+ <span>Group holdings</span> >+ [% END %] > [% END %] > [% ELSE %] > [% WRAPPER tab_item tabname= "holdings" %] >@@ -472,6 +475,9 @@ > [% END # /tab_panel %] > > [% IF Koha.Preference('SeparateHoldings') %] >+ [% WRAPPER tab_panel tabname="group_holdings" %] >+ [% PROCESS items_table tab="group_holdings" %] >+ [% END #/tab_panel %] > [% WRAPPER tab_panel tabname="otherholdings" %] > [% PROCESS items_table tab="otherholdings" %] > [% END # /tab_panel %] >@@ -2034,7 +2040,7 @@ > // End bundle handling > [% END # /IF bundlesEnabled %] > >- let items_tab_ids = [ 'holdings', 'otherholdings' ]; >+ let items_tab_ids = [ 'holdings', 'otherholdings', 'group_holdings' ]; > items_tab_ids.forEach( function( tab_id, index ) { > > // Early return if the tab is not shown (ie. no table) >-- >2.30.2
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