| 
      
            Lines 703-708
          sub marc_records_to_documents {
      
      
        Link Here
      
     | 
  
        
          | 703 | 
                          $record_document->{'marc_format'} = 'base64ISO2709'; | 
          703 | 
                          $record_document->{'marc_format'} = 'base64ISO2709'; | 
        
        
          | 704 | 
                      }  | 
          704 | 
                      }  | 
        
        
          | 705 | 
                  }  | 
          705 | 
                  }  | 
        
            
               | 
               | 
              706 | 
               | 
            
            
              | 707 | 
                      # Check if there is at least one available item  | 
            
            
              | 708 | 
                      if ($self->index eq $BIBLIOS_INDEX) { | 
            
            
              | 709 | 
                          my $biblio = Koha::Biblios->find($record->field('001')->data); | 
            
            
              | 710 | 
                          my $items = $biblio->items;  | 
            
            
              | 711 | 
                          my $available = 0;  | 
            
            
              | 712 | 
                          while (my $item = $items->next) { | 
            
            
              | 713 | 
                              next if $item->onloan;  | 
            
            
              | 714 | 
                              next if $item->notforloan;  | 
            
            
              | 715 | 
                              next if $item->withdrawn;  | 
            
            
              | 716 | 
                              next if $item->itemlost;  | 
            
            
              | 717 | 
                              next if $item->damaged;  | 
            
            
              | 718 | 
               | 
            
            
              | 719 | 
                              $available = 1;  | 
            
            
              | 720 | 
                              last;  | 
            
            
              | 721 | 
                          }  | 
            
            
              | 722 | 
               | 
            
            
              | 723 | 
                          $record_document->{available} = $available ? \1 : \0; | 
            
            
              | 724 | 
                      }  | 
            
            
              | 725 | 
               | 
            
        
          | 706 | 
                  push @record_documents, $record_document;  | 
          726 | 
                  push @record_documents, $record_document;  | 
        
        
          | 707 | 
              }  | 
          727 | 
              }  | 
        
        
          | 708 | 
              return \@record_documents;  | 
          728 | 
              return \@record_documents;  |