Lines 294-321
foreach my $biblionumber (@biblionumbers) {
Link Here
|
294 |
|
294 |
|
295 |
my %itemnumbers_of_biblioitem; |
295 |
my %itemnumbers_of_biblioitem; |
296 |
|
296 |
|
297 |
## $items is array of 'item' table numbers |
|
|
298 |
my $items = Koha::Items->search({ biblionumber => $biblionumber }); |
299 |
my @itemnumbers = $items->get_column('itemnumber'); |
300 |
my @hostitems = get_hostitemnumbers_of($biblionumber); |
297 |
my @hostitems = get_hostitemnumbers_of($biblionumber); |
|
|
298 |
my @itemnumbers; |
301 |
if (@hostitems){ |
299 |
if (@hostitems){ |
302 |
$template->param('hostitemsflag' => 1); |
300 |
$template->param('hostitemsflag' => 1); |
303 |
push(@itemnumbers, @hostitems); |
301 |
push(@itemnumbers, @hostitems); |
304 |
} |
302 |
} |
305 |
|
303 |
|
306 |
if (!@itemnumbers) { |
304 |
my $items = Koha::Items->search({ -or => { biblionumber => $biblionumber, itemnumber => { in => \@itemnumbers } } }); |
|
|
305 |
|
306 |
unless ( $items->count ) { |
307 |
# FIXME Then why do we continue? |
307 |
$template->param('noitems' => 1); |
308 |
$template->param('noitems' => 1); |
308 |
$biblioloopiter{noitems} = 1; |
309 |
$biblioloopiter{noitems} = 1; |
309 |
} |
310 |
} |
310 |
|
311 |
|
311 |
## Hash of item number to 'item' table fields |
|
|
312 |
my $iteminfos_of = GetItemInfosOf(@itemnumbers); |
313 |
|
314 |
## Here we go backwards again to create hash of biblioitemnumber to itemnumbers, |
312 |
## Here we go backwards again to create hash of biblioitemnumber to itemnumbers, |
315 |
## when by definition all of the itemnumber have the same biblioitemnumber |
313 |
## when by definition all of the itemnumber have the same biblioitemnumber |
316 |
foreach my $itemnumber (@itemnumbers) { |
314 |
my ( $itemnumbers_of_biblioitem, $iteminfos_of); |
317 |
my $biblioitemnumber = $iteminfos_of->{$itemnumber}->{biblioitemnumber}; |
315 |
while ( my $item = $items->next ) { |
|
|
316 |
$item = $item->unblessed; |
317 |
my $biblioitemnumber = $item->{biblioitemnumber}; |
318 |
my $itemnumber = $item->{itemnumber}; |
318 |
push( @{ $itemnumbers_of_biblioitem{$biblioitemnumber} }, $itemnumber ); |
319 |
push( @{ $itemnumbers_of_biblioitem{$biblioitemnumber} }, $itemnumber ); |
|
|
320 |
$iteminfos_of->{$itemnumber} = $item; |
319 |
} |
321 |
} |
320 |
|
322 |
|
321 |
## Should be same as biblionumber |
323 |
## Should be same as biblionumber |
322 |
- |
|
|