Lines 70-76
$startfrom=0 unless $startfrom;
Link Here
|
70 |
my ($template, $loggedinuser, $cookie); |
70 |
my ($template, $loggedinuser, $cookie); |
71 |
my $resultsperpage; |
71 |
my $resultsperpage; |
72 |
|
72 |
|
73 |
my $advanced_search_types = C4::Context->preference("AdvancedSearchTypes"); |
|
|
74 |
my $itype_or_itemtype = (C4::Context->preference("item-level_itypes"))?'itype':'itemtype'; |
73 |
my $itype_or_itemtype = (C4::Context->preference("item-level_itypes"))?'itype':'itemtype'; |
75 |
|
74 |
|
76 |
my $query = $input->param('q'); |
75 |
my $query = $input->param('q'); |
Lines 87-109
if ($op eq "do_search" && $query) {
Link Here
|
87 |
} |
86 |
} |
88 |
); |
87 |
); |
89 |
|
88 |
|
90 |
# add the itemtype limit if applicable |
89 |
# add the limits if applicable |
91 |
my $itemtypelimit = $input->param('itemtypelimit'); |
90 |
my $itemtypelimit = $input->param('itemtypelimit'); |
92 |
if ( $itemtypelimit ) { |
91 |
my $ccodelimit = $input->param('ccodelimit'); |
93 |
my $QParser; |
92 |
my $op = C4::Context->preference('UseQueryParser') ? '&&' : 'and'; |
94 |
$QParser = C4::Context->queryparser if (C4::Context->preference('UseQueryParser')); |
93 |
$query .= " $op $itype_or_itemtype:$itemtypelimit" if $itemtypelimit; |
95 |
my $op; |
94 |
$query .= " $op ccode:$ccodelimit" if $ccodelimit; |
96 |
if ($QParser) { |
|
|
97 |
$op = '&&'; |
98 |
} else { |
99 |
$op = 'and'; |
100 |
} |
101 |
if (!$advanced_search_types or $advanced_search_types eq 'itemtypes') { |
102 |
$query .= " $op $itype_or_itemtype:$itemtypelimit"; |
103 |
} else { |
104 |
$query .= " $op $advanced_search_types:$itemtypelimit"; |
105 |
} |
106 |
} |
107 |
$debug && warn $query; |
95 |
$debug && warn $query; |
108 |
$resultsperpage= $input->param('resultsperpage'); |
96 |
$resultsperpage= $input->param('resultsperpage'); |
109 |
$resultsperpage = 20 if(!defined $resultsperpage); |
97 |
$resultsperpage = 20 if(!defined $resultsperpage); |
Lines 200-249
else {
Link Here
|
200 |
flagsrequired => {catalogue => 1, serials => '*'}, |
188 |
flagsrequired => {catalogue => 1, serials => '*'}, |
201 |
debug => 1, |
189 |
debug => 1, |
202 |
}); |
190 |
}); |
|
|
191 |
|
203 |
# load the itemtypes |
192 |
# load the itemtypes |
204 |
my $itemtypes = GetItemTypes; |
193 |
my $itemtypes = GetItemTypes(); |
205 |
my @itemtypesloop; |
194 |
my @itemtypesloop; |
206 |
if (!$advanced_search_types or $advanced_search_types eq 'itemtypes') { |
|
|
207 |
# load the itemtypes |
208 |
my $itemtypes = GetItemTypes; |
209 |
my $selected=1; |
210 |
my $cnt; |
211 |
foreach my $thisitemtype ( sort {$itemtypes->{$a}->{'description'} cmp $itemtypes->{$b}->{'description'} } keys %$itemtypes ) { |
195 |
foreach my $thisitemtype ( sort {$itemtypes->{$a}->{'description'} cmp $itemtypes->{$b}->{'description'} } keys %$itemtypes ) { |
212 |
my %row =( |
196 |
my %row =( |
213 |
code => $thisitemtype, |
197 |
code => $thisitemtype, |
214 |
selected => $selected, |
|
|
215 |
description => $itemtypes->{$thisitemtype}->{'description'}, |
198 |
description => $itemtypes->{$thisitemtype}->{'description'}, |
216 |
); |
199 |
); |
217 |
$selected = 0 if ($selected) ; |
|
|
218 |
push @itemtypesloop, \%row; |
200 |
push @itemtypesloop, \%row; |
219 |
} |
201 |
} |
220 |
|
202 |
|
221 |
|
203 |
# load Collection Codes |
222 |
} else { |
204 |
my $authvalues = GetAuthorisedValues('CCODE'); |
223 |
my $advsearchtypes = GetAuthorisedValues($advanced_search_types); |
205 |
my @ccodesloop; |
224 |
my $cnt; |
206 |
for my $thisauthvalue (sort {$a->{'lib'} cmp $b->{'lib'}} @$authvalues) { |
225 |
my $selected=1; |
|
|
226 |
for my $thisitemtype (sort {$a->{'lib'} cmp $b->{'lib'}} @$advsearchtypes) { |
227 |
my %row =( |
207 |
my %row =( |
228 |
number=>$cnt++, |
208 |
code => $thisauthvalue->{'authorised_value'}, |
229 |
ccl => $advanced_search_types, |
209 |
description => $thisauthvalue->{'lib'}, |
230 |
code => $thisitemtype->{authorised_value}, |
|
|
231 |
selected => $selected, |
232 |
description => $thisitemtype->{'lib'}, |
233 |
count5 => $cnt % 4, |
234 |
imageurl=> getitemtypeimagelocation( 'intranet', $thisitemtype->{'imageurl'} ), |
235 |
); |
210 |
); |
236 |
push @itemtypesloop, \%row; |
211 |
push @ccodesloop, \%row; |
237 |
} |
212 |
} |
238 |
} |
|
|
239 |
|
240 |
|
213 |
|
241 |
if ($op eq "do_search") { |
214 |
$template->param( |
242 |
$template->param("no_query" => 1); |
215 |
itemtypeloop => \@itemtypesloop, |
243 |
} else { |
216 |
ccodeloop => \@ccodesloop, |
244 |
$template->param("no_query" => 0); |
217 |
no_query => $op eq "do_search" ? 1 : 0, |
245 |
} |
218 |
); |
246 |
$template->param(itemtypeloop => \@itemtypesloop); |
|
|
247 |
} |
219 |
} |
248 |
# Print the page |
220 |
# Print the page |
249 |
output_html_with_http_headers $input, $cookie, $template->output; |
221 |
output_html_with_http_headers $input, $cookie, $template->output; |
250 |
- |
|
|