Bugzilla – Attachment 155681 Details for
Bug 26314
"Volumes: show volumes" showing regardless of whether there are volumes linked to the record
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 26314: (QA follow-up) Improve POD and fix links for UseControlNumber off
Bug-26314-QA-follow-up-Improve-POD-and-fix-links-f.patch (text/plain), 7.48 KB, created by
Katrin Fischer
on 2023-09-15 14:07:41 UTC
(
hide
)
Description:
Bug 26314: (QA follow-up) Improve POD and fix links for UseControlNumber off
Filename:
MIME Type:
Creator:
Katrin Fischer
Created:
2023-09-15 14:07:41 UTC
Size:
7.48 KB
patch
obsolete
>From 403753c40c2e08fa6ce965755f00b2c6ef52769e Mon Sep 17 00:00:00 2001 >From: Katrin Fischer <katrin.fischer@bsz-bw.de> >Date: Fri, 15 Sep 2023 13:55:07 +0000 >Subject: [PATCH] Bug 26314: (QA follow-up) Improve POD and fix links for > UseControlNumber off > >When UseControlNumber is off, we previously did a search on the title index, >but this was not actually correct. It might work when we have a dependent >title and the title also appears on 245$p, but there is a better way: > >The title of the set record will be found in: >* 773$3 for a dependent title >* 800/810/811/830 for an independent title > >The search indices to use are host-item and title-series. > >As we are not only looking for 773, POD was adjusted to reflect that. > >Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de> >--- > Koha/Biblio.pm | 10 ++++++---- > .../prog/en/xslt/MARC21slim2intranetDetail.xsl | 3 ++- > .../bootstrap/en/xslt/MARC21slim2OPACDetail.xsl | 3 ++- > t/db_dependent/Koha/Biblio.t | 7 ++++++- > 4 files changed, 16 insertions(+), 7 deletions(-) > >diff --git a/Koha/Biblio.pm b/Koha/Biblio.pm >index 3e3e0f0759..7f59056d30 100644 >--- a/Koha/Biblio.pm >+++ b/Koha/Biblio.pm >@@ -720,7 +720,7 @@ sub get_components_query { > my $volumes = $self->get_marc_volumes(); > > Returns an array of MARCXML data, which are volumes parts of >-this object (MARC21 773$w points to this) >+this object (MARC21 773$w or 8xx$w point to this) > > =cut > >@@ -759,6 +759,7 @@ sub get_volumes_query { > > # Only build volumes query if we're in a 'Set' record > # or we have a monographic series. >+ # For monographic series the check on LDR 7 in (b or i or s) is omitted > my $leader19 = substr( $marc->leader, 19, 1 ); > my $pf008 = $marc->field('008') || ''; > my $mseries = ( $pf008 && substr( $pf008->data(), 21, 1 ) eq 'm' ) ? 1 : 0; >@@ -776,12 +777,12 @@ sub get_volumes_query { > > if ( !defined($pf003) ) { > >- # search for 773$w='Host001' >+ # search for linking_field$w='Host001' > $searchstr .= "rcn:" . $pf001->data(); > } else { > $searchstr .= "("; > >- # search for (773$w='Host001' and 003='Host003') or 773$w='(Host003)Host001' >+ # search for (linking_field$w='Host001' and 003='Host003') or linking_field$w='(Host003)Host001' > $searchstr .= "(rcn:" . $pf001->data() . " AND cni:" . $pf003->data() . ")"; > $searchstr .= " OR rcn:\"" . $pf003->data() . " " . $pf001->data() . "\""; > $searchstr .= ")"; >@@ -795,7 +796,8 @@ sub get_volumes_query { > my $cleaned_title = $marc->subfield( '245', "a" ); > $cleaned_title =~ tr|/||; > $cleaned_title = $builder->clean_search_term($cleaned_title); >- $searchstr = "ti,phr:($cleaned_title)"; >+ $searchstr = qq#(title-series,phr:("$cleaned_title") OR Host-item,phr:("$cleaned_title")#; >+ $searchstr .= " NOT (bib-level:a OR bib-level:b))"; > } > > return $searchstr; >diff --git a/koha-tmpl/intranet-tmpl/prog/en/xslt/MARC21slim2intranetDetail.xsl b/koha-tmpl/intranet-tmpl/prog/en/xslt/MARC21slim2intranetDetail.xsl >index e4f1719fc7..4428d3f6ca 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/xslt/MARC21slim2intranetDetail.xsl >+++ b/koha-tmpl/intranet-tmpl/prog/en/xslt/MARC21slim2intranetDetail.xsl >@@ -232,6 +232,7 @@ > > <!-- Volumes of sets and traced series --> > <xsl:variable name="show_volumes_link" select="marc:variables/marc:variable[@name='show_volumes_link']" /> >+ <xsl:variable name="title" select="str:encode-uri(translate(marc:datafield[@tag=245]/marc:subfield[@code='a'], '/', ''), true())" /> > <xsl:if test="$show_volumes_link='1' and ($materialTypeCode='ST' or substring($controlField008,22,1)='m')"> > <span class="results_summary volumes"><span class="label">Volumes: </span> > <a> >@@ -240,7 +241,7 @@ > <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> > </xsl:when> > <xsl:otherwise> >- <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> >+ <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> > </xsl:otherwise> > </xsl:choose> > <xsl:text>Show volumes</xsl:text> >diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/xslt/MARC21slim2OPACDetail.xsl b/koha-tmpl/opac-tmpl/bootstrap/en/xslt/MARC21slim2OPACDetail.xsl >index 842f52e79e..047d56eae1 100644 >--- a/koha-tmpl/opac-tmpl/bootstrap/en/xslt/MARC21slim2OPACDetail.xsl >+++ b/koha-tmpl/opac-tmpl/bootstrap/en/xslt/MARC21slim2OPACDetail.xsl >@@ -274,6 +274,7 @@ > > <!-- Volumes of sets and traced series --> > <xsl:variable name="show_volumes_link" select="marc:variables/marc:variable[@name='show_volumes_link']" /> >+ <xsl:variable name="title" select="str:encode-uri(translate(marc:datafield[@tag=245]/marc:subfield[@code='a'], '/', ''), true())" /> > <xsl:if test="$show_volumes_link='1' and ($materialTypeCode='ST' or substring($controlField008,22,1)='m')"> > <span class="results_summary volumes"><span class="label">Volumes: </span> > <a> >@@ -282,7 +283,7 @@ > <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> > </xsl:when> > <xsl:otherwise> >- <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> >+ <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> > </xsl:otherwise> > </xsl:choose> > <xsl:text>Show volumes</xsl:text> >diff --git a/t/db_dependent/Koha/Biblio.t b/t/db_dependent/Koha/Biblio.t >index 87e917e7af..e88c6c3cb8 100755 >--- a/t/db_dependent/Koha/Biblio.t >+++ b/t/db_dependent/Koha/Biblio.t >@@ -630,7 +630,11 @@ subtest 'get_volumes_query' => sub { > $biblio = Koha::Biblios->find( $biblio->biblionumber ); > > t::lib::Mocks::mock_preference( 'UseControlNumber', '0' ); >- is( $biblio->get_volumes_query, "ti,phr:(Some boring read)", "UseControlNumber disabled" ); >+ is( >+ $biblio->get_volumes_query, >+ "(title-series,phr:(\"Some boring read\") OR Host-item,phr:(\"Some boring read\") NOT (bib-level:a OR bib-level:b))", >+ "UseControlNumber disabled" >+ ); > > t::lib::Mocks::mock_preference( 'UseControlNumber', '1' ); > my $marc_001_field = MARC::Field->new( '001', $biblionumber ); >@@ -638,6 +642,7 @@ subtest 'get_volumes_query' => sub { > C4::Biblio::ModBiblio( $record, $biblio->biblionumber ); > $biblio = Koha::Biblios->find( $biblio->biblionumber ); > >+ > is( > $biblio->get_volumes_query, "(rcn:$biblionumber NOT (bib-level:a OR bib-level:b))", > "UseControlNumber enabled without MarcOrgCode" >-- >2.30.2
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 26314
:
123615
|
124367
|
124380
|
124381
|
126448
|
126449
|
126450
|
126952
|
126953
|
126954
|
126955
|
155437
|
155438
|
155439
|
155440
|
155441
|
155446
|
155447
|
155448
|
155449
|
155450
|
155670
|
155671
|
155672
|
155673
|
155674
|
155675
|
155676
|
155677
|
155678
|
155679
|
155680
| 155681 |
162163
|
162164