|
Lines 429-439
Returns the related Koha::Items object for this biblio
Link Here
|
| 429 |
=cut |
429 |
=cut |
| 430 |
|
430 |
|
| 431 |
sub items { |
431 |
sub items { |
| 432 |
my ($self) = @_; |
432 |
my ($self,$params) = @_; |
| 433 |
|
433 |
|
| 434 |
my $items_rs = $self->_result->items; |
434 |
my $items_rs = $self->_result->items; |
| 435 |
|
435 |
|
| 436 |
return Koha::Items->_new_from_dbic( $items_rs ); |
436 |
return Koha::Items->_new_from_dbic( $items_rs ) unless $params->{host_items}; |
|
|
437 |
|
| 438 |
my $host_itemnumbers = $self->_host_itemnumbers(); |
| 439 |
my $params = { -or => [biblionumber => $self->id] }; |
| 440 |
push @{$params->{'-or'}}, itemnumber => { -in => $host_itemnumbers } if $host_itemnumbers; |
| 441 |
|
| 442 |
return Koha::Items->search($params); |
| 437 |
} |
443 |
} |
| 438 |
|
444 |
|
| 439 |
=head3 host_items |
445 |
=head3 host_items |
|
Lines 450-461
sub host_items {
Link Here
|
| 450 |
return Koha::Items->new->empty |
456 |
return Koha::Items->new->empty |
| 451 |
unless C4::Context->preference('EasyAnalyticalRecords'); |
457 |
unless C4::Context->preference('EasyAnalyticalRecords'); |
| 452 |
|
458 |
|
|
|
459 |
my $host_itemnumbers = $self->_host_itemnumbers; |
| 460 |
|
| 461 |
return Koha::Items->search( { itemnumber => { -in => $host_itemnumbers } } ); |
| 462 |
} |
| 463 |
|
| 464 |
=head3 _host_itemnumbers |
| 465 |
|
| 466 |
my $host_itemnumber = $biblio->_host_itemnumbers(); |
| 467 |
|
| 468 |
Return the itemnumbers for analytical items on this record |
| 469 |
|
| 470 |
=cut |
| 471 |
|
| 472 |
sub _host_itemnumbers { |
| 473 |
my ($self) = @_; |
| 474 |
|
| 453 |
my $marcflavour = C4::Context->preference("marcflavour"); |
475 |
my $marcflavour = C4::Context->preference("marcflavour"); |
| 454 |
my $analyticfield = '773'; |
476 |
my $analyticfield = '773'; |
| 455 |
if ( $marcflavour eq 'MARC21' ) { |
477 |
if ( $marcflavour eq 'UNIMARC' ) { |
| 456 |
$analyticfield = '773'; |
|
|
| 457 |
} |
| 458 |
elsif ( $marcflavour eq 'UNIMARC' ) { |
| 459 |
$analyticfield = '461'; |
478 |
$analyticfield = '461'; |
| 460 |
} |
479 |
} |
| 461 |
my $marc_record = $self->metadata->record; |
480 |
my $marc_record = $self->metadata->record; |
|
Lines 463-472
sub host_items {
Link Here
|
| 463 |
foreach my $field ( $marc_record->field($analyticfield) ) { |
482 |
foreach my $field ( $marc_record->field($analyticfield) ) { |
| 464 |
push @itemnumbers, $field->subfield('9'); |
483 |
push @itemnumbers, $field->subfield('9'); |
| 465 |
} |
484 |
} |
| 466 |
|
485 |
return \@itemnumbers; |
| 467 |
return Koha::Items->search( { itemnumber => { -in => \@itemnumbers } } ); |
|
|
| 468 |
} |
486 |
} |
| 469 |
|
487 |
|
|
|
488 |
|
| 470 |
=head3 itemtype |
489 |
=head3 itemtype |
| 471 |
|
490 |
|
| 472 |
my $itemtype = $biblio->itemtype(); |
491 |
my $itemtype = $biblio->itemtype(); |