|
Lines 511-543
sub components {
Link Here
|
| 511 |
|
511 |
|
| 512 |
return if (C4::Context->preference('marcflavour') ne 'MARC21'); |
512 |
return if (C4::Context->preference('marcflavour') ne 'MARC21'); |
| 513 |
|
513 |
|
| 514 |
if (!defined($self->{_components})) { |
514 |
my $marc = C4::Biblio::GetMarcBiblio({ biblionumber => $self->id }); |
| 515 |
my $marc = C4::Biblio::GetMarcBiblio({ biblionumber => $self->id }); |
515 |
my $pf001 = $marc->field('001') || undef; |
| 516 |
my $pf001 = $marc->field('001') || undef; |
516 |
my $searcher = Koha::SearchEngine::Search->new({index => $Koha::SearchEngine::BIBLIOS_INDEX}); |
| 517 |
my $searcher = Koha::SearchEngine::Search->new({index => $Koha::SearchEngine::BIBLIOS_INDEX}); |
|
|
| 518 |
|
| 519 |
if (defined($pf001)) { |
| 520 |
my $pf003 = $marc->field('003') || undef; |
| 521 |
my $searchstr; |
| 522 |
|
| 523 |
if (!defined($pf003)) { |
| 524 |
# search for 773$w='Host001' |
| 525 |
$searchstr = "rcn='".$pf001->data()."'"; |
| 526 |
} else { |
| 527 |
# search for (773$w='Host001' and 003='Host003') or 773$w='Host003 Host001') |
| 528 |
$searchstr = "(rcn='".$pf001->data()."' and cni='".$pf003->data()."')"; |
| 529 |
$searchstr .= " or rcn='".$pf003->data()." ".$pf001->data()."'"; |
| 530 |
} |
| 531 |
|
517 |
|
| 532 |
my ( $errors, $results, $total_hits ) = $searcher->simple_search_compat( $searchstr, 0, undef ); |
518 |
if (defined($pf001)) { |
|
|
519 |
my $pf003 = $marc->field('003') || undef; |
| 520 |
my $searchstr; |
| 533 |
|
521 |
|
| 534 |
$self->{_components} = $results if ( defined($results) && scalar(@$results) ); |
522 |
if (!defined($pf003)) { |
|
|
523 |
# search for 773$w='Host001' |
| 524 |
$searchstr = "rcn='".$pf001->data()."'"; |
| 535 |
} else { |
525 |
} else { |
| 536 |
warn "Record $self->id has no 001"; |
526 |
# search for (773$w='Host001' and 003='Host003') or 773$w='Host003 Host001') |
|
|
527 |
$searchstr = "(rcn='".$pf001->data()."' and cni='".$pf003->data()."')"; |
| 528 |
$searchstr .= " or rcn='".$pf003->data()." ".$pf001->data()."'"; |
| 537 |
} |
529 |
} |
|
|
530 |
|
| 531 |
my ( $errors, $results, $total_hits ) = $searcher->simple_search_compat( $searchstr, 0, undef ); |
| 532 |
|
| 533 |
$self->{_components} = $results if ( defined($results) && scalar(@$results) ); |
| 534 |
} else { |
| 535 |
warn "Record $self->id has no 001"; |
| 538 |
} |
536 |
} |
| 539 |
|
537 |
|
| 540 |
return $self->{_components}; |
538 |
return $self->{_components} || (); |
| 541 |
} |
539 |
} |
| 542 |
|
540 |
|
| 543 |
=head3 subscriptions |
541 |
=head3 subscriptions |
| 544 |
- |
|
|