|
Lines 61-68
use Koha::Reviews;
Link Here
|
| 61 |
use Koha::SearchEngine::Search; |
61 |
use Koha::SearchEngine::Search; |
| 62 |
use Koha::SearchEngine::QueryBuilder; |
62 |
use Koha::SearchEngine::QueryBuilder; |
| 63 |
use Koha::Serial::Items; |
63 |
use Koha::Serial::Items; |
| 64 |
use Koha::Library::Group; |
|
|
| 65 |
use Koha::Library::Groups; |
| 66 |
|
64 |
|
| 67 |
my $query = CGI->new(); |
65 |
my $query = CGI->new(); |
| 68 |
|
66 |
|
|
Lines 333-401
if ( defined $dat->{'itemtype'} ) {
Link Here
|
| 333 |
$dat->{imageurl} = getitemtypeimagelocation( 'intranet', $itemtypes->{ $dat->{itemtype} }->imageurl ); |
331 |
$dat->{imageurl} = getitemtypeimagelocation( 'intranet', $itemtypes->{ $dat->{itemtype} }->imageurl ); |
| 334 |
} |
332 |
} |
| 335 |
|
333 |
|
| 336 |
my $total_group_holdings_count = 0; |
|
|
| 337 |
my $other_holdings_count = 0; |
| 338 |
my $branch_holdings_count = 0; |
| 339 |
if ( C4::Context->preference('SeparateHoldings') ) { |
334 |
if ( C4::Context->preference('SeparateHoldings') ) { |
| 340 |
my $SeparateHoldingsBranch = C4::Context->preference('SeparateHoldingsBranch') || 'homebranch'; |
335 |
my $SeparateHoldingsBranch = C4::Context->preference('SeparateHoldingsBranch') || 'homebranch'; |
| 341 |
$branch_holdings_count = |
336 |
my $other_holdings_count = |
| 342 |
$items_to_display->search( { $SeparateHoldingsBranch => { '=' => C4::Context->userenv->{branch} } } )->count; |
337 |
$items_to_display->search( { $SeparateHoldingsBranch => { '!=' => C4::Context->userenv->{branch} } } )->count; |
| 343 |
$other_holdings_count = $items_to_display->count - $branch_holdings_count; |
338 |
$template->param( other_holdings_count => $other_holdings_count ); |
| 344 |
} |
339 |
} |
| 345 |
$template->param( |
340 |
$template->param( |
| 346 |
count => $all_items->count, # FIXME 'count' is used in catalog-strings.inc |
341 |
count => $all_items->count, # FIXME 'count' is used in catalog-strings.inc |
| 347 |
other_holdings_count => $other_holdings_count, # But it's not a meaningful variable, we should rename it there |
342 |
# But it's not a meaningful variable, we should rename it there |
| 348 |
all_items_count => $all_items->count, |
343 |
all_items_count => $all_items->count, |
| 349 |
items_to_display_count => $items_to_display->count, |
344 |
items_to_display_count => $items_to_display->count, |
| 350 |
branch_holdings_count => $branch_holdings_count, |
|
|
| 351 |
); |
345 |
); |
| 352 |
if ( C4::Context->preference('SeparateHoldingsByGroup') ) { |
|
|
| 353 |
my $branchcode = C4::Context->userenv->{branch}; |
| 354 |
my @all_search_groups = Koha::Library::Groups->get_search_groups( { interface => 'staff' } ); |
| 355 |
my @lib_groups; |
| 356 |
my %branchcode_hash; |
| 357 |
my %holdings_count; |
| 358 |
|
| 359 |
foreach my $search_group (@all_search_groups) { |
| 360 |
while ( my $group = $search_group->next ) { |
| 361 |
my @all_libs = $group->all_libraries; |
| 362 |
|
| 363 |
# Check if library is in group |
| 364 |
if ( grep { $_->branchcode eq $branchcode } @all_libs ) { |
| 365 |
|
| 366 |
# Get other libraries in group |
| 367 |
my @other_libs = grep { $_->branchcode ne $branchcode } @all_libs; |
| 368 |
|
| 369 |
my @libs_branchcodes; |
| 370 |
push @libs_branchcodes, $branchcode; |
| 371 |
|
| 372 |
foreach my $lib (@other_libs) { |
| 373 |
push @libs_branchcodes, $lib->branchcode; |
| 374 |
} |
| 375 |
|
| 376 |
# Build group branchcode hash |
| 377 |
$branchcode_hash{ $group->id } = \@libs_branchcodes; |
| 378 |
|
| 379 |
my $SeparateHoldingsBranch = C4::Context->preference('SeparateHoldingsBranch') || 'homebranch'; |
| 380 |
my $group_holdings_count = |
| 381 |
$items_to_display->search( { $SeparateHoldingsBranch => { '-in' => \@libs_branchcodes } } )->count; |
| 382 |
$holdings_count{ $group->id } = $group_holdings_count; |
| 383 |
$total_group_holdings_count += $group_holdings_count; |
| 384 |
|
| 385 |
push @lib_groups, $group; |
| 386 |
$other_holdings_count = ( $items_to_display->count ) - $total_group_holdings_count; |
| 387 |
} |
| 388 |
} |
| 389 |
} |
| 390 |
|
| 391 |
$template->param( |
| 392 |
lib_groups => \@lib_groups, |
| 393 |
branchcodes => \%branchcode_hash, |
| 394 |
holdings_count_hash => \%holdings_count, |
| 395 |
total_group_holdings_count => $total_group_holdings_count, |
| 396 |
other_holdings_count => $other_holdings_count, |
| 397 |
); |
| 398 |
} |
| 399 |
|
346 |
|
| 400 |
my $some_private_shelves = Koha::Virtualshelves->get_some_shelves( |
347 |
my $some_private_shelves = Koha::Virtualshelves->get_some_shelves( |
| 401 |
{ |
348 |
{ |