Lines 147-153
sub Z3950Search {
Link Here
|
147 |
my $s = 0; |
147 |
my $s = 0; |
148 |
my $imported=0; |
148 |
my $imported=0; |
149 |
|
149 |
|
150 |
my ( $zquery, $squery ) = _build_query( $pars ); |
150 |
my ( $zquery, $squery ) = _bib_build_query( $pars ); |
151 |
|
151 |
|
152 |
my $schema = Koha::Database->new()->schema(); |
152 |
my $schema = Koha::Database->new()->schema(); |
153 |
my $rs = $schema->resultset('Z3950server')->search( |
153 |
my $rs = $schema->resultset('Z3950server')->search( |
Lines 244-269
sub _auth_build_query {
Link Here
|
244 |
controlnumber => '@attr 1=12 "#term" ', |
244 |
controlnumber => '@attr 1=12 "#term" ', |
245 |
}; |
245 |
}; |
246 |
|
246 |
|
247 |
my $zquery=''; |
247 |
return _build_query( $pars, $qry_build ); |
248 |
my $squery=''; |
|
|
249 |
my $nterms=0; |
250 |
foreach my $k ( sort keys %$pars ) { |
251 |
#note that the sort keys forces an identical result under Perl 5.18 |
252 |
#one of the unit tests is based on that assumption |
253 |
if( ( my $val=$pars->{$k} ) && $qry_build->{$k} ) { |
254 |
$qry_build->{$k} =~ s/#term/$val/g; |
255 |
$zquery .= $qry_build->{$k}; |
256 |
$squery .= "[$k]=\"$val\" and "; |
257 |
$nterms++; |
258 |
} |
259 |
} |
260 |
$zquery = "\@and " . $zquery for 2..$nterms; |
261 |
$squery =~ s/ and $//; |
262 |
return ( $zquery, $squery ); |
263 |
|
264 |
} |
248 |
} |
265 |
|
249 |
|
266 |
sub _build_query { |
250 |
sub _bib_build_query { |
|
|
251 |
|
267 |
my ( $pars ) = @_; |
252 |
my ( $pars ) = @_; |
268 |
|
253 |
|
269 |
my $qry_build = { |
254 |
my $qry_build = { |
Lines 280-285
sub _build_query {
Link Here
|
280 |
stdid => '@attr 1=1007 "#term" ', |
265 |
stdid => '@attr 1=1007 "#term" ', |
281 |
}; |
266 |
}; |
282 |
|
267 |
|
|
|
268 |
return _build_query( $pars, $qry_build ); |
269 |
} |
270 |
|
271 |
sub _build_query { |
272 |
|
273 |
my ( $pars, $qry_build ) = @_; |
274 |
|
283 |
my $zquery=''; |
275 |
my $zquery=''; |
284 |
my $squery=''; |
276 |
my $squery=''; |
285 |
my $nterms=0; |
277 |
my $nterms=0; |
286 |
- |
|
|