View | Details | Raw Unified | Return to bug 26314
Collapse All | Expand All

(-)a/Koha/Biblio.pm (-4 / +6 lines)
Lines 720-726 sub get_components_query { Link Here
720
  my $volumes = $self->get_marc_volumes();
720
  my $volumes = $self->get_marc_volumes();
721
721
722
Returns an array of MARCXML data, which are volumes parts of
722
Returns an array of MARCXML data, which are volumes parts of
723
this object (MARC21 773$w points to this)
723
this object (MARC21 773$w or 8xx$w point to this)
724
724
725
=cut
725
=cut
726
726
Lines 759-764 sub get_volumes_query { Link Here
759
759
760
    # Only build volumes query if we're in a 'Set' record
760
    # Only build volumes query if we're in a 'Set' record
761
    # or we have a monographic series.
761
    # or we have a monographic series.
762
    # For monographic series the check on LDR 7 in (b or i or s) is omitted
762
    my $leader19 = substr( $marc->leader, 19, 1 );
763
    my $leader19 = substr( $marc->leader, 19, 1 );
763
    my $pf008    = $marc->field('008') || '';
764
    my $pf008    = $marc->field('008') || '';
764
    my $mseries  = ( $pf008 && substr( $pf008->data(), 21, 1 ) eq 'm' ) ? 1 : 0;
765
    my $mseries  = ( $pf008 && substr( $pf008->data(), 21, 1 ) eq 'm' ) ? 1 : 0;
Lines 776-787 sub get_volumes_query { Link Here
776
777
777
            if ( !defined($pf003) ) {
778
            if ( !defined($pf003) ) {
778
779
779
                # search for 773$w='Host001'
780
                # search for linking_field$w='Host001'
780
                $searchstr .= "rcn:" . $pf001->data();
781
                $searchstr .= "rcn:" . $pf001->data();
781
            } else {
782
            } else {
782
                $searchstr .= "(";
783
                $searchstr .= "(";
783
784
784
                # search for (773$w='Host001' and 003='Host003') or 773$w='(Host003)Host001'
785
                # search for (linking_field$w='Host001' and 003='Host003') or linking_field$w='(Host003)Host001'
785
                $searchstr .= "(rcn:" . $pf001->data() . " AND cni:" . $pf003->data() . ")";
786
                $searchstr .= "(rcn:" . $pf001->data() . " AND cni:" . $pf003->data() . ")";
786
                $searchstr .= " OR rcn:\"" . $pf003->data() . " " . $pf001->data() . "\"";
787
                $searchstr .= " OR rcn:\"" . $pf003->data() . " " . $pf001->data() . "\"";
787
                $searchstr .= ")";
788
                $searchstr .= ")";
Lines 795-801 sub get_volumes_query { Link Here
795
        my $cleaned_title = $marc->subfield( '245', "a" );
796
        my $cleaned_title = $marc->subfield( '245', "a" );
796
        $cleaned_title =~ tr|/||;
797
        $cleaned_title =~ tr|/||;
797
        $cleaned_title = $builder->clean_search_term($cleaned_title);
798
        $cleaned_title = $builder->clean_search_term($cleaned_title);
798
        $searchstr     = "ti,phr:($cleaned_title)";
799
        $searchstr     = qq#(title-series,phr:("$cleaned_title") OR Host-item,phr:("$cleaned_title")#;
800
        $searchstr .= " NOT (bib-level:a OR bib-level:b))";
799
    }
801
    }
800
802
801
    return $searchstr;
803
    return $searchstr;
(-)a/koha-tmpl/intranet-tmpl/prog/en/xslt/MARC21slim2intranetDetail.xsl (-1 / +2 lines)
Lines 232-237 Link Here
232
232
233
        <!-- Volumes of sets and traced series -->
233
        <!-- Volumes of sets and traced series -->
234
        <xsl:variable name="show_volumes_link" select="marc:variables/marc:variable[@name='show_volumes_link']" />
234
        <xsl:variable name="show_volumes_link" select="marc:variables/marc:variable[@name='show_volumes_link']" />
235
        <xsl:variable name="title" select="str:encode-uri(translate(marc:datafield[@tag=245]/marc:subfield[@code='a'], '/', ''), true())" />
235
        <xsl:if test="$show_volumes_link='1' and ($materialTypeCode='ST' or substring($controlField008,22,1)='m')">
236
        <xsl:if test="$show_volumes_link='1' and ($materialTypeCode='ST' or substring($controlField008,22,1)='m')">
236
        <span class="results_summary volumes"><span class="label">Volumes: </span>
237
        <span class="results_summary volumes"><span class="label">Volumes: </span>
237
            <a>
238
            <a>
Lines 240-246 Link Here
240
                <xsl:attribute name="href">/cgi-bin/koha/catalogue/search.pl?q=rcn:<xsl:value-of select="str:encode-uri(marc:controlfield[@tag=001], true())"/>+NOT+(bib-level:a+OR+bib-level:b)</xsl:attribute>
241
                <xsl:attribute name="href">/cgi-bin/koha/catalogue/search.pl?q=rcn:<xsl:value-of select="str:encode-uri(marc:controlfield[@tag=001], true())"/>+NOT+(bib-level:a+OR+bib-level:b)</xsl:attribute>
241
            </xsl:when>
242
            </xsl:when>
242
            <xsl:otherwise>
243
            <xsl:otherwise>
243
                <xsl:attribute name="href">/cgi-bin/koha/catalogue/search.pl?q=ti,phr:<xsl:value-of select="str:encode-uri(translate(marc:datafield[@tag=245]/marc:subfield[@code='a'], '/', ''), true())"/></xsl:attribute>
244
                <xsl:attribute name="href">/cgi-bin/koha/catalogue/search.pl?q=title-series,phr:"<xsl:value-of select="$title"/>"+OR+host-item,phr="<xsl:value-of select="$title"/>"+NOT+(bib-level:a+OR+bib-level:b)</xsl:attribute>
244
            </xsl:otherwise>
245
            </xsl:otherwise>
245
            </xsl:choose>
246
            </xsl:choose>
246
            <xsl:text>Show volumes</xsl:text>
247
            <xsl:text>Show volumes</xsl:text>
(-)a/koha-tmpl/opac-tmpl/bootstrap/en/xslt/MARC21slim2OPACDetail.xsl (-1 / +2 lines)
Lines 274-279 Link Here
274
274
275
        <!-- Volumes of sets and traced series -->
275
        <!-- Volumes of sets and traced series -->
276
        <xsl:variable name="show_volumes_link" select="marc:variables/marc:variable[@name='show_volumes_link']" />
276
        <xsl:variable name="show_volumes_link" select="marc:variables/marc:variable[@name='show_volumes_link']" />
277
        <xsl:variable name="title" select="str:encode-uri(translate(marc:datafield[@tag=245]/marc:subfield[@code='a'], '/', ''), true())" />
277
        <xsl:if test="$show_volumes_link='1' and ($materialTypeCode='ST' or substring($controlField008,22,1)='m')">
278
        <xsl:if test="$show_volumes_link='1' and ($materialTypeCode='ST' or substring($controlField008,22,1)='m')">
278
        <span class="results_summary volumes"><span class="label">Volumes: </span>
279
        <span class="results_summary volumes"><span class="label">Volumes: </span>
279
            <a>
280
            <a>
Lines 282-288 Link Here
282
                <xsl:attribute name="href">/cgi-bin/koha/opac-search.pl?q=rcn:<xsl:value-of select="str:encode-uri(marc:controlfield[@tag=001], true())"/>+NOT+(bib-level:a+OR+bib-level:b)</xsl:attribute>
283
                <xsl:attribute name="href">/cgi-bin/koha/opac-search.pl?q=rcn:<xsl:value-of select="str:encode-uri(marc:controlfield[@tag=001], true())"/>+NOT+(bib-level:a+OR+bib-level:b)</xsl:attribute>
283
            </xsl:when>
284
            </xsl:when>
284
            <xsl:otherwise>
285
            <xsl:otherwise>
285
                <xsl:attribute name="href">/cgi-bin/koha/opac-search.pl?q=ti,phr:<xsl:value-of select="str:encode-uri(translate(marc:datafield[@tag=245]/marc:subfield[@code='a'], '/', ''), true())"/></xsl:attribute>
286
                <xsl:attribute name="href">/cgi-bin/koha/opac-search.pl?q=ti,phr:"<xsl:value-of select="$title"/>"+OR+host-item,phr="<xsl:value-of select="$title"/>"+NOT+(bib-level:a+OR+bib-level:b)</xsl:attribute>
286
            </xsl:otherwise>
287
            </xsl:otherwise>
287
            </xsl:choose>
288
            </xsl:choose>
288
            <xsl:text>Show volumes</xsl:text>
289
            <xsl:text>Show volumes</xsl:text>
(-)a/t/db_dependent/Koha/Biblio.t (-2 / +6 lines)
Lines 630-636 subtest 'get_volumes_query' => sub { Link Here
630
    $biblio = Koha::Biblios->find( $biblio->biblionumber );
630
    $biblio = Koha::Biblios->find( $biblio->biblionumber );
631
631
632
    t::lib::Mocks::mock_preference( 'UseControlNumber', '0' );
632
    t::lib::Mocks::mock_preference( 'UseControlNumber', '0' );
633
    is( $biblio->get_volumes_query, "ti,phr:(Some boring read)", "UseControlNumber disabled" );
633
    is(
634
        $biblio->get_volumes_query,
635
        "(title-series,phr:(\"Some boring read\") OR Host-item,phr:(\"Some boring read\") NOT (bib-level:a OR bib-level:b))",
636
        "UseControlNumber disabled"
637
    );
634
638
635
    t::lib::Mocks::mock_preference( 'UseControlNumber', '1' );
639
    t::lib::Mocks::mock_preference( 'UseControlNumber', '1' );
636
    my $marc_001_field = MARC::Field->new( '001', $biblionumber );
640
    my $marc_001_field = MARC::Field->new( '001', $biblionumber );
Lines 638-643 subtest 'get_volumes_query' => sub { Link Here
638
    C4::Biblio::ModBiblio( $record, $biblio->biblionumber );
642
    C4::Biblio::ModBiblio( $record, $biblio->biblionumber );
639
    $biblio = Koha::Biblios->find( $biblio->biblionumber );
643
    $biblio = Koha::Biblios->find( $biblio->biblionumber );
640
644
645
641
    is(
646
    is(
642
        $biblio->get_volumes_query, "(rcn:$biblionumber NOT (bib-level:a OR bib-level:b))",
647
        $biblio->get_volumes_query, "(rcn:$biblionumber NOT (bib-level:a OR bib-level:b))",
643
        "UseControlNumber enabled without MarcOrgCode"
648
        "UseControlNumber enabled without MarcOrgCode"
644
- 

Return to bug 26314