View | Details | Raw Unified | Return to bug 18296
Collapse All | Expand All

(-)a/C4/Items.pm (-21 lines)
Lines 69-75 BEGIN { Link Here
69
        CheckItemPreSave
69
        CheckItemPreSave
70
    
70
    
71
        GetItemsForInventory
71
        GetItemsForInventory
72
        GetItemInfosOf
73
        GetItemsByBiblioitemnumber
72
        GetItemsByBiblioitemnumber
74
        GetItemsInfo
73
        GetItemsInfo
75
	GetItemsLocationInfo
74
	GetItemsLocationInfo
Lines 923-948 sub GetItemsForInventory { Link Here
923
    return (\@results, $iTotalRecords);
922
    return (\@results, $iTotalRecords);
924
}
923
}
925
924
926
=head2 GetItemInfosOf
927
928
  GetItemInfosOf(@itemnumbers);
929
930
=cut
931
932
sub GetItemInfosOf {
933
    my @itemnumbers = @_;
934
935
    my $itemnumber_values = @itemnumbers ? join( ',', @itemnumbers ) : "''";
936
937
    my $dbh = C4::Context->dbh;
938
    my $query = "
939
        SELECT *
940
        FROM items
941
        WHERE itemnumber IN ($itemnumber_values)
942
    ";
943
    return $dbh->selectall_hashref($query, 'itemnumber');
944
}
945
946
=head2 GetItemsByBiblioitemnumber
925
=head2 GetItemsByBiblioitemnumber
947
926
948
  GetItemsByBiblioitemnumber($biblioitemnumber);
927
  GetItemsByBiblioitemnumber($biblioitemnumber);
(-)a/labels/label-item-search.pl (-1 lines)
Lines 30-36 use C4::Output qw(output_html_with_http_headers); Link Here
30
use C4::Context;
30
use C4::Context;
31
use C4::Search qw(SimpleSearch);
31
use C4::Search qw(SimpleSearch);
32
use C4::Biblio qw(TransformMarcToKoha);
32
use C4::Biblio qw(TransformMarcToKoha);
33
use C4::Items qw(GetItemInfosOf);
34
use C4::Creators::Lib qw(html_table);
33
use C4::Creators::Lib qw(html_table);
35
use C4::Debug;
34
use C4::Debug;
36
35
(-)a/reserve/request.pl (-10 / +11 lines)
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
- 

Return to bug 18296