| Lines 195-217
          my @biblionumbers = uniq $distinct_holds->get_column('biblionumber');
      
      
        Link Here | 
        
          | 195 | my $reserves; | 195 | my $reserves; | 
        
          | 196 | foreach my $bibnum ( @biblionumbers ){ | 196 | foreach my $bibnum ( @biblionumbers ){ | 
        
          | 197 |  | 197 |  | 
            
              | 198 |     my @items = Koha::Items->search({ biblionumber => $bibnum }); |  |  | 
            
              | 199 |     foreach my $i ( @items ){ | 
            
              | 200 |         if ( $i->checkout ){ | 
            
              | 201 |             next; | 
            
              | 202 |         } | 
            
              | 203 |     } | 
            
              | 204 |  | 
        
          | 205 |     my @branchtransfers = map { $_->itemnumber } Koha::Item::Transfers->search({ datearrived => undef }, { columns => [ 'itemnumber' ], collapse => 1 }); | 198 |     my @branchtransfers = map { $_->itemnumber } Koha::Item::Transfers->search({ datearrived => undef }, { columns => [ 'itemnumber' ], collapse => 1 }); | 
          
            
              | 206 |     my @issues = map { $_->itemnumber } Koha::Checkouts->search({}, { columns => [ 'itemnumber' ], collapse => 1 }); | 199 |     my @checkouts = map { $_->itemnumber } Koha::Checkouts->search({}, { columns => [ 'itemnumber' ], collapse => 1 }); | 
            
              |  |  | 200 |     my @waiting_holds = map { $_->itemnumber } Koha::Holds->search({'found' => 'W'}, { columns => [ 'itemnumber' ], collapse => 1 }); | 
        
          | 207 |  | 201 |  | 
          
            
              | 208 |     @items = Koha::Items->search( | 202 |     my @items = Koha::Items->search( | 
        
          | 209 |         { | 203 |         { | 
        
          | 210 |             biblionumber => $bibnum, | 204 |             biblionumber => $bibnum, | 
        
          | 211 |             itemlost     => 0, | 205 |             itemlost     => 0, | 
        
          | 212 |             withdrawn    => 0, | 206 |             withdrawn    => 0, | 
        
          | 213 |             notforloan   => 0, | 207 |             notforloan   => 0, | 
          
            
              | 214 |             itemnumber   => { -not_in => [ @branchtransfers, @issues ] }, | 208 |             itemnumber   => { -not_in => [ @branchtransfers, @checkouts, @waiting_holds ] }, | 
        
          | 215 |         } | 209 |         } | 
        
          | 216 |     ); | 210 |     ); | 
        
          | 217 |  | 211 |  | 
  
    | Lines 233-239
          foreach my $bibnum ( @biblionumbers ){
      
      
        Link Here | 
        
          | 233 |     $reserves->{$bibnum}->{locations} = [ uniq map { defined $_->location ? $_->location : () } @items ]; | 227 |     $reserves->{$bibnum}->{locations} = [ uniq map { defined $_->location ? $_->location : () } @items ]; | 
        
          | 234 |  | 228 |  | 
        
          | 235 |     # get available callnumbers for each biblio | 229 |     # get available callnumbers for each biblio | 
          
            
              | 236 |     $reserves->{$bibnum}->{locations} = [ uniq map { defined $_->itemcallnumber ? $_->itemcallnumber : () } @items ]; | 230 |     $reserves->{$bibnum}->{callnumbers} = [ uniq map { defined $_->itemcallnumber ? $_->itemcallnumber : () } @items ]; | 
        
          | 237 |  | 231 |  | 
        
          | 238 |     # get available enumchrons for each biblio | 232 |     # get available enumchrons for each biblio | 
        
          | 239 |     $reserves->{$bibnum}->{enumchrons} = [ uniq map { defined $_->enumchron ? $_->enumchron : () } @items ]; | 233 |     $reserves->{$bibnum}->{enumchrons} = [ uniq map { defined $_->enumchron ? $_->enumchron : () } @items ]; |