diff --git a/catalogue/detail.pl b/catalogue/detail.pl
index 05a2d14140..d6ff622031 100755
--- a/catalogue/detail.pl
+++ b/catalogue/detail.pl
@@ -61,8 +61,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();
@@ -333,69 +331,18 @@ if ( defined $dat->{'itemtype'} ) {
$dat->{imageurl} = getitemtypeimagelocation( 'intranet', $itemtypes->{ $dat->{itemtype} }->imageurl );
}
-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;
+ my $other_holdings_count =
+ $items_to_display->search( { $SeparateHoldingsBranch => { '!=' => C4::Context->userenv->{branch} } } )->count;
+ $template->param( other_holdings_count => $other_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
+ # 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' } );
- my @lib_groups;
- my %branchcode_hash;
- my %holdings_count;
-
- foreach my $search_group (@all_search_groups) {
- while ( my $group = $search_group->next ) {
- my @all_libs = $group->all_libraries;
-
- # Check if library is in group
- if ( grep { $_->branchcode eq $branchcode } @all_libs ) {
-
- # Get other libraries in group
- my @other_libs = grep { $_->branchcode ne $branchcode } @all_libs;
-
- my @libs_branchcodes;
- push @libs_branchcodes, $branchcode;
-
- foreach my $lib (@other_libs) {
- push @libs_branchcodes, $lib->branchcode;
- }
-
- # Build group branchcode hash
- $branchcode_hash{ $group->id } = \@libs_branchcodes;
-
- my $SeparateHoldingsBranch = C4::Context->preference('SeparateHoldingsBranch') || 'homebranch';
- 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;
- $other_holdings_count = ( $items_to_display->count ) - $total_group_holdings_count;
- }
- }
- }
-
- $template->param(
- lib_groups => \@lib_groups,
- branchcodes => \%branchcode_hash,
- holdings_count_hash => \%holdings_count,
- total_group_holdings_count => $total_group_holdings_count,
- other_holdings_count => $other_holdings_count,
- );
-}
my $some_private_shelves = Koha::Virtualshelves->get_some_shelves(
{
diff --git a/installer/data/mysql/atomicupdate/bug_41624.pl b/installer/data/mysql/atomicupdate/bug_41624.pl
new file mode 100644
index 0000000000..750b0b064a
--- /dev/null
+++ b/installer/data/mysql/atomicupdate/bug_41624.pl
@@ -0,0 +1,31 @@
+use Modern::Perl;
+use Koha::Installer::Output qw(say_warning say_success say_info);
+
+return {
+ bug_number => "41624",
+ description => "Remove SeparateHoldingsByGroup system preference",
+ up => sub {
+ my ($args) = @_;
+ my ( $dbh, $out ) = @$args{qw(dbh out)};
+
+ # Check if the preference exists before removing
+ my ($exists) = $dbh->selectrow_array(
+ q{
+ SELECT COUNT(*)
+ FROM systempreferences
+ WHERE variable = 'SeparateHoldingsByGroup'
+ }
+ );
+
+ if ($exists) {
+ $dbh->do(
+ q{
+ DELETE FROM systempreferences
+ WHERE variable = 'SeparateHoldingsByGroup'
+ }
+ );
+ }
+
+ say_success( $out, "Removed system preference 'SeparateHoldingsByGroup'" );
+ },
+};
diff --git a/installer/data/mysql/mandatory/sysprefs.sql b/installer/data/mysql/mandatory/sysprefs.sql
index 266d330eda..0f2f582faf 100644
--- a/installer/data/mysql/mandatory/sysprefs.sql
+++ b/installer/data/mysql/mandatory/sysprefs.sql
@@ -742,7 +742,6 @@ INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, `
('SendAllEmailsTo','',NULL,'All emails will be redirected to this email if it is not empty','Free'),
('SeparateHoldings','0',NULL,'Separate current branch holdings from other holdings','YesNo'),
('SeparateHoldingsBranch','homebranch','homebranch|holdingbranch','Branch used to separate holdings','Choice'),
-('SeparateHoldingsByGroup','0',NULL,'Separate current branch holdings and holdings from libraries in the same library groups','YesNo'),
('SerialsDefaultEmailAddress', '', NULL, 'Default email address used as reply-to for notices sent by the serials module.', 'Free'),
('SerialsDefaultReplyTo', '', NULL, 'Default email address that serials notices are sent from.', 'Free'),
('SerialsSearchResultsLimit', '', NULL, 'Serials search results limit', 'Integer'),
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 9ffce4036b..9a1a3eaf65 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
@@ -296,17 +296,6 @@
holdings: "[% PROCESS 'build_table' tab="holdings" | collapse | $tojson %]",
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 %]
- };
-
function build_items_table (tab_id, add_filters, dt_options, drawcallback) {
let table_dt;
@@ -328,22 +317,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 };
- }
- [% END %]
-
- [% IF Koha.Preference('SeparateHoldingsByGroup') %]
- if ( tab_id.includes('group_holdings') ) {
- user_colvis[tab_id] = {};
- items_table_settings[tab_id] = [% TablesSettings.GetTableSettings('catalogue', 'detail','otherholdings_table','json') | $raw %];
-
- const id = tab_id.replace("group_holdings_", "");
-
- let branch = '[% IF SeparateHoldingsBranch == 'homebranch' %]me.home_library_id[% ELSE %]me.holding_library_id[% END %]';
- default_filters[branch] = branchcodes[id];
-
+ default_filters[branch] = { '!=': '[% Branches.GetLoggedInBranchcode() | html %]' };
}
[% END %]
diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/cataloguing.pref b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/cataloguing.pref
index 33043ed714..9c62cae068 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/cataloguing.pref
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/cataloguing.pref
@@ -301,12 +301,6 @@ Cataloging:
homebranch: 'home library'
holdingbranch: 'holding library'
- "is the logged in user's library. The second tab will contain all other items."
- -
- - pref: SeparateHoldingsByGroup
- choices:
- 1: Separate
- 0: "Don't separate"
- - "holdings by library group in subsequent tabs that contain items whose home library is the logged in library branch."
-
- pref: AlwaysShowHoldingsTableFilters
choices:
@@ -414,4 +408,4 @@ Cataloging:
- "
"
- "All values of repeating tags and subfields will be printed with the given RIS tag."
- "
"
- - "Use of TY ( record type ) as a key will replace the default TY with the field value of your choosing."
+ - "Use of TY ( record type ) as a key will replace the default TY with the field value of your choosing."
\ No newline at end of file
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 591800e408..763cda06ba 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt
@@ -335,9 +335,14 @@
[% WRAPPER tabs id= "bibliodetails" %]
[% WRAPPER tabs_nav %]
[% IF Koha.Preference('SeparateHoldings') %]
- [% IF branch_holdings_count %]
+ [% IF items_to_display_count - ( other_holdings_count || 0 ) %]
[% WRAPPER tab_item tabname= "holdings" %]
- [% Branches.GetLoggedInBranchname | html %] holdings ([% branch_holdings_count | html %])
+ [% Branches.GetLoggedInBranchname | html %] holdings ([% items_to_display_count - ( other_holdings_count || 0 ) - ( hidden_count || 0 ) || 0 | html %])
+ [% END %]
+ [% END %]
+ [% IF other_holdings_count %]
+ [% WRAPPER tab_item tabname= "otherholdings" %]
+ Other holdings ([% other_holdings_count || 0 | html %])
[% END %]
[% END %]
[% ELSE %]
@@ -345,25 +350,6 @@
Holdings ([% items_to_display_count || 0 | html %])
[% END %]
[% END %]
-
- [% IF Koha.Preference('SeparateHoldingsByGroup') && lib_groups %]
- [% FOREACH group IN lib_groups %]
- [% IF ( holdings_count_hash.${group.id} > 0 ) %]
- [% WRAPPER tab_item tabname="group_holdings_" _ group.id %]
- [% group.title | html %] holdings ([% holdings_count_hash.${group.id} | html %])
- [% END %]
- [% END %]
- [% END %]
- [% END %]
-
- [% IF Koha.Preference('SeparateHoldings') %]
- [% IF other_holdings_count > 0 %]
- [% WRAPPER tab_item tabname= "otherholdings" %]
- Other holdings ([% other_holdings_count || 0 | html %])
- [% END %]
- [% END %]
- [% END %]
-
[% IF Koha.Preference('EnableItemGroups') %]
[% WRAPPER tab_item tabname= "item_groups" %]
Item groups
@@ -503,16 +489,6 @@
[% PROCESS items_table tab="otherholdings" %]
[% END # /tab_panel %]
[% END %]
- [% IF Koha.Preference('SeparateHoldingsByGroup') && lib_groups %]
- [% FOREACH group IN lib_groups %]
- [% IF ( holdings_count_hash.${group.id} > 0 ) %]
- [% SET group_tab = "group_holdings_" _ group.id %]
- [% WRAPPER tab_panel tabname=group_tab %]
- [% PROCESS items_table tab=group_tab %]
- [% END # /tab_panel %]
- [% END %]
- [% END %]
- [% END %]
[% IF ( MARCNOTES ) %]
[% WRAPPER tab_panel tabname="description" %]
@@ -1763,29 +1739,15 @@
[% END %]