Lines 728-747
this object (MARC21 773$w or 8xx$w point to this)
Link Here
|
728 |
sub get_marc_volumes { |
728 |
sub get_marc_volumes { |
729 |
my ( $self, $max_results ) = @_; |
729 |
my ( $self, $max_results ) = @_; |
730 |
|
730 |
|
731 |
return $self->{_volumes} if defined( $self->{_volumes} ); |
731 |
return [] if ( C4::Context->preference('marcflavour') ne 'MARC21' ); |
732 |
|
732 |
|
733 |
my $searchstr = $self->get_volumes_query; |
733 |
my $searchstr = $self->get_volumes_query; |
734 |
|
734 |
|
|
|
735 |
my $volumes; |
735 |
if ( defined($searchstr) ) { |
736 |
if ( defined($searchstr) ) { |
736 |
my $searcher = Koha::SearchEngine::Search->new( { index => $Koha::SearchEngine::BIBLIOS_INDEX } ); |
737 |
my $searcher = Koha::SearchEngine::Search->new( { index => $Koha::SearchEngine::BIBLIOS_INDEX } ); |
737 |
my ( $errors, $results, $total_hits ) = $searcher->simple_search_compat( $searchstr, 0, $max_results ); |
738 |
my ( $errors, $results, $total_hits ); |
738 |
$self->{_volumes} = |
739 |
eval { ( $errors, $results, $total_hits ) = $searcher->simple_search_compat( $searchstr, 0, $max_results ); }; |
739 |
( defined($results) && scalar(@$results) ) ? $results : []; |
740 |
if ( $error || $@ ) { |
740 |
} else { |
741 |
$error //= q{}; |
741 |
$self->{_volumes} = []; |
742 |
$error .= $@ if $@; |
|
|
743 |
warn "Warning from search_compat: '$error'"; |
744 |
$self->add_message( |
745 |
{ |
746 |
type => 'error', |
747 |
message => 'volume_search', |
748 |
payload => $error, |
749 |
} |
750 |
); |
751 |
} |
752 |
$volumes = ( defined($results) && scalar(@$results) ) ? $results : []; |
742 |
} |
753 |
} |
743 |
|
754 |
|
744 |
return $self->{_volumes}; |
755 |
return $volumes // []; |
745 |
} |
756 |
} |
746 |
|
757 |
|
747 |
=head2 get_volumes_query |
758 |
=head2 get_volumes_query |
748 |
- |
|
|