View | Details | Raw Unified | Return to bug 4491
Collapse All | Expand All

(-)a/catalogue/search.pl (-11 / +6 lines)
Lines 372-378 if ( C4::Context->preference('defaultSortField') Link Here
372
      . C4::Context->preference('defaultSortOrder');
372
      . C4::Context->preference('defaultSortOrder');
373
}
373
}
374
374
375
@sort_by = split("\0",$params->{'sort_by'}) if $params->{'sort_by'};
375
@sort_by = $cgi->param('sort_by');
376
$sort_by[0] = $default_sort_by unless $sort_by[0];
376
$sort_by[0] = $default_sort_by unless $sort_by[0];
377
foreach my $sort (@sort_by) {
377
foreach my $sort (@sort_by) {
378
    $template->param($sort => 1) if $sort;
378
    $template->param($sort => 1) if $sort;
Lines 380-387 foreach my $sort (@sort_by) { Link Here
380
$template->param('sort_by' => $sort_by[0]);
380
$template->param('sort_by' => $sort_by[0]);
381
381
382
# Use the servers defined, or just search our local catalog(default)
382
# Use the servers defined, or just search our local catalog(default)
383
my @servers;
383
my @servers = $cgi->param('server');
384
@servers = split("\0",$params->{'server'}) if $params->{'server'};
385
unless (@servers) {
384
unless (@servers) {
386
    #FIXME: this should be handled using Context.pm
385
    #FIXME: this should be handled using Context.pm
387
    @servers = ("biblioserver");
386
    @servers = ("biblioserver");
Lines 389-401 unless (@servers) { Link Here
389
}
388
}
390
# operators include boolean and proximity operators and are used
389
# operators include boolean and proximity operators and are used
391
# to evaluate multiple operands
390
# to evaluate multiple operands
392
my @operators;
391
my @operators = $cgi->param('op');
393
@operators = split("\0",$params->{'op'}) if $params->{'op'};
394
392
395
# indexes are query qualifiers, like 'title', 'author', etc. They
393
# indexes are query qualifiers, like 'title', 'author', etc. They
396
# can be single or multiple parameters separated by comma: kw,right-Truncation 
394
# can be single or multiple parameters separated by comma: kw,right-Truncation 
397
my @indexes;
395
my @indexes = $cgi->param('idx');
398
@indexes = split("\0",$params->{'idx'});
399
396
400
# if a simple index (only one)  display the index used in the top search box
397
# if a simple index (only one)  display the index used in the top search box
401
if ($indexes[0] && (!$indexes[1] || $params->{'scan'})) {
398
if ($indexes[0] && (!$indexes[1] || $params->{'scan'})) {
Lines 406-417 if ($indexes[0] && (!$indexes[1] || $params->{'scan'})) { Link Here
406
403
407
404
408
# an operand can be a single term, a phrase, or a complete ccl query
405
# an operand can be a single term, a phrase, or a complete ccl query
409
my @operands;
406
my @operands = $cgi->param('q');
410
@operands = split("\0",$params->{'q'}) if $params->{'q'};
411
407
412
# limits are use to limit to results to a pre-defined category such as branch or language
408
# limits are use to limit to results to a pre-defined category such as branch or language
413
my @limits;
409
my @limits = $cgi->param('limit');
414
@limits = split("\0",$params->{'limit'}) if $params->{'limit'};
415
410
416
if($params->{'multibranchlimit'}) {
411
if($params->{'multibranchlimit'}) {
417
    push @limits, '('.join( " or ", map { "branch: $_ " } @{ GetBranchesInCategory( $params->{'multibranchlimit'} ) } ).')';
412
    push @limits, '('.join( " or ", map { "branch: $_ " } @{ GetBranchesInCategory( $params->{'multibranchlimit'} ) } ).')';
(-)a/opac/opac-search.pl (-13 / +7 lines)
Lines 312-318 $tag = $params->{tag} if $params->{tag}; Link Here
312
my $pasarParams = '';
312
my $pasarParams = '';
313
my $j = 0;
313
my $j = 0;
314
for (keys %$params) {
314
for (keys %$params) {
315
    my @pasarParam = split("\0", $params->{$_});
315
    my @pasarParam = $cgi->param($_);
316
    for my $paramValue(@pasarParam) {
316
    for my $paramValue(@pasarParam) {
317
        $pasarParams .= '&' if ($j > 0);
317
        $pasarParams .= '&' if ($j > 0);
318
        $pasarParams .= $_ . '=' . $paramValue;
318
        $pasarParams .= $_ . '=' . $paramValue;
Lines 333-339 if ( C4::Context->preference('OPACdefaultSortField') Link Here
333
}
333
}
334
334
335
my @allowed_sortby = qw /acqdate_asc acqdate_dsc author_az author_za call_number_asc call_number_dsc popularity_asc popularity_dsc pubdate_asc pubdate_dsc relevance title_az title_za/; 
335
my @allowed_sortby = qw /acqdate_asc acqdate_dsc author_az author_za call_number_asc call_number_dsc popularity_asc popularity_dsc pubdate_asc pubdate_dsc relevance title_az title_za/; 
336
@sort_by = split("\0",$params->{'sort_by'}) if $params->{'sort_by'};
336
@sort_by = $cgi->param('sort_by');
337
$sort_by[0] = $default_sort_by if !$sort_by[0] && defined($default_sort_by);
337
$sort_by[0] = $default_sort_by if !$sort_by[0] && defined($default_sort_by);
338
foreach my $sort (@sort_by) {
338
foreach my $sort (@sort_by) {
339
    if ( $sort ~~ @allowed_sortby ) {
339
    if ( $sort ~~ @allowed_sortby ) {
Lines 343-350 foreach my $sort (@sort_by) { Link Here
343
$template->param('sort_by' => $sort_by[0]);
343
$template->param('sort_by' => $sort_by[0]);
344
344
345
# Use the servers defined, or just search our local catalog(default)
345
# Use the servers defined, or just search our local catalog(default)
346
my @servers;
346
my @servers = $cgi->param('server');
347
@servers = split("\0",$params->{'server'}) if $params->{'server'};
348
unless (@servers) {
347
unless (@servers) {
349
    #FIXME: this should be handled using Context.pm
348
    #FIXME: this should be handled using Context.pm
350
    @servers = ("biblioserver");
349
    @servers = ("biblioserver");
Lines 353-373 unless (@servers) { Link Here
353
352
354
# operators include boolean and proximity operators and are used
353
# operators include boolean and proximity operators and are used
355
# to evaluate multiple operands
354
# to evaluate multiple operands
356
my @operators;
355
my @operators = $cgi->param('op');
357
@operators = split("\0",$params->{'op'}) if $params->{'op'};
358
356
359
# indexes are query qualifiers, like 'title', 'author', etc. They
357
# indexes are query qualifiers, like 'title', 'author', etc. They
360
# can be single or multiple parameters separated by comma: kw,right-Truncation 
358
# can be single or multiple parameters separated by comma: kw,right-Truncation 
361
my @indexes;
359
my @indexes = $cgi->param('idx');
362
@indexes = split("\0",$params->{'idx'}) if $params->{'idx'};
363
360
364
# if a simple index (only one)  display the index used in the top search box
361
# if a simple index (only one)  display the index used in the top search box
365
if ($indexes[0] && !$indexes[1]) {
362
if ($indexes[0] && !$indexes[1]) {
366
    $template->param("ms_".$indexes[0] => 1);
363
    $template->param("ms_".$indexes[0] => 1);
367
}
364
}
368
# an operand can be a single term, a phrase, or a complete ccl query
365
# an operand can be a single term, a phrase, or a complete ccl query
369
my @operands;
366
my @operands = $cgi->param('q');
370
@operands = split("\0",$params->{'q'}) if $params->{'q'};
371
367
372
# if a simple search, display the value in the search box
368
# if a simple search, display the value in the search box
373
if ($operands[0] && !$operands[1]) {
369
if ($operands[0] && !$operands[1]) {
Lines 375-382 if ($operands[0] && !$operands[1]) { Link Here
375
}
371
}
376
372
377
# limits are use to limit to results to a pre-defined category such as branch or language
373
# limits are use to limit to results to a pre-defined category such as branch or language
378
my @limits;
374
my @limits = $cgi->param('limit');
379
@limits = split("\0",$params->{'limit'}) if $params->{'limit'};
380
375
381
if($params->{'multibranchlimit'}) {
376
if($params->{'multibranchlimit'}) {
382
    push @limits, '('.join( " or ", map { "branch: $_ " } @{ GetBranchesInCategory( $params->{'multibranchlimit'} ) } ).')';
377
    push @limits, '('.join( " or ", map { "branch: $_ " } @{ GetBranchesInCategory( $params->{'multibranchlimit'} ) } ).')';
383
- 

Return to bug 4491