Lines 239-282
my $categories = GetBranchCategories(undef,'searchdomain');
Link Here
|
239 |
$template->param(branchloop => \@branch_loop, searchdomainloop => $categories); |
239 |
$template->param(branchloop => \@branch_loop, searchdomainloop => $categories); |
240 |
|
240 |
|
241 |
# load the Type stuff |
241 |
# load the Type stuff |
242 |
# load the Type stuff |
|
|
243 |
my $itemtypes = GetItemTypes; |
242 |
my $itemtypes = GetItemTypes; |
244 |
# the index parameter is different for item-level itemtypes |
243 |
# the index parameter is different for item-level itemtypes |
245 |
my $itype_or_itemtype = (C4::Context->preference("item-level_itypes"))?'itype':'itemtype'; |
244 |
my $itype_or_itemtype = (C4::Context->preference("item-level_itypes"))?'itype':'itemtype'; |
246 |
my @itemtypesloop; |
245 |
my @advancedsearchesloop; |
247 |
my $selected=1; |
|
|
248 |
my $cnt; |
246 |
my $cnt; |
249 |
my $advanced_search_types = C4::Context->preference("AdvancedSearchTypes"); |
247 |
my $advanced_search_types = C4::Context->preference("AdvancedSearchTypes") || "itemtypes"; |
250 |
|
248 |
my @advanced_search_types = split(/\|/, $advanced_search_types); |
251 |
if (!$advanced_search_types or $advanced_search_types eq 'itemtypes') { foreach my $thisitemtype ( sort {$itemtypes->{$a}->{'description'} cmp $itemtypes->{$b}->{'description'} } keys %$itemtypes ) { |
249 |
|
252 |
my %row =( number=>$cnt++, |
250 |
foreach my $advanced_srch_type (@advanced_search_types) { |
253 |
ccl => qq($itype_or_itemtype,phr), |
251 |
if ($advanced_srch_type eq 'itemtypes') { |
|
|
252 |
# itemtype is a special case, since it's not defined in authorized values |
253 |
my @itypesloop; |
254 |
foreach my $thisitemtype ( sort {$itemtypes->{$a}->{'description'} cmp $itemtypes->{$b}->{'description'} } keys %$itemtypes ) { |
255 |
my %row =( number=>$cnt++, |
256 |
ccl => "$itype_or_itemtype,phr", |
254 |
code => $thisitemtype, |
257 |
code => $thisitemtype, |
255 |
selected => $selected, |
|
|
256 |
description => $itemtypes->{$thisitemtype}->{'description'}, |
258 |
description => $itemtypes->{$thisitemtype}->{'description'}, |
257 |
count5 => $cnt % 4, |
259 |
imageurl=> getitemtypeimagelocation( 'opac', $itemtypes->{$thisitemtype}->{'imageurl'} ), |
258 |
imageurl=> getitemtypeimagelocation( 'intranet', $itemtypes->{$thisitemtype}->{'imageurl'} ), |
|
|
259 |
); |
260 |
); |
260 |
$selected = 0 if ($selected) ; |
261 |
push @itypesloop, \%row; |
261 |
push @itemtypesloop, \%row; |
262 |
} |
262 |
} |
263 |
my %search_code = ( advanced_search_type => $advanced_srch_type, |
263 |
$template->param(itemtypeloop => \@itemtypesloop); |
264 |
code_loop => \@itypesloop ); |
264 |
} else { |
265 |
push @advancedsearchesloop, \%search_code; |
265 |
my $advsearchtypes = GetAuthorisedValues($advanced_search_types); |
266 |
} else { |
266 |
for my $thisitemtype (sort {$a->{'lib'} cmp $b->{'lib'}} @$advsearchtypes) { |
267 |
# covers all the other cases: non-itemtype authorized values |
267 |
my %row =( |
268 |
my $advsearchtypes = GetAuthorisedValues($advanced_srch_type, '', 'opac'); |
268 |
number=>$cnt++, |
269 |
my @authvalueloop; |
269 |
ccl => $advanced_search_types, |
270 |
for my $thisitemtype (@$advsearchtypes) { |
|
|
271 |
my %row =( |
272 |
number=>$cnt++, |
273 |
ccl => $advanced_srch_type, |
270 |
code => $thisitemtype->{authorised_value}, |
274 |
code => $thisitemtype->{authorised_value}, |
271 |
selected => $selected, |
|
|
272 |
description => $thisitemtype->{'lib'}, |
275 |
description => $thisitemtype->{'lib'}, |
273 |
count5 => $cnt % 4, |
276 |
imageurl => getitemtypeimagelocation( 'intranet', $thisitemtype->{'imageurl'} ), |
274 |
imageurl=> getitemtypeimagelocation( 'intranet', $thisitemtype->{'imageurl'} ), |
277 |
); |
275 |
); |
278 |
push @authvalueloop, \%row; |
276 |
push @itemtypesloop, \%row; |
279 |
} |
|
|
280 |
my %search_code = ( advanced_search_type => $advanced_srch_type, |
281 |
code_loop => \@authvalueloop ); |
282 |
push @advancedsearchesloop, \%search_code; |
277 |
} |
283 |
} |
278 |
$template->param(itemtypeloop => \@itemtypesloop); |
|
|
279 |
} |
284 |
} |
|
|
285 |
$template->param(advancedsearchesloop => \@advancedsearchesloop); |
280 |
|
286 |
|
281 |
# The following should only be loaded if we're bringing up the advanced search template |
287 |
# The following should only be loaded if we're bringing up the advanced search template |
282 |
if ( $template_type eq 'advsearch' ) { |
288 |
if ( $template_type eq 'advsearch' ) { |