# load the branches
my $branches = GetBranches();
-my @branch_loop;
-
-for my $branch_hash (sort keys %$branches) {
- push @branch_loop, {value => "$branch_hash" , branchname => $branches->{$branch_hash}->{'branchname'}, };
-}
+# FIXME: next line duplicates GetBranchesLoop(0,0);
+my @branch_loop = map {
+ {value => $_, branchname => $branches->{$_}->{branchname}}
+ } sort {
+ $branches->{$a}->{branchname} cmp $branches->{$b}->{branchname}
+ } keys %$branches;
my $categories = GetBranchCategories(undef,'searchdomain');
my @itemtypesloop;
my $selected=1;
my $cnt;
-my $imgdir = getitemtypeimagesrc('opac');
my $advanced_search_types = C4::Context->preference("AdvancedSearchTypes");
if (!$advanced_search_types or $advanced_search_types eq 'itemtypes') {
foreach my $thisitemtype ( sort {$itemtypes->{$a}->{'description'} cmp $itemtypes->{$b}->{'description'} } keys %$itemtypes ) {
my %row =( number=>$cnt++,
- imageurl=> $itemtypes->{$thisitemtype}->{'imageurl'}?($imgdir."/".$itemtypes->{$thisitemtype}->{'imageurl'}):"",
ccl => $itype_or_itemtype,
code => $thisitemtype,
selected => $selected,
description => $itemtypes->{$thisitemtype}->{'description'},
count5 => $cnt % 4,
+ imageurl=> getitemtypeimagelocation( 'opac', $itemtypes->{$thisitemtype}->{'imageurl'} ),
);
$selected = 0 if ($selected) ;
push @itemtypesloop, \%row;
for my $thisitemtype (@$advsearchtypes) {
my %row =(
number=>$cnt++,
- imageurl=> $thisitemtype->{'imageurl'}?($imgdir."/".$thisitemtype->{'imageurl'}):"",
ccl => $advanced_search_types,
code => $thisitemtype->{authorised_value},
selected => $selected,
description => $thisitemtype->{'lib'},
count5 => $cnt % 4,
+ imageurl=> getitemtypeimagelocation( 'opac', $thisitemtype->{'imageurl'} ),
);
push @itemtypesloop, \%row;
}
my $secondary_servers_loop;# = displaySecondaryServers();
$template->param(outer_sup_servers_loop => $secondary_servers_loop,);
-
+
+ # set the default sorting
+ my $default_sort_by = C4::Context->preference('OPACdefaultSortField')."_".C4::Context->preference('OPACdefaultSortOrder')
+ if (C4::Context->preference('OPACdefaultSortField') && C4::Context->preference('OPACdefaultSortOrder'));
+ $template->param($default_sort_by => 1);
+
# determine what to display next to the search boxes (ie, boolean option
# shouldn't appear on the first one, scan indexes should, adding a new
# box should only appear on the last, etc.
my @elements;
for my $this_cgi ( split('&',shift) ) {
next unless $this_cgi;
- $this_cgi =~ /(.*)=(.*)/;
+ $this_cgi =~ /(.*?)=(.*)/;
push @elements, { input_name => $1, input_value => $2 };
}
return @elements;