Bug 41624: Revert bug 35211

Bug 41624: Revert "Bug 35211: (QA follow-up) Fix counting"

This reverts commit 97a022054d.

Bug 41624: Revert "Bug 35211: (QA follow-up) fix display of other results tab and move template toolkit logic outside of script array"

This reverts commit c4c2a4b235.

Bug 41624: Revert "Bug 35211: Removed local items from group tabs and removed group items from other holdings tab"

This reverts commit 124c6c8670.

Bug 41624: Revert "Bug 35211: Fixed group tab item building logic"

This reverts commit 23eb2dbd39.

Bug 41624: Revert "Bug 35211: Fix tab building"

This reverts commit f438535b5c.

Bug 41624: Revert "Bug 35211: Set SeparateHoldingsByGroup to separate based on SeparateHoldingsBranch syspref"

This reverts commit d2a0527d86.

Bug 41624: Revert "Bug 35211: Fixed count on logged in holdings"

This reverts commit 96c7eb3459.

Bug 41624: Revert "Bug 35211: Reordered tabs in Holdings Table and fixed group tabnames"

This reverts commit 5c2b0fd496.

Bug 41624: Revert "Bug 35211: Separate group holdings into individual tabs"

This reverts commit 08045c8009.

Bug 41624: DB update to remove the pref

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
This commit is contained in:
Lucas Gass 2026-02-04 16:41:24 +00:00
parent 080f5a2497
commit 05d08e0ea4
No known key found for this signature in database
GPG Key ID: 60B447398B0D36CA
6 changed files with 45 additions and 138 deletions

View File

@ -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(
{

View File

@ -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'" );
},
};

View File

@ -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'),

View File

@ -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 %]

View File

@ -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:
- "<br/>"
- "All values of repeating tags and subfields will be printed with the given RIS tag."
- "<br/>"
- "Use of TY ( record type ) as a key will <em>replace</em> the default TY with the field value of your choosing."
- "Use of TY ( record type ) as a key will <em>replace</em> the default TY with the field value of your choosing."

View File

@ -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" %]
<span>[% Branches.GetLoggedInBranchname | html %] holdings ([% branch_holdings_count | html %])</span>
<span>[% Branches.GetLoggedInBranchname | html %] holdings ([% items_to_display_count - ( other_holdings_count || 0 ) - ( hidden_count || 0 ) || 0 | html %])</span>
[% END %]
[% END %]
[% IF other_holdings_count %]
[% WRAPPER tab_item tabname= "otherholdings" %]
<span>Other holdings ([% other_holdings_count || 0 | html %])</span>
[% END %]
[% END %]
[% ELSE %]
@ -345,25 +350,6 @@
<span>Holdings ([% items_to_display_count || 0 | html %])</span>
[% 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 %]
<span>[% group.title | html %] holdings ([% holdings_count_hash.${group.id} | html %])</span>
[% END %]
[% END %]
[% END %]
[% END %]
[% IF Koha.Preference('SeparateHoldings') %]
[% IF other_holdings_count > 0 %]
[% WRAPPER tab_item tabname= "otherholdings" %]
<span>Other holdings ([% other_holdings_count || 0 | html %])</span>
[% END %]
[% END %]
[% END %]
[% IF Koha.Preference('EnableItemGroups') %]
[% WRAPPER tab_item tabname= "item_groups" %]
<span>Item groups</span>
@ -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 %]
<script>
var browser;
var group_tabs;
browser = KOHA.browser("[% searchid | html %]", parseInt(biblionumber, 10));
browser.show();
let group_tabs_array = new Array;
[% IF Koha.Preference('SeparateHoldingsByGroup') && lib_groups %]
[% FOREACH group IN lib_groups %]
group_tabs = "group_holdings_[% group.id | html %]"
group_tabs_array.push(group_tabs);
[% END %]
[% END %]
[% IF bundlesEnabled %]
var bundle_settings = [% TablesSettings.GetTableSettings('catalogue', 'detail','bundle_tables','json') | $raw %];
var bundle_lost_value = [% Koha.Preference('BundleLostValue') | html %];
[% END %]
let items_tab_ids_default = [
'holdings',
'otherholdings'
];
let items_tab_ids = items_tab_ids_default.concat(group_tabs_array);
let items_tab_ids = [ 'holdings', 'otherholdings' ];
items_tab_ids.forEach( function( tab_id, index ) {
// Early return if the tab is not shown (ie. no table)