Lines 304-309
foreach my $advanced_srch_type (@advanced_search_types) {
Link Here
|
304 |
} |
304 |
} |
305 |
$template->param(advancedsearchesloop => \@advancedsearchesloop); |
305 |
$template->param(advancedsearchesloop => \@advancedsearchesloop); |
306 |
|
306 |
|
|
|
307 |
my $default_sort_by = C4::Context->default_catalog_sort_by; |
308 |
|
307 |
# The following should only be loaded if we're bringing up the advanced search template |
309 |
# The following should only be loaded if we're bringing up the advanced search template |
308 |
if ( $template_type && $template_type eq 'advsearch' ) { |
310 |
if ( $template_type && $template_type eq 'advsearch' ) { |
309 |
# load the servers (used for searching -- to do federated searching, etc.) |
311 |
# load the servers (used for searching -- to do federated searching, etc.) |
Lines 314-324
if ( $template_type && $template_type eq 'advsearch' ) {
Link Here
|
314 |
$template->param(outer_sup_servers_loop => $secondary_servers_loop,); |
316 |
$template->param(outer_sup_servers_loop => $secondary_servers_loop,); |
315 |
|
317 |
|
316 |
# set the default sorting |
318 |
# set the default sorting |
317 |
if ( C4::Context->preference('OPACdefaultSortField') |
319 |
if ($default_sort_by) { |
318 |
&& C4::Context->preference('OPACdefaultSortOrder') ) { |
|
|
319 |
my $default_sort_by = |
320 |
C4::Context->preference('OPACdefaultSortField') . '_' |
321 |
. C4::Context->preference('OPACdefaultSortOrder'); |
322 |
$template->param( sort_by => $default_sort_by ); |
320 |
$template->param( sort_by => $default_sort_by ); |
323 |
} |
321 |
} |
324 |
|
322 |
|
Lines 378-391
for (keys %$params) {
Link Here
|
378 |
# sort by is used to sort the query |
376 |
# sort by is used to sort the query |
379 |
# in theory can have more than one but generally there's just one |
377 |
# in theory can have more than one but generally there's just one |
380 |
my @sort_by; |
378 |
my @sort_by; |
381 |
my $default_sort_by; |
|
|
382 |
if ( C4::Context->preference('OPACdefaultSortField') |
383 |
&& C4::Context->preference('OPACdefaultSortOrder') ) { |
384 |
$default_sort_by = |
385 |
C4::Context->preference('OPACdefaultSortField') . '_' |
386 |
. C4::Context->preference('OPACdefaultSortOrder'); |
387 |
} |
388 |
|
389 |
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/; |
379 |
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/; |
390 |
@sort_by = $cgi->multi_param('sort_by'); |
380 |
@sort_by = $cgi->multi_param('sort_by'); |
391 |
$sort_by[0] = $default_sort_by if !$sort_by[0] && defined($default_sort_by); |
381 |
$sort_by[0] = $default_sort_by if !$sort_by[0] && defined($default_sort_by); |