|
Lines 218-234
sub BreedingSearch {
Link Here
|
| 218 |
|
218 |
|
| 219 |
=head2 Z3950Search |
219 |
=head2 Z3950Search |
| 220 |
|
220 |
|
| 221 |
Z3950Search($pars, $template); |
221 |
Z3950Search($pars, $template, $getAll); |
| 222 |
|
222 |
|
| 223 |
Parameters for Z3950 search are all passed via the $pars hash. It may contain isbn, title, author, dewey, subject, lccall, controlnumber, stdid, srchany. |
223 |
Parameters for Z3950 search are all passed via the $pars hash. It may contain isbn, title, author, dewey, subject, lccall, controlnumber, stdid, srchany. |
| 224 |
Also it should contain an arrayref id that points to a list of id's of the z3950 targets to be queried (see z3950servers table). |
224 |
Also it should contain an arrayref id that points to a list of id's of the z3950 targets to be queried (see z3950servers table). |
| 225 |
This code is used in acqui/z3950_search and cataloging/z3950_search. |
225 |
This code is used in acqui/z3950_search and cataloging/z3950_search. |
| 226 |
The second parameter $template is a Template object. The routine uses this parameter to store the found values into the template. |
226 |
The second parameter $template is a Template object. The routine uses this parameter to store the found values into the template. |
| 227 |
|
227 |
|
|
|
228 |
Param3 $getAll, Get all the results instead of a small subset. $template is interpreted as a HASH where the search object is stored. |
| 229 |
|
| 228 |
=cut |
230 |
=cut |
| 229 |
|
231 |
|
| 230 |
sub Z3950Search { |
232 |
sub Z3950Search { |
| 231 |
my ($pars, $template)= @_; |
233 |
my ($pars, $template, $getAll)= @_; |
| 232 |
|
234 |
|
| 233 |
my @id= @{$pars->{id}}; |
235 |
my @id= @{$pars->{id}}; |
| 234 |
my $page= $pars->{page}; |
236 |
my $page= $pars->{page}; |
|
Lines 356-362
sub Z3950Search {
Link Here
|
| 356 |
my $numresults = $oResult[$k]->size(); |
358 |
my $numresults = $oResult[$k]->size(); |
| 357 |
my $i; |
359 |
my $i; |
| 358 |
my $result = ''; |
360 |
my $result = ''; |
| 359 |
if ( $numresults > 0 and $numresults >= (($page-1)*20)) { |
361 |
if ($getAll && $numresults > 0) { |
|
|
362 |
for ($i = 0 ; $i < $numresults ; $i++) { |
| 363 |
if($oResult[$k]->record($i)) { |
| 364 |
my $res=_handle_one_result($oResult[$k]->record($i), $serverinfo[$k], ++$imported, $biblionumber); #ignores error in sequence numbering |
| 365 |
push @breeding_loop, $res if $res; |
| 366 |
} |
| 367 |
else { |
| 368 |
push(@breeding_loop,{'server'=>$serverinfo[$k]->{name},'title'=>join(': ',$oConnection[$k]->error_x()),'breedingid'=>-1,'biblionumber'=>-1}); |
| 369 |
} |
| 370 |
} |
| 371 |
} |
| 372 |
elsif ( $numresults > 0 and $numresults >= (($page-1)*20)) { |
| 360 |
$show_next = 1 if $numresults >= ($page*20); |
373 |
$show_next = 1 if $numresults >= ($page*20); |
| 361 |
$total_pages = int($numresults/20)+1 if $total_pages < ($numresults/20); |
374 |
$total_pages = int($numresults/20)+1 if $total_pages < ($numresults/20); |
| 362 |
for ($i = ($page-1)*20; $i < (($numresults < ($page*20)) ? $numresults : ($page*20)); $i++) { |
375 |
for ($i = ($page-1)*20; $i < (($numresults < ($page*20)) ? $numresults : ($page*20)); $i++) { |
|
Lines 371-384
sub Z3950Search {
Link Here
|
| 371 |
} #if $numresults |
384 |
} #if $numresults |
| 372 |
} |
385 |
} |
| 373 |
} # if $k !=0 |
386 |
} # if $k !=0 |
| 374 |
|
387 |
|
| 375 |
$template->param( |
388 |
if ($getAll) { |
| 376 |
numberpending => $nremaining, |
389 |
$template->{numberpending} = $nremaining; |
| 377 |
current_page => $page, |
390 |
$template->{current_page} = $page; |
| 378 |
total_pages => $total_pages, |
391 |
$template->{total_pages} = $total_pages; |
| 379 |
show_nextbutton => $show_next?1:0, |
392 |
$template->{show_nextbutton} = $show_next; |
| 380 |
show_prevbutton => $page!=1, |
393 |
$template->{show_prevbutton} = $page; |
| 381 |
); |
394 |
} |
|
|
395 |
else { |
| 396 |
$template->param( |
| 397 |
numberpending => $nremaining, |
| 398 |
current_page => $page, |
| 399 |
total_pages => $total_pages, |
| 400 |
show_nextbutton => $show_next?1:0, |
| 401 |
show_prevbutton => $page!=1, |
| 402 |
); |
| 403 |
} |
| 382 |
} # while nremaining |
404 |
} # while nremaining |
| 383 |
|
405 |
|
| 384 |
#close result sets and connections |
406 |
#close result sets and connections |
|
Lines 391-401
sub Z3950Search {
Link Here
|
| 391 |
foreach my $id (@id) { |
413 |
foreach my $id (@id) { |
| 392 |
push @servers, {id => $id}; |
414 |
push @servers, {id => $id}; |
| 393 |
} |
415 |
} |
| 394 |
$template->param( |
416 |
if ($getAll) { |
| 395 |
breeding_loop => \@breeding_loop, |
417 |
$template->{breeding_loop} = \@breeding_loop; |
| 396 |
servers => \@servers, |
418 |
$template->{servers} = \@servers; |
| 397 |
errconn => \@errconn |
419 |
$template->{errconn} = \@errconn; |
| 398 |
); |
420 |
} |
|
|
421 |
else { |
| 422 |
$template->param( |
| 423 |
breeding_loop => \@breeding_loop, |
| 424 |
servers => \@servers, |
| 425 |
errconn => \@errconn |
| 426 |
); |
| 427 |
} |
| 399 |
} |
428 |
} |
| 400 |
|
429 |
|
| 401 |
sub _handle_one_result { |
430 |
sub _handle_one_result { |
| 402 |
- |
|
|