| 
      
            Lines 1006-1012
          subtest 'marc_records_to_documents should set the "available" field' => sub {
      
      
        Link Here
      
     | 
  
        
          | 1006 | 
           | 
          1006 | 
           | 
        
        
          | 1007 | 
              $item->notforloan(1)->store();  | 
          1007 | 
              $item->notforloan(1)->store();  | 
        
        
          | 1008 | 
              $docs = $see->marc_records_to_documents([$marc_record_1]);  | 
          1008 | 
              $docs = $see->marc_records_to_documents([$marc_record_1]);  | 
        
          
            
              | 1009 | 
                  is_deeply($docs->[0]->{available}, \0, 'a biblio with one item that is "notforloan" is not available'); | 
              1009 | 
                  is_deeply($docs->[0]->{available}, \1, 'a biblio with one item that is "notforloan" is available'); | 
            
        
          | 1010 | 
           | 
          1010 | 
           | 
        
        
          | 1011 | 
              $item->set({ notforloan => 0, onloan => '2022-03-03' })->store(); | 
          1011 | 
              $item->set({ notforloan => 0, onloan => '2022-03-03' })->store(); | 
        
        
          | 1012 | 
              $docs = $see->marc_records_to_documents([$marc_record_1]);  | 
          1012 | 
              $docs = $see->marc_records_to_documents([$marc_record_1]);  | 
        
  
    | 
      
            Lines 1014-1020
          subtest 'marc_records_to_documents should set the "available" field' => sub {
      
      
        Link Here
      
     | 
  
        
          | 1014 | 
           | 
          1014 | 
           | 
        
        
          | 1015 | 
              $item->set({ onloan => undef, withdrawn => 1 })->store(); | 
          1015 | 
              $item->set({ onloan => undef, withdrawn => 1 })->store(); | 
        
        
          | 1016 | 
              $docs = $see->marc_records_to_documents([$marc_record_1]);  | 
          1016 | 
              $docs = $see->marc_records_to_documents([$marc_record_1]);  | 
        
          
            
              | 1017 | 
                  is_deeply($docs->[0]->{available}, \0, 'a biblio with one item that is withdrawn is not available'); | 
              1017 | 
                  is_deeply($docs->[0]->{available}, \1, 'a biblio with one item that is withdrawn is available'); | 
            
        
          | 1018 | 
           | 
          1018 | 
           | 
        
        
          | 1019 | 
              $item->set({ withdrawn => 0, itemlost => 1 })->store(); | 
          1019 | 
              $item->set({ withdrawn => 0, itemlost => 1 })->store(); | 
        
        
          | 1020 | 
              $docs = $see->marc_records_to_documents([$marc_record_1]);  | 
          1020 | 
              $docs = $see->marc_records_to_documents([$marc_record_1]);  | 
        
  
    | 
      
            Lines 1022-1028
          subtest 'marc_records_to_documents should set the "available" field' => sub {
      
      
        Link Here
      
     | 
  
        
          | 1022 | 
           | 
          1022 | 
           | 
        
        
          | 1023 | 
              $item->set({ itemlost => 0, damaged => 1 })->store(); | 
          1023 | 
              $item->set({ itemlost => 0, damaged => 1 })->store(); | 
        
        
          | 1024 | 
              $docs = $see->marc_records_to_documents([$marc_record_1]);  | 
          1024 | 
              $docs = $see->marc_records_to_documents([$marc_record_1]);  | 
        
          
            
              | 1025 | 
                  is_deeply($docs->[0]->{available}, \0, 'a biblio with one item that is damaged is not available'); | 
              1025 | 
                  is_deeply($docs->[0]->{available}, \1, 'a biblio with one item that is damaged is available'); | 
            
        
          | 1026 | 
           | 
          1026 | 
           | 
        
        
          | 1027 | 
              my $item2 = Koha::Item->new({ | 
          1027 | 
              my $item2 = Koha::Item->new({ | 
        
        
          | 1028 | 
                  biblionumber => $biblionumber,  | 
          1028 | 
                  biblionumber => $biblionumber,  | 
        
            
              | 1029 | 
              -   | 
               | 
               |