diff --git a/Koha/Util/Search.pm b/Koha/Util/Search.pm index ddf0587cdd..0228183e35 100644 --- a/Koha/Util/Search.pm +++ b/Koha/Util/Search.pm @@ -45,11 +45,11 @@ sub get_component_part_query { if (!defined($pf003)) { # search for 773$w='Host001' - $searchstr = "rcn='".$pf001->data()."'"; + $searchstr = "rcn=\"".$pf001->data()."\""; } else { # search for (773$w='Host001' and 003='Host003') or 773$w='Host003 Host001') - $searchstr = "(rcn='".$pf001->data()."' AND cni='".$pf003->data()."')"; - $searchstr .= " OR rcn='".$pf003->data()." ".$pf001->data()."'"; + $searchstr = "(rcn=\"".$pf001->data()."\" AND cni=\"".$pf003->data()."\")"; + $searchstr .= " OR rcn=\"".$pf003->data()." ".$pf001->data()."\""; } } } diff --git a/t/Koha/Util/Search.t b/t/Koha/Util/Search.t index c56b9404e2..e5cde2900b 100755 --- a/t/Koha/Util/Search.t +++ b/t/Koha/Util/Search.t @@ -38,5 +38,5 @@ subtest 'get_component_part_query' => sub { $record->append_fields($marc_001_field); ModBiblioMarc($record, $biblionumber); - is(Koha::Util::Search::get_component_part_query($biblionumber), "rcn='$biblionumber'"); + is(Koha::Util::Search::get_component_part_query($biblionumber), "rcn=\"$biblionumber\""); };