Bugzilla – Attachment 144416 Details for
Bug 31326
Koha::Biblio->get_components_query fetches too many component parts
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 31326: Koha::Biblio->get_components_query fetches too many component parts
Bug-31326-KohaBiblio-getcomponentsquery-fetches-to.patch (text/plain), 3.15 KB, created by
David Nind
on 2022-12-04 02:13:18 UTC
(
hide
)
Description:
Bug 31326: Koha::Biblio->get_components_query fetches too many component parts
Filename:
MIME Type:
Creator:
David Nind
Created:
2022-12-04 02:13:18 UTC
Size:
3.15 KB
patch
obsolete
>From abf21861b23e4ce21a4b81619cbed83b5648c296 Mon Sep 17 00:00:00 2001 >From: Johanna Raisa <johanna.raisa@gmail.com> >Date: Tue, 9 Aug 2022 11:58:59 +0300 >Subject: [PATCH] Bug 31326: Koha::Biblio->get_components_query fetches too > many component parts > >This patch adds double quotes to rcn and cni when searching component parts >with get_components_query. > >Test plan: >1) Apply the patch >2) prove Koha/t/db_dependent/Koha/Biblio.t > >Sponsored-by: Koha-Suomi Oy > >Signed-off-by: David Nind <david@davidnind.com> >--- > Koha/Biblio.pm | 4 ++-- > t/db_dependent/Koha/Biblio.t | 4 ++-- > 2 files changed, 4 insertions(+), 4 deletions(-) > >diff --git a/Koha/Biblio.pm b/Koha/Biblio.pm >index 5b7541a36e..b696325472 100644 >--- a/Koha/Biblio.pm >+++ b/Koha/Biblio.pm >@@ -595,12 +595,12 @@ sub get_components_query { > > if ( !defined($pf003) ) { > # search for 773$w='Host001' >- $searchstr .= "rcn:" . $pf001->data(); >+ $searchstr .= "rcn:\"" . $pf001->data()."\""; > } > else { > $searchstr .= "("; > # search for (773$w='Host001' and 003='Host003') or 773$w='(Host003)Host001' >- $searchstr .= "(rcn:" . $pf001->data() . " AND cni:" . $pf003->data() . ")"; >+ $searchstr .= "(rcn:\"" . $pf001->data() . "\" AND cni:\"" . $pf003->data() . "\")"; > $searchstr .= " OR rcn:\"" . $pf003->data() . " " . $pf001->data() . "\""; > $searchstr .= ")"; > } >diff --git a/t/db_dependent/Koha/Biblio.t b/t/db_dependent/Koha/Biblio.t >index ac9fcd0466..67513cd09f 100755 >--- a/t/db_dependent/Koha/Biblio.t >+++ b/t/db_dependent/Koha/Biblio.t >@@ -586,7 +586,7 @@ subtest 'get_components_query' => sub { > $biblio = Koha::Biblios->find( $biblio->biblionumber); > > ( $comp_query, $comp_query_str, $comp_sort ) = $biblio->get_components_query; >- is($comp_query_str, "(rcn:$biblionumber AND (bib-level:a OR bib-level:b))", "$engine: UseControlNumber enabled without MarcOrgCode"); >+ is($comp_query_str, "(rcn:\"$biblionumber\" AND (bib-level:a OR bib-level:b))", "$engine: UseControlNumber enabled without MarcOrgCode"); > is($comp_sort, "author_az", "$engine: UseControlNumber enabled without MarcOrgCode sort is correct"); > > my $marc_003_field = MARC::Field->new('003', 'OSt'); >@@ -597,7 +597,7 @@ subtest 'get_components_query' => sub { > t::lib::Mocks::mock_preference( 'ComponentSortField', 'title' ); > t::lib::Mocks::mock_preference( 'ComponentSortOrder', 'asc' ); > ( $comp_query, $comp_query_str, $comp_sort ) = $biblio->get_components_query; >- is($comp_query_str, "(((rcn:$biblionumber AND cni:OSt) OR rcn:\"OSt $biblionumber\") AND (bib-level:a OR bib-level:b))", "$engine: UseControlNumber enabled with MarcOrgCode"); >+ is($comp_query_str, "(((rcn:\"$biblionumber\" AND cni:\"OSt\") OR rcn:\"OSt $biblionumber\") AND (bib-level:a OR bib-level:b))", "$engine: UseControlNumber enabled with MarcOrgCode"); > is($comp_sort, "title_asc", "$engine: UseControlNumber enabled with MarcOrgCode sort if correct"); > $record->delete_field($marc_003_field); > } >-- >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 31326
:
138886
|
144398
|
144416
|
145513