Bug 30865: Double-quote Host-item in Koha::Biblio->get_components_query
This patch adds double quotes around the term qualified by "Host-item"
in Koha::Biblio->get_components_query().
Without them, reserved charactrs like "=" will cause syntax errors like
"CCL parsing error (10014) Unknown qualifier ZOOM for query:
Host-item=(MyTitle = Mysubtitle)
at /usr/share/koha/lib/C4/Search.pm line 245."
Test plan:
0) Don't apply the patch
1) Create biblio with title and subtitle like (MyTitle : MySubtitle)
2) Note the warning "There was an error searching for analytic records,
please see the logs for details." on the detail page
3) Apply the patch
4) koha-plack --restart kohadev
5) Refresh the detail page
6) Note that the warning message is gone
7) prove t/db_dependent/Koha/Biblio.t
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
This commit is contained in:
parent
029d7bacf0
commit
fd385d90b8
|
|
@ -598,7 +598,7 @@ sub get_components_query {
|
|||
my $cleaned_title = $marc->subfield('245', "a");
|
||||
$cleaned_title =~ tr|/||;
|
||||
$cleaned_title = $builder->clean_search_term($cleaned_title);
|
||||
$searchstr = "Host-item:($cleaned_title)";
|
||||
$searchstr = qq#Host-item:("$cleaned_title")#;
|
||||
}
|
||||
my ($error, $query_str) = $builder->build_query_compat( undef, [$searchstr], undef, undef, [$sort], 0 );
|
||||
if( $error ){
|
||||
|
|
|
|||
|
|
@ -572,7 +572,7 @@ subtest 'get_components_query' => sub {
|
|||
t::lib::Mocks::mock_preference( 'ComponentSortField', 'author' );
|
||||
t::lib::Mocks::mock_preference( 'ComponentSortOrder', 'za' );
|
||||
my ( $comp_q, $comp_s ) = $biblio->get_components_query;
|
||||
is($comp_q, "Host-item:(Some boring read)",, "UseControlNumber disabled");
|
||||
is($comp_q, 'Host-item:("Some boring read")', "UseControlNumber disabled");
|
||||
is($comp_s, "author_za", "UseControlNumber disabled sort is correct");
|
||||
|
||||
t::lib::Mocks::mock_preference( 'UseControlNumber', '1' );
|
||||
|
|
|
|||
Loading…
Reference in New Issue