|
Lines 1615-1620
sub opac_summary_html {
Link Here
|
| 1615 |
return $summary_html; |
1615 |
return $summary_html; |
| 1616 |
} |
1616 |
} |
| 1617 |
|
1617 |
|
|
|
1618 |
=head3 get_marc_volumes |
| 1619 |
|
| 1620 |
my $volumes = $self->get_marc_volumes(); |
| 1621 |
|
| 1622 |
Returns an array of MARCXML data, which are volumes parts of |
| 1623 |
this object (MARC21 773$w points to this) |
| 1624 |
|
| 1625 |
=cut |
| 1626 |
|
| 1627 |
sub get_marc_volumes { |
| 1628 |
my ($self, $max_results) = @_; |
| 1629 |
|
| 1630 |
return [] if (C4::Context->preference('marcflavour') ne 'MARC21'); |
| 1631 |
|
| 1632 |
my $searchstr = $self->get_volumes_query; |
| 1633 |
|
| 1634 |
if (defined($searchstr)) { |
| 1635 |
my $searcher = Koha::SearchEngine::Search->new({index => $Koha::SearchEngine::BIBLIOS_INDEX}); |
| 1636 |
my ( $errors, $results, $total_hits ) = $searcher->simple_search_compat( $searchstr, 0, $max_results ); |
| 1637 |
$self->{_volumes} = $results if ( defined($results) && scalar(@$results) ); |
| 1638 |
} |
| 1639 |
|
| 1640 |
return $self->{_volumes} || []; |
| 1641 |
} |
| 1642 |
|
| 1643 |
=head2 get_volumes_query |
| 1644 |
|
| 1645 |
Returns a query which can be used to search for all component parts of MARC21 biblios |
| 1646 |
|
| 1647 |
=cut |
| 1648 |
|
| 1649 |
sub get_volumes_query { |
| 1650 |
my ($self) = @_; |
| 1651 |
|
| 1652 |
my $marc = $self->metadata->record; |
| 1653 |
|
| 1654 |
my $searchstr; |
| 1655 |
if ( C4::Context->preference('UseControlNumber') ) { |
| 1656 |
my $pf001 = $marc->field('001') || undef; |
| 1657 |
|
| 1658 |
if ( defined($pf001) ) { |
| 1659 |
$searchstr = "("; |
| 1660 |
my $pf003 = $marc->field('003') || undef; |
| 1661 |
|
| 1662 |
if ( !defined($pf003) ) { |
| 1663 |
# search for 773$w='Host001' |
| 1664 |
$searchstr .= "rcn:" . $pf001->data(); |
| 1665 |
} |
| 1666 |
else { |
| 1667 |
$searchstr .= "("; |
| 1668 |
# search for (773$w='Host001' and 003='Host003') or 773$w='(Host003)Host001' |
| 1669 |
$searchstr .= "(rcn:" . $pf001->data() . " AND cni:" . $pf003->data() . ")"; |
| 1670 |
$searchstr .= " OR rcn:\"" . $pf003->data() . " " . $pf001->data() . "\""; |
| 1671 |
$searchstr .= ")"; |
| 1672 |
} |
| 1673 |
|
| 1674 |
# exclude monograph and serial component part records |
| 1675 |
$searchstr .= " NOT (bib-level:a OR bib-level:b)"; |
| 1676 |
$searchstr .= ")"; |
| 1677 |
} |
| 1678 |
} |
| 1679 |
else { |
| 1680 |
my $cleaned_title = $marc->title; |
| 1681 |
$cleaned_title =~ tr|/||; |
| 1682 |
$searchstr = "ti,phr:($cleaned_title)"; |
| 1683 |
} |
| 1684 |
|
| 1685 |
return $searchstr; |
| 1686 |
} |
| 1687 |
|
| 1618 |
=head2 Internal methods |
1688 |
=head2 Internal methods |
| 1619 |
|
1689 |
|
| 1620 |
=head3 type |
1690 |
=head3 type |