Lines 46-53
my $line = $input->param("Line");
Link Here
|
46 |
my $column = $input->param("Column"); |
46 |
my $column = $input->param("Column"); |
47 |
my $cellvalue = $input->param("Cellvalue"); # one of 'items', 'biblios', 'deleteditems' |
47 |
my $cellvalue = $input->param("Cellvalue"); # one of 'items', 'biblios', 'deleteditems' |
48 |
my @filters = $input->param("Filter"); |
48 |
my @filters = $input->param("Filter"); |
49 |
my $deweydigits = $input->param("deweydigits"); |
|
|
50 |
my $lccndigits = $input->param("lccndigits"); |
51 |
my $cotedigits = $input->param("cotedigits"); |
49 |
my $cotedigits = $input->param("cotedigits"); |
52 |
my $output = $input->param("output"); |
50 |
my $output = $input->param("output"); |
53 |
my $basename = $input->param("basename"); |
51 |
my $basename = $input->param("basename"); |
Lines 76-82
my ($template, $borrowernumber, $cookie)
Link Here
|
76 |
}); |
74 |
}); |
77 |
$template->param(do_it => $do_it); |
75 |
$template->param(do_it => $do_it); |
78 |
if ($do_it) { |
76 |
if ($do_it) { |
79 |
my $results = calculate( $line, $column, $cellvalue, $deweydigits, $lccndigits, $cotedigits, \@filters ); |
77 |
my $results = calculate( $line, $column, $cellvalue, $cotedigits, \@filters ); |
80 |
if ( $output eq "screen" ) { |
78 |
if ( $output eq "screen" ) { |
81 |
$template->param( mainloop => $results ); |
79 |
$template->param( mainloop => $results ); |
82 |
output_html_with_http_headers $input, $cookie, $template->output; |
80 |
output_html_with_http_headers $input, $cookie, $template->output; |
Lines 119-152
if ($do_it) {
Link Here
|
119 |
my $count=0; |
117 |
my $count=0; |
120 |
my $req; |
118 |
my $req; |
121 |
my @select; |
119 |
my @select; |
122 |
# FIXME: no such field "dewey" |
|
|
123 |
# $req = $dbh->prepare("select count(dewey) from biblioitems "); |
124 |
# $req->execute; |
125 |
my $hasdewey = 0; |
126 |
|
127 |
# (rch) biblioitems.lccn is mapped to lccn MARC21 010$a in default framework. |
128 |
# This is not the LC Classification. It's the Control Number. |
129 |
# So I'm just going to remove this bit. Call Number is handled in itemcallnumber. |
130 |
# |
131 |
my $haslccn = 0; |
132 |
# $req = $dbh->prepare( "select count(lccn) from biblioitems "); |
133 |
# $req->execute; |
134 |
# my $hlghtlccn; |
135 |
# while (my ($value) =$req->fetchrow) { |
136 |
# $hlghtlccn = !($hasdewey); |
137 |
# $haslccn =1 if (($value>2) and (! $haslccn)); |
138 |
# $count++ if (($value) and (! $haslccn)); |
139 |
# push @select, $value; |
140 |
# } |
141 |
# my $CGIlccn = { |
142 |
# values => \@select, |
143 |
# }; |
144 |
|
145 |
# No need to test for data here. If you don't have itemcallnumbers, you probably know it. |
146 |
# FIXME: Hardcoding to 5 chars on itemcallnum. |
147 |
# |
148 |
my $hascote = 1; |
149 |
my $highcote = 5; |
150 |
|
120 |
|
151 |
$req = $dbh->prepare("select itemtype, description from itemtypes order by description"); |
121 |
$req = $dbh->prepare("select itemtype, description from itemtypes order by description"); |
152 |
$req->execute; |
122 |
$req->execute; |
Lines 185-193
if ($do_it) {
Link Here
|
185 |
my @mime = ( map { +{type =>$_} } (split /[;:]/, 'CSV') ); # FIXME translation |
155 |
my @mime = ( map { +{type =>$_} } (split /[;:]/, 'CSV') ); # FIXME translation |
186 |
|
156 |
|
187 |
$template->param( |
157 |
$template->param( |
188 |
hasdewey => $hasdewey, |
|
|
189 |
haslccn => $haslccn, |
190 |
hascote => $hascote, |
191 |
CGIItemType => $CGIitemtype, |
158 |
CGIItemType => $CGIitemtype, |
192 |
CGIBranch => GetBranchesLoop( C4::Context->userenv->{'branch'} ), |
159 |
CGIBranch => GetBranchesLoop( C4::Context->userenv->{'branch'} ), |
193 |
locationloop => \@locations, |
160 |
locationloop => \@locations, |
Lines 204-210
output_html_with_http_headers $input, $cookie, $template->output;
Link Here
|
204 |
|
171 |
|
205 |
|
172 |
|
206 |
sub calculate { |
173 |
sub calculate { |
207 |
my ( $line, $column, $cellvalue, $deweydigits, $lccndigits, $cotedigits, $filters ) = @_; |
174 |
my ( $line, $column, $cellvalue, $cotedigits, $filters ) = @_; |
208 |
my @mainloop; |
175 |
my @mainloop; |
209 |
my @loopfooter; |
176 |
my @loopfooter; |
210 |
my @loopcol; |
177 |
my @loopcol; |
Lines 237-340
sub calculate {
Link Here
|
237 |
my @loopfilter; |
204 |
my @loopfilter; |
238 |
for ( my $i = 0 ; $i <= @$filters ; $i++ ) { |
205 |
for ( my $i = 0 ; $i <= @$filters ; $i++ ) { |
239 |
my %cell; |
206 |
my %cell; |
240 |
if ( defined @$filters[$i] and @$filters[$i] ne '' and $i != 15 ) { |
207 |
if ( defined @$filters[$i] and @$filters[$i] ne '' and $i != 11 ) { |
241 |
if ( ( ( $i == 1 ) or ( $i == 3 ) or ( $i == 5 ) or ( $i == 9 ) ) and ( @$filters[ $i - 1 ] ) ) { |
208 |
if ( ( ( $i == 1 ) or ( $i == 5 ) ) and ( @$filters[ $i - 1 ] ) ) { |
242 |
$cell{err} = 1 if ( @$filters[$i] < @$filters[ $i - 1 ] ); |
209 |
$cell{err} = 1 if ( @$filters[$i] < @$filters[ $i - 1 ] ); |
243 |
} |
210 |
} |
244 |
$cell{filter} .= @$filters[$i]; |
211 |
$cell{filter} .= @$filters[$i]; |
245 |
$cell{crit} .= |
212 |
$cell{crit} .= |
246 |
( $i == 0 ) ? "Dewey Classification From" |
213 |
( $i == 0 ) ? "Item CallNumber From" |
247 |
: ( $i == 1 ) ? "Dewey Classification To" |
214 |
: ( $i == 1 ) ? "Item CallNumber To" |
248 |
: ( $i == 2 ) ? "Lccn Classification From" |
215 |
: ( $i == 2 ) ? "Item type" |
249 |
: ( $i == 3 ) ? "Lccn Classification To" |
216 |
: ( $i == 3 ) ? "Publisher" |
250 |
: ( $i == 4 ) ? "Item CallNumber From" |
217 |
: ( $i == 4 ) ? "Publication year From" |
251 |
: ( $i == 5 ) ? "Item CallNumber To" |
218 |
: ( $i == 5 ) ? "Publication year To" |
252 |
: ( $i == 6 ) ? "Item type" |
219 |
: ( $i == 6 ) ? "Library" |
253 |
: ( $i == 7 ) ? "Publisher" |
220 |
: ( $i == 7 ) ? "Shelving Location" |
254 |
: ( $i == 8 ) ? "Publication year From" |
221 |
: ( $i == 8 ) ? "Collection Code" |
255 |
: ( $i == 9 ) ? "Publication year To" |
222 |
: ( $i == 9 ) ? "Status" |
256 |
: ( $i == 10 ) ? "Library" |
223 |
: ( $i == 10 ) ? "Materials" |
257 |
: ( $i == 11 ) ? "Shelving Location" |
224 |
: ( $i == 12 and $filters->[11] == 0 ) ? "Barcode (not like)" |
258 |
: ( $i == 12 ) ? "Collection Code" |
225 |
: ( $i == 12 and $filters->[11] == 1 ) ? "Barcode (like)" |
259 |
: ( $i == 13 ) ? "Status" |
226 |
: ( $i == 13 ) ? "Acquired date from" |
260 |
: ( $i == 14 ) ? "Materials" |
227 |
: ( $i == 14 ) ? "Acquired date to" |
261 |
: ( $i == 16 and $filters->[15] == 0 ) ? "Barcode (not like)" |
228 |
: ( $i == 15 ) ? "Removed date from" |
262 |
: ( $i == 16 and $filters->[15] == 1 ) ? "Barcode (like)" |
229 |
: ( $i == 16 ) ? "Removed date to" |
263 |
: ( $i == 17 ) ? "Acquired date from" |
|
|
264 |
: ( $i == 18 ) ? "Acquired date to" |
265 |
: ( $i == 19 ) ? "Removed date from" |
266 |
: ( $i == 20 ) ? "Removed date to" |
267 |
: ''; |
230 |
: ''; |
268 |
|
231 |
|
269 |
push @loopfilter, \%cell; |
232 |
push @loopfilter, \%cell; |
270 |
} |
233 |
} |
271 |
} |
234 |
} |
272 |
|
235 |
|
273 |
@$filters[18] = C4::Dates->new(@$filters[18])->output('iso') if @$filters[18]; |
236 |
@$filters[14] = C4::Dates->new(@$filters[14])->output('iso') if @$filters[14]; |
274 |
@$filters[19] = C4::Dates->new(@$filters[19])->output('iso') if @$filters[19]; |
237 |
@$filters[15] = C4::Dates->new(@$filters[15])->output('iso') if @$filters[15]; |
275 |
@$filters[20] = C4::Dates->new(@$filters[20])->output('iso') if @$filters[20]; |
238 |
@$filters[16] = C4::Dates->new(@$filters[16])->output('iso') if @$filters[16]; |
276 |
@$filters[21] = C4::Dates->new(@$filters[21])->output('iso') if @$filters[21]; |
239 |
@$filters[17] = C4::Dates->new(@$filters[17])->output('iso') if @$filters[17]; |
277 |
|
240 |
|
278 |
my @linefilter; |
241 |
my @linefilter; |
279 |
$linefilter[0] = @$filters[0] if ( $line =~ /dewey/ ); |
242 |
$linefilter[0] = @$filters[0] if ( $line =~ /items\.itemcallnumber/ ); |
280 |
$linefilter[1] = @$filters[1] if ( $line =~ /dewey/ ); |
243 |
$linefilter[1] = @$filters[1] if ( $line =~ /items\.itemcallnumber/ ); |
281 |
$linefilter[0] = @$filters[2] if ( $line =~ /lccn/ ); |
|
|
282 |
$linefilter[1] = @$filters[3] if ( $line =~ /lccn/ ); |
283 |
$linefilter[0] = @$filters[4] if ( $line =~ /items\.itemcallnumber/ ); |
284 |
$linefilter[1] = @$filters[5] if ( $line =~ /items\.itemcallnumber/ ); |
285 |
if ( C4::Context->preference('item-level_itypes') ) { |
244 |
if ( C4::Context->preference('item-level_itypes') ) { |
286 |
$linefilter[0] = @$filters[6] if ( $line =~ /items\.itype/ ); |
245 |
$linefilter[0] = @$filters[2] if ( $line =~ /items\.itype/ ); |
287 |
} else { |
246 |
} else { |
288 |
$linefilter[0] = @$filters[6] if ( $line =~ /itemtype/ ); |
247 |
$linefilter[0] = @$filters[2] if ( $line =~ /itemtype/ ); |
289 |
} |
248 |
} |
290 |
$linefilter[0] = @$filters[7] if ( $line =~ /publishercode/ ); |
249 |
$linefilter[0] = @$filters[3] if ( $line =~ /publishercode/ ); |
291 |
$linefilter[0] = @$filters[8] if ( $line =~ /publicationyear/ ); |
250 |
$linefilter[0] = @$filters[4] if ( $line =~ /publicationyear/ ); |
292 |
$linefilter[1] = @$filters[9] if ( $line =~ /publicationyear/ ); |
251 |
$linefilter[1] = @$filters[5] if ( $line =~ /publicationyear/ ); |
293 |
|
252 |
|
294 |
$linefilter[0] = @$filters[10] if ( $line =~ /items\.homebranch/ ); |
253 |
$linefilter[0] = @$filters[6] if ( $line =~ /items\.homebranch/ ); |
295 |
$linefilter[0] = @$filters[11] if ( $line =~ /items\.location/ ); |
254 |
$linefilter[0] = @$filters[7] if ( $line =~ /items\.location/ ); |
296 |
$linefilter[0] = @$filters[12] if ( $line =~ /items\.ccode/ ); |
255 |
$linefilter[0] = @$filters[8] if ( $line =~ /items\.ccode/ ); |
297 |
$linefilter[0] = @$filters[13] if ( $line =~ /items\.notforloan/ ); |
256 |
$linefilter[0] = @$filters[9] if ( $line =~ /items\.notforloan/ ); |
298 |
$linefilter[0] = @$filters[14] if ( $line =~ /items\.materials/ ); |
257 |
$linefilter[0] = @$filters[10] if ( $line =~ /items\.materials/ ); |
299 |
$linefilter[0] = @$filters[17] if ( $line =~ /items\.dateaccessioned/ ); |
258 |
$linefilter[0] = @$filters[13] if ( $line =~ /items\.dateaccessioned/ ); |
300 |
$linefilter[1] = @$filters[18] if ( $line =~ /items\.dateaccessioned/ ); |
259 |
$linefilter[1] = @$filters[14] if ( $line =~ /items\.dateaccessioned/ ); |
301 |
$linefilter[0] = @$filters[19] if ( $line =~ /deleteditems\.timestamp/ ); |
260 |
$linefilter[0] = @$filters[15] if ( $line =~ /deleteditems\.timestamp/ ); |
302 |
$linefilter[1] = @$filters[20] if ( $line =~ /deleteditems\.timestamp/ ); |
261 |
$linefilter[1] = @$filters[16] if ( $line =~ /deleteditems\.timestamp/ ); |
303 |
|
262 |
|
304 |
my @colfilter; |
263 |
my @colfilter; |
305 |
$colfilter[0] = @$filters[0] if ( $column =~ /dewey/ ); |
264 |
$colfilter[0] = @$filters[0] if ( $column =~ /items\.itemcallnumber/ ); |
306 |
$colfilter[1] = @$filters[1] if ( $column =~ /dewey/ ); |
265 |
$colfilter[1] = @$filters[1] if ( $column =~ /items\.itemcallnumber/ ); |
307 |
$colfilter[0] = @$filters[2] if ( $column =~ /lccn/ ); |
|
|
308 |
$colfilter[1] = @$filters[3] if ( $column =~ /lccn/ ); |
309 |
$colfilter[0] = @$filters[4] if ( $column =~ /items\.itemcallnumber/ ); |
310 |
$colfilter[1] = @$filters[5] if ( $column =~ /items\.itemcallnumber/ ); |
311 |
if ( C4::Context->preference('item-level_itypes') ) { |
266 |
if ( C4::Context->preference('item-level_itypes') ) { |
312 |
$colfilter[0] = @$filters[6] if ( $column =~ /items\.itype/ ); |
267 |
$colfilter[0] = @$filters[2] if ( $column =~ /items\.itype/ ); |
313 |
} else { |
268 |
} else { |
314 |
$colfilter[0] = @$filters[6] if ( $column =~ /itemtype/ ); |
269 |
$colfilter[0] = @$filters[2] if ( $column =~ /itemtype/ ); |
315 |
} |
270 |
} |
316 |
$colfilter[0] = @$filters[7] if ( $column =~ /publishercode/ ); |
271 |
$colfilter[0] = @$filters[3] if ( $column =~ /publishercode/ ); |
317 |
$colfilter[0] = @$filters[8] if ( $column =~ /publicationyear/ ); |
272 |
$colfilter[0] = @$filters[4] if ( $column =~ /publicationyear/ ); |
318 |
$colfilter[1] = @$filters[9] if ( $column =~ /publicationyear/ ); |
273 |
$colfilter[1] = @$filters[5] if ( $column =~ /publicationyear/ ); |
319 |
$colfilter[0] = @$filters[10] if ( $column =~ /items\.homebranch/ ); |
274 |
$colfilter[0] = @$filters[6] if ( $column =~ /items\.homebranch/ ); |
320 |
$colfilter[0] = @$filters[11] if ( $column =~ /items\.location/ ); |
275 |
$colfilter[0] = @$filters[7] if ( $column =~ /items\.location/ ); |
321 |
$colfilter[0] = @$filters[12] if ( $column =~ /items\.ccode/ ); |
276 |
$colfilter[0] = @$filters[8] if ( $column =~ /items\.ccode/ ); |
322 |
$colfilter[0] = @$filters[13] if ( $column =~ /items\.notforloan/ ); |
277 |
$colfilter[0] = @$filters[9] if ( $column =~ /items\.notforloan/ ); |
323 |
$colfilter[0] = @$filters[14] if ( $column =~ /items\.materials/ ); |
278 |
$colfilter[0] = @$filters[10] if ( $column =~ /items\.materials/ ); |
324 |
$colfilter[0] = @$filters[17] if ( $column =~ /items.dateaccessioned/ ); |
279 |
$colfilter[0] = @$filters[13] if ( $column =~ /items.dateaccessioned/ ); |
325 |
$colfilter[1] = @$filters[18] if ( $column =~ /items\.dateaccessioned/ ); |
280 |
$colfilter[1] = @$filters[14] if ( $column =~ /items\.dateaccessioned/ ); |
326 |
$colfilter[0] = @$filters[19] if ( $column =~ /deleteditems\.timestamp/ ); |
281 |
$colfilter[0] = @$filters[15] if ( $column =~ /deleteditems\.timestamp/ ); |
327 |
$colfilter[1] = @$filters[20] if ( $column =~ /deleteditems\.timestamp/ ); |
282 |
$colfilter[1] = @$filters[16] if ( $column =~ /deleteditems\.timestamp/ ); |
328 |
|
283 |
|
329 |
# 1st, loop rows. |
284 |
# 1st, loop rows. |
330 |
my $origline = $line; |
285 |
my $origline = $line; |
331 |
$line =~ s/^items\./deleteditems./ if($cellvalue eq "deleteditems"); |
286 |
$line =~ s/^items\./deleteditems./ if($cellvalue eq "deleteditems"); |
332 |
my $linefield; |
287 |
my $linefield; |
333 |
if ( ( $line =~ /dewey/ ) and ($deweydigits) ) { |
288 |
if ( ( $line =~ /itemcallnumber/ ) and ($cotedigits) ) { |
334 |
$linefield = "left($line,$deweydigits)"; |
|
|
335 |
} elsif ( ( $line =~ /lccn/ ) and ($lccndigits) ) { |
336 |
$linefield = "left($line,$lccndigits)"; |
337 |
} elsif ( ( $line =~ /itemcallnumber/ ) and ($cotedigits) ) { |
338 |
$linefield = "left($line,$cotedigits)"; |
289 |
$linefield = "left($line,$cotedigits)"; |
339 |
} elsif ( $line =~ /^deleteditems\.timestamp$/ ) { |
290 |
} elsif ( $line =~ /^deleteditems\.timestamp$/ ) { |
340 |
$linefield = "DATE($line)"; |
291 |
$linefield = "DATE($line)"; |
Lines 396-406
sub calculate {
Link Here
|
396 |
my $origcolumn = $column; |
347 |
my $origcolumn = $column; |
397 |
$column =~ s/^items\./deleteditems./ if($cellvalue eq "deleteditems"); |
348 |
$column =~ s/^items\./deleteditems./ if($cellvalue eq "deleteditems"); |
398 |
my $colfield; |
349 |
my $colfield; |
399 |
if ( ( $column =~ /dewey/ ) and ($deweydigits) ) { |
350 |
if ( ( $column =~ /itemcallnumber/ ) and ($cotedigits) ) { |
400 |
$colfield = "left($column,$deweydigits)"; |
|
|
401 |
} elsif ( ( $column =~ /lccn/ ) and ($lccndigits) ) { |
402 |
$colfield = "left($column,$lccndigits)"; |
403 |
} elsif ( ( $column =~ /itemcallnumber/ ) and ($cotedigits) ) { |
404 |
$colfield = "left($column,$cotedigits)"; |
351 |
$colfield = "left($column,$cotedigits)"; |
405 |
} elsif ( $column =~ /^deleteditems\.timestamp$/ ) { |
352 |
} elsif ( $column =~ /^deleteditems\.timestamp$/ ) { |
406 |
$colfield = "DATE($column)"; |
353 |
$colfield = "DATE($column)"; |
Lines 486-572
sub calculate {
Link Here
|
486 |
|
433 |
|
487 |
if ( @$filters[0] ) { |
434 |
if ( @$filters[0] ) { |
488 |
@$filters[0] =~ s/\*/%/g; |
435 |
@$filters[0] =~ s/\*/%/g; |
489 |
$strcalc .= " AND dewey >" . @$filters[0]; |
436 |
$strcalc .= " AND $itemstable.itemcallnumber >=" . $dbh->quote( @$filters[0] ); |
490 |
} |
437 |
} |
|
|
438 |
|
491 |
if ( @$filters[1] ) { |
439 |
if ( @$filters[1] ) { |
492 |
@$filters[1] =~ s/\*/%/g; |
440 |
@$filters[1] =~ s/\*/%/g; |
493 |
$strcalc .= " AND dewey <" . @$filters[1]; |
441 |
$strcalc .= " AND $itemstable.itemcallnumber <=" . $dbh->quote( @$filters[1] ); |
494 |
} |
442 |
} |
|
|
443 |
|
495 |
if ( @$filters[2] ) { |
444 |
if ( @$filters[2] ) { |
496 |
@$filters[2] =~ s/\*/%/g; |
445 |
@$filters[2] =~ s/\*/%/g; |
497 |
$strcalc .= " AND lccn >" . @$filters[2]; |
446 |
$strcalc .= " AND " . ( C4::Context->preference('item-level_itypes') ? "$itemstable.itype" : 'biblioitems.itemtype' ) . " LIKE '" . @$filters[2] . "'"; |
498 |
} |
447 |
} |
|
|
448 |
|
499 |
if ( @$filters[3] ) { |
449 |
if ( @$filters[3] ) { |
500 |
@$filters[3] =~ s/\*/%/g; |
450 |
@$filters[3] =~ s/\*/%/g; |
501 |
$strcalc .= " AND lccn <" . @$filters[3]; |
451 |
@$filters[3] .= "%" unless @$filters[3] =~ /%/; |
|
|
452 |
$strcalc .= " AND biblioitems.publishercode LIKE \"" . @$filters[3] . "\""; |
502 |
} |
453 |
} |
503 |
if ( @$filters[4] ) { |
454 |
if ( @$filters[4] ) { |
504 |
@$filters[4] =~ s/\*/%/g; |
455 |
@$filters[4] =~ s/\*/%/g; |
505 |
$strcalc .= " AND $itemstable.itemcallnumber >=" . $dbh->quote( @$filters[4] ); |
456 |
$strcalc .= " AND " . |
|
|
457 |
(C4::Context->preference('marcflavour') eq 'UNIMARC' ? 'publicationyear' : 'copyrightdate') |
458 |
. ">" . @$filters[4]; |
506 |
} |
459 |
} |
507 |
|
|
|
508 |
if ( @$filters[5] ) { |
460 |
if ( @$filters[5] ) { |
509 |
@$filters[5] =~ s/\*/%/g; |
461 |
@$filters[5] =~ s/\*/%/g; |
510 |
$strcalc .= " AND $itemstable.itemcallnumber <=" . $dbh->quote( @$filters[5] ); |
462 |
$strcalc .= " AND " . |
|
|
463 |
(C4::Context->preference('marcflavour') eq 'UNIMARC' ? 'publicationyear' : 'copyrightdate') |
464 |
. "<" . @$filters[5]; |
511 |
} |
465 |
} |
512 |
|
|
|
513 |
if ( @$filters[6] ) { |
466 |
if ( @$filters[6] ) { |
514 |
@$filters[6] =~ s/\*/%/g; |
467 |
@$filters[6] =~ s/\*/%/g; |
515 |
$strcalc .= " AND " . ( C4::Context->preference('item-level_itypes') ? "$itemstable.itype" : 'biblioitems.itemtype' ) . " LIKE '" . @$filters[6] . "'"; |
468 |
$strcalc .= " AND $itemstable.homebranch LIKE '" . @$filters[6] . "'"; |
516 |
} |
469 |
} |
517 |
|
|
|
518 |
if ( @$filters[7] ) { |
470 |
if ( @$filters[7] ) { |
519 |
@$filters[7] =~ s/\*/%/g; |
471 |
@$filters[7] =~ s/\*/%/g; |
520 |
@$filters[7] .= "%" unless @$filters[7] =~ /%/; |
472 |
$strcalc .= " AND $itemstable.location LIKE '" . @$filters[7] . "'"; |
521 |
$strcalc .= " AND biblioitems.publishercode LIKE \"" . @$filters[7] . "\""; |
|
|
522 |
} |
473 |
} |
523 |
if ( @$filters[8] ) { |
474 |
if ( @$filters[8] ) { |
524 |
@$filters[8] =~ s/\*/%/g; |
475 |
@$filters[8] =~ s/\*/%/g; |
525 |
$strcalc .= " AND " . |
476 |
$strcalc .= " AND $itemstable.ccode LIKE '" . @$filters[8] . "'"; |
526 |
(C4::Context->preference('marcflavour') eq 'UNIMARC' ? 'publicationyear' : 'copyrightdate') |
|
|
527 |
. ">" . @$filters[8]; |
528 |
} |
477 |
} |
529 |
if ( @$filters[9] ) { |
478 |
if ( defined @$filters[9] and @$filters[9] ne '' ) { |
530 |
@$filters[9] =~ s/\*/%/g; |
479 |
@$filters[9] =~ s/\*/%/g; |
531 |
$strcalc .= " AND " . |
480 |
$strcalc .= " AND $itemstable.notforloan LIKE '" . @$filters[9] . "'"; |
532 |
(C4::Context->preference('marcflavour') eq 'UNIMARC' ? 'publicationyear' : 'copyrightdate') |
|
|
533 |
. "<" . @$filters[9]; |
534 |
} |
481 |
} |
535 |
if ( @$filters[10] ) { |
482 |
if ( defined @$filters[10] and @$filters[10] ne '' ) { |
536 |
@$filters[10] =~ s/\*/%/g; |
483 |
@$filters[10] =~ s/\*/%/g; |
537 |
$strcalc .= " AND $itemstable.homebranch LIKE '" . @$filters[10] . "'"; |
484 |
$strcalc .= " AND $itemstable.materials LIKE '" . @$filters[10] . "'"; |
538 |
} |
|
|
539 |
if ( @$filters[11] ) { |
540 |
@$filters[11] =~ s/\*/%/g; |
541 |
$strcalc .= " AND $itemstable.location LIKE '" . @$filters[11] . "'"; |
542 |
} |
543 |
if ( @$filters[12] ) { |
544 |
@$filters[12] =~ s/\*/%/g; |
545 |
$strcalc .= " AND $itemstable.ccode LIKE '" . @$filters[12] . "'"; |
546 |
} |
485 |
} |
547 |
if ( defined @$filters[13] and @$filters[13] ne '' ) { |
486 |
if ( @$filters[13] ) { |
548 |
@$filters[13] =~ s/\*/%/g; |
487 |
@$filters[13] =~ s/\*/%/g; |
549 |
$strcalc .= " AND $itemstable.notforloan LIKE '" . @$filters[13] . "'"; |
488 |
$strcalc .= " AND $itemstable.dateaccessioned >= '@$filters[13]' "; |
550 |
} |
489 |
} |
551 |
if ( defined @$filters[14] and @$filters[14] ne '' ) { |
490 |
if ( @$filters[14] ) { |
552 |
@$filters[14] =~ s/\*/%/g; |
491 |
@$filters[14] =~ s/\*/%/g; |
553 |
$strcalc .= " AND $itemstable.materials LIKE '" . @$filters[14] . "'"; |
492 |
$strcalc .= " AND $itemstable.dateaccessioned <= '@$filters[14]' "; |
554 |
} |
|
|
555 |
if ( @$filters[17] ) { |
556 |
@$filters[17] =~ s/\*/%/g; |
557 |
$strcalc .= " AND $itemstable.dateaccessioned >= '@$filters[17]' "; |
558 |
} |
559 |
if ( @$filters[18] ) { |
560 |
@$filters[18] =~ s/\*/%/g; |
561 |
$strcalc .= " AND $itemstable.dateaccessioned <= '@$filters[18]' "; |
562 |
} |
493 |
} |
563 |
if ( $cellvalue eq 'deleteditems' and @$filters[19] ) { |
494 |
if ( $cellvalue eq 'deleteditems' and @$filters[15] ) { |
564 |
@$filters[19] =~ s/\*/%/g; |
495 |
@$filters[15] =~ s/\*/%/g; |
565 |
$strcalc .= " AND DATE(deleteditems.timestamp) >= '@$filters[19]' "; |
496 |
$strcalc .= " AND DATE(deleteditems.timestamp) >= '@$filters[15]' "; |
566 |
} |
497 |
} |
567 |
if ( $cellvalue eq 'deleteditems' and @$filters[20] ) { |
498 |
if ( $cellvalue eq 'deleteditems' and @$filters[16] ) { |
568 |
@$filters[20] =~ s/\*/%/g; |
499 |
@$filters[16] =~ s/\*/%/g; |
569 |
$strcalc .= " AND DATE(deleteditems.timestamp) <= '@$filters[20]' "; |
500 |
$strcalc .= " AND DATE(deleteditems.timestamp) <= '@$filters[16]' "; |
570 |
} |
501 |
} |
571 |
$strcalc .= " group by $linefield, $colfield order by $linefield,$colfield"; |
502 |
$strcalc .= " group by $linefield, $colfield order by $linefield,$colfield"; |
572 |
$debug and warn "SQL: $strcalc"; |
503 |
$debug and warn "SQL: $strcalc"; |
573 |
- |
|
|