Lines 492-524
sub components {
Link Here
|
492 |
|
492 |
|
493 |
return if (C4::Context->preference('marcflavour') ne 'MARC21'); |
493 |
return if (C4::Context->preference('marcflavour') ne 'MARC21'); |
494 |
|
494 |
|
495 |
if (!defined($self->{_components})) { |
495 |
my $marc = C4::Biblio::GetMarcBiblio({ biblionumber => $self->id }); |
496 |
my $marc = C4::Biblio::GetMarcBiblio({ biblionumber => $self->id }); |
496 |
my $pf001 = $marc->field('001') || undef; |
497 |
my $pf001 = $marc->field('001') || undef; |
497 |
my $searcher = Koha::SearchEngine::Search->new({index => $Koha::SearchEngine::BIBLIOS_INDEX}); |
498 |
my $searcher = Koha::SearchEngine::Search->new({index => $Koha::SearchEngine::BIBLIOS_INDEX}); |
|
|
499 |
|
500 |
if (defined($pf001)) { |
501 |
my $pf003 = $marc->field('003') || undef; |
502 |
my $searchstr; |
503 |
|
504 |
if (!defined($pf003)) { |
505 |
# search for 773$w='Host001' |
506 |
$searchstr = "rcn='".$pf001->data()."'"; |
507 |
} else { |
508 |
# search for (773$w='Host001' and 003='Host003') or 773$w='Host003 Host001') |
509 |
$searchstr = "(rcn='".$pf001->data()."' and cni='".$pf003->data()."')"; |
510 |
$searchstr .= " or rcn='".$pf003->data()." ".$pf001->data()."'"; |
511 |
} |
512 |
|
498 |
|
513 |
my ( $errors, $results, $total_hits ) = $searcher->simple_search_compat( $searchstr, 0, undef ); |
499 |
if (defined($pf001)) { |
|
|
500 |
my $pf003 = $marc->field('003') || undef; |
501 |
my $searchstr; |
514 |
|
502 |
|
515 |
$self->{_components} = $results if ( defined($results) && scalar(@$results) ); |
503 |
if (!defined($pf003)) { |
|
|
504 |
# search for 773$w='Host001' |
505 |
$searchstr = "rcn='".$pf001->data()."'"; |
516 |
} else { |
506 |
} else { |
517 |
warn "Record $self->id has no 001"; |
507 |
# search for (773$w='Host001' and 003='Host003') or 773$w='Host003 Host001') |
|
|
508 |
$searchstr = "(rcn='".$pf001->data()."' and cni='".$pf003->data()."')"; |
509 |
$searchstr .= " or rcn='".$pf003->data()." ".$pf001->data()."'"; |
518 |
} |
510 |
} |
|
|
511 |
|
512 |
my ( $errors, $results, $total_hits ) = $searcher->simple_search_compat( $searchstr, 0, undef ); |
513 |
|
514 |
$self->{_components} = $results if ( defined($results) && scalar(@$results) ); |
515 |
} else { |
516 |
warn "Record $self->id has no 001"; |
519 |
} |
517 |
} |
520 |
|
518 |
|
521 |
return $self->{_components}; |
519 |
return $self->{_components} || (); |
522 |
} |
520 |
} |
523 |
|
521 |
|
524 |
=head3 subscriptions |
522 |
=head3 subscriptions |
525 |
- |
|
|