| 
      
            Lines 470-480
          Returns the related Koha::Items object for this biblio
      
      
        Link Here
      
     | 
  
        
          | 470 | 
          =cut  | 
          470 | 
          =cut  | 
        
        
          | 471 | 
           | 
          471 | 
           | 
        
        
          | 472 | 
          sub items { | 
          472 | 
          sub items { | 
        
          
            
              | 473 | 
                  my ($self) = @_;  | 
              473 | 
                  my ($self,$params) = @_;  | 
            
        
          | 474 | 
           | 
          474 | 
           | 
        
        
          | 475 | 
              my $items_rs = $self->_result->items;  | 
          475 | 
              my $items_rs = $self->_result->items;  | 
        
        
          | 476 | 
           | 
          476 | 
           | 
        
          
            
              | 477 | 
                  return Koha::Items->_new_from_dbic( $items_rs );  | 
              477 | 
                  return Koha::Items->_new_from_dbic( $items_rs ) unless $params->{host_items}; | 
            
            
               | 
               | 
              478 | 
               | 
            
            
              | 479 | 
                  my $host_itemnumbers = $self->_host_itemnumbers();  | 
            
            
              | 480 | 
                  my $params = { -or => [biblionumber => $self->id] }; | 
            
            
              | 481 | 
                  push @{$params->{'-or'}}, itemnumber => { -in => $host_itemnumbers } if $host_itemnumbers; | 
            
            
              | 482 | 
               | 
            
            
              | 483 | 
                  return Koha::Items->search($params);  | 
            
        
          | 478 | 
          }  | 
          484 | 
          }  | 
        
        
          | 479 | 
           | 
          485 | 
           | 
        
        
          | 480 | 
          =head3 host_items  | 
          486 | 
          =head3 host_items  | 
        
  
    | 
      
            Lines 491-502
          sub host_items {
      
      
        Link Here
      
     | 
  
        
          | 491 | 
              return Koha::Items->new->empty  | 
          497 | 
              return Koha::Items->new->empty  | 
        
        
          | 492 | 
                unless C4::Context->preference('EasyAnalyticalRecords'); | 
          498 | 
                unless C4::Context->preference('EasyAnalyticalRecords'); | 
        
        
          | 493 | 
           | 
          499 | 
           | 
        
            
               | 
               | 
              500 | 
                  my $host_itemnumbers = $self->_host_itemnumbers;  | 
            
            
              | 501 | 
               | 
            
            
              | 502 | 
                  return Koha::Items->search( { itemnumber => { -in => $host_itemnumbers } } ); | 
            
            
              | 503 | 
              }  | 
            
            
              | 504 | 
               | 
            
            
              | 505 | 
              =head3 _host_itemnumbers  | 
            
            
              | 506 | 
               | 
            
            
              | 507 | 
              my $host_itemnumber = $biblio->_host_itemnumbers();  | 
            
            
              | 508 | 
               | 
            
            
              | 509 | 
              Return the itemnumbers for analytical items on this record  | 
            
            
              | 510 | 
               | 
            
            
              | 511 | 
              =cut  | 
            
            
              | 512 | 
               | 
            
            
              | 513 | 
              sub _host_itemnumbers { | 
            
            
              | 514 | 
                  my ($self) = @_;  | 
            
            
              | 515 | 
               | 
            
        
          | 494 | 
              my $marcflavour = C4::Context->preference("marcflavour"); | 
          516 | 
              my $marcflavour = C4::Context->preference("marcflavour"); | 
        
        
          | 495 | 
              my $analyticfield = '773';  | 
          517 | 
              my $analyticfield = '773';  | 
        
          
            
              | 496 | 
                  if ( $marcflavour eq 'MARC21' ) { | 
              518 | 
                  if ( $marcflavour eq 'UNIMARC' ) { | 
            
            
              | 497 | 
                      $analyticfield = '773';  | 
               | 
               | 
            
            
              | 498 | 
                  }  | 
            
            
              | 499 | 
                  elsif ( $marcflavour eq 'UNIMARC' ) { | 
            
        
          | 500 | 
                  $analyticfield = '461';  | 
          519 | 
                  $analyticfield = '461';  | 
        
        
          | 501 | 
              }  | 
          520 | 
              }  | 
        
        
          | 502 | 
              my $marc_record = $self->metadata->record;  | 
          521 | 
              my $marc_record = $self->metadata->record;  | 
        
  
    | 
      
            Lines 504-513
          sub host_items {
      
      
        Link Here
      
     | 
  
        
          | 504 | 
              foreach my $field ( $marc_record->field($analyticfield) ) { | 
          523 | 
              foreach my $field ( $marc_record->field($analyticfield) ) { | 
        
        
          | 505 | 
                  push @itemnumbers, $field->subfield('9'); | 
          524 | 
                  push @itemnumbers, $field->subfield('9'); | 
        
        
          | 506 | 
              }  | 
          525 | 
              }  | 
        
          
            
              | 507 | 
               | 
              526 | 
                  return \@itemnumbers;  | 
            
            
              | 508 | 
                  return Koha::Items->search( { itemnumber => { -in => \@itemnumbers } } ); | 
               | 
               | 
            
        
          | 509 | 
          }  | 
          527 | 
          }  | 
        
        
          | 510 | 
           | 
          528 | 
           | 
        
            
               | 
               | 
              529 | 
               | 
            
        
          | 511 | 
          =head3 itemtype  | 
          530 | 
          =head3 itemtype  | 
        
        
          | 512 | 
           | 
          531 | 
           | 
        
        
          | 513 | 
          my $itemtype = $biblio->itemtype();  | 
          532 | 
          my $itemtype = $biblio->itemtype();  |