Lines 61-66
my $rodsp = $input->param("ReturnDisplay");
Link Here
|
61 |
my $calc = $input->param("Cellvalue"); |
61 |
my $calc = $input->param("Cellvalue"); |
62 |
my $output = $input->param("output"); |
62 |
my $output = $input->param("output"); |
63 |
my $basename = $input->param("basename"); |
63 |
my $basename = $input->param("basename"); |
|
|
64 |
my $itype = C4::Context->preference('item-level_itypes') ? "items.itype" : "biblioitems.itemtype"; |
65 |
|
64 |
#warn "calcul : ".$calc; |
66 |
#warn "calcul : ".$calc; |
65 |
my ($template, $borrowernumber, $cookie) |
67 |
my ($template, $borrowernumber, $cookie) |
66 |
= get_template_and_user({template_name => $fullreportname, |
68 |
= get_template_and_user({template_name => $fullreportname, |
Lines 223-230
sub calculate {
Link Here
|
223 |
# warn "filtres ".@filters[2]; |
225 |
# warn "filtres ".@filters[2]; |
224 |
# warn "filtres ".@filters[3]; |
226 |
# warn "filtres ".@filters[3]; |
225 |
$line = "old_issues.".$line if ($line=~/branchcode/) or ($line=~/timestamp/); |
227 |
$line = "old_issues.".$line if ($line=~/branchcode/) or ($line=~/timestamp/); |
226 |
$line = "biblioitems.".$line if $line=~/itemtype/; |
228 |
if ( $line=~/itemtype/ ) { $line = $itype; } |
227 |
|
|
|
228 |
$linefilter[0] = @$filters[0] if ($line =~ /timestamp/ ) ; |
229 |
$linefilter[0] = @$filters[0] if ($line =~ /timestamp/ ) ; |
229 |
$linefilter[1] = @$filters[1] if ($line =~ /timestamp/ ) ; |
230 |
$linefilter[1] = @$filters[1] if ($line =~ /timestamp/ ) ; |
230 |
$linefilter[2] = @$filters[2] if ($line =~ /timestamp/ ) ; |
231 |
$linefilter[2] = @$filters[2] if ($line =~ /timestamp/ ) ; |
Lines 236-248
sub calculate {
Link Here
|
236 |
$linefilter[0] = @$filters[8] if ($line =~ /category/ ) ; |
237 |
$linefilter[0] = @$filters[8] if ($line =~ /category/ ) ; |
237 |
$linefilter[0] = @$filters[9] if ($line =~ /itemtype/ ) ; |
238 |
$linefilter[0] = @$filters[9] if ($line =~ /itemtype/ ) ; |
238 |
$linefilter[0] = @$filters[10] if ($line =~ /branch/ ) ; |
239 |
$linefilter[0] = @$filters[10] if ($line =~ /branch/ ) ; |
239 |
# $linefilter[0] = @$filters[11] if ($line =~ /sort2/ ) ; |
|
|
240 |
$linefilter[0] = @$filters[11] if ($line =~ /sort1/ ) ; |
240 |
$linefilter[0] = @$filters[11] if ($line =~ /sort1/ ) ; |
241 |
$linefilter[0] = @$filters[12] if ($line =~ /sort2/ ) ; |
241 |
$linefilter[0] = @$filters[12] if ($line =~ /sort2/ ) ; |
242 |
#warn "filtre lignes".$linefilter[0]." ".$linefilter[1]; |
242 |
|
243 |
# |
|
|
244 |
$column = "old_issues.".$column if (($column=~/branchcode/) or ($column=~/timestamp/)); |
243 |
$column = "old_issues.".$column if (($column=~/branchcode/) or ($column=~/timestamp/)); |
245 |
$column = "biblioitems.".$column if $column=~/itemtype/; |
244 |
if ( $column=~/itemtype/ ) { $column = $itype; } |
246 |
my @colfilter ; |
245 |
my @colfilter ; |
247 |
$colfilter[0] = @$filters[0] if ($column =~ /timestamp/ ) ; |
246 |
$colfilter[0] = @$filters[0] if ($column =~ /timestamp/ ) ; |
248 |
$colfilter[1] = @$filters[1] if ($column =~ /timestamp/ ) ; |
247 |
$colfilter[1] = @$filters[1] if ($column =~ /timestamp/ ) ; |
Lines 253-264
sub calculate {
Link Here
|
253 |
$colfilter[2] = @$filters[6] if ($column =~ /returndate/ ) ; |
252 |
$colfilter[2] = @$filters[6] if ($column =~ /returndate/ ) ; |
254 |
$colfilter[3] = @$filters[7] if ($column =~ /returndate/ ) ; |
253 |
$colfilter[3] = @$filters[7] if ($column =~ /returndate/ ) ; |
255 |
$colfilter[0] = @$filters[8] if ($column =~ /category/ ) ; |
254 |
$colfilter[0] = @$filters[8] if ($column =~ /category/ ) ; |
256 |
$colfilter[0] = @$filters[9] if ($column =~ /itemtype/ ) ; |
255 |
$colfilter[0] = @$filters[9] if ($column =~ $itype ) ; |
257 |
$colfilter[0] = @$filters[10] if ($column =~ /branch/ ) ; |
256 |
$colfilter[0] = @$filters[10] if ($column =~ /branch/ ) ; |
258 |
# $colfilter[0] = @$filters[11] if ($column =~ /sort2/ ) ; |
|
|
259 |
$colfilter[0] = @$filters[11] if ($column =~ /sort1/ ) ; |
257 |
$colfilter[0] = @$filters[11] if ($column =~ /sort1/ ) ; |
260 |
$colfilter[0] = @$filters[12] if ($column =~ /sort2/ ) ; |
258 |
$colfilter[0] = @$filters[12] if ($column =~ /sort2/ ) ; |
261 |
#warn "filtre col ".$colfilter[0]." ".$colfilter[1]; |
|
|
262 |
|
259 |
|
263 |
# 1st, loop rows. |
260 |
# 1st, loop rows. |
264 |
my $linefield; |
261 |
my $linefield; |
Lines 291-297
sub calculate {
Link Here
|
291 |
LEFT JOIN biblioitems ON (biblioitems.biblioitemnumber=items.biblioitemnumber) |
288 |
LEFT JOIN biblioitems ON (biblioitems.biblioitemnumber=items.biblioitemnumber) |
292 |
LEFT JOIN issuingrules ON |
289 |
LEFT JOIN issuingrules ON |
293 |
(issuingrules.branchcode=old_issues.branchcode |
290 |
(issuingrules.branchcode=old_issues.branchcode |
294 |
AND issuingrules.itemtype=biblioitems.itemtype |
291 |
AND issuingrules.itemtype=$itype |
295 |
AND issuingrules.categorycode=borrowers.categorycode) |
292 |
AND issuingrules.categorycode=borrowers.categorycode) |
296 |
WHERE 1"; |
293 |
WHERE 1"; |
297 |
|
294 |
|
Lines 319-325
sub calculate {
Link Here
|
319 |
my $sth = $dbh->prepare( $strsth ); |
316 |
my $sth = $dbh->prepare( $strsth ); |
320 |
$sth->execute; |
317 |
$sth->execute; |
321 |
|
318 |
|
322 |
|
|
|
323 |
while ( my ($celvalue) = $sth->fetchrow) { |
319 |
while ( my ($celvalue) = $sth->fetchrow) { |
324 |
my %cell; |
320 |
my %cell; |
325 |
if ($celvalue) { |
321 |
if ($celvalue) { |
Lines 353-359
sub calculate {
Link Here
|
353 |
$colfield .= $column; |
349 |
$colfield .= $column; |
354 |
$colorder .= $column; |
350 |
$colorder .= $column; |
355 |
} |
351 |
} |
356 |
|
352 |
|
357 |
my $strsth2; |
353 |
my $strsth2; |
358 |
$strsth2 .= "SELECT distinctrow $colfield |
354 |
$strsth2 .= "SELECT distinctrow $colfield |
359 |
FROM `old_issues` |
355 |
FROM `old_issues` |
Lines 362-368
sub calculate {
Link Here
|
362 |
LEFT JOIN biblioitems ON (biblioitems.biblioitemnumber=items.biblioitemnumber) |
358 |
LEFT JOIN biblioitems ON (biblioitems.biblioitemnumber=items.biblioitemnumber) |
363 |
LEFT JOIN issuingrules ON |
359 |
LEFT JOIN issuingrules ON |
364 |
(issuingrules.branchcode=old_issues.branchcode |
360 |
(issuingrules.branchcode=old_issues.branchcode |
365 |
AND issuingrules.itemtype=biblioitems.itemtype |
361 |
AND issuingrules.itemtype=$itype |
366 |
AND issuingrules.categorycode=borrowers.categorycode) |
362 |
AND issuingrules.categorycode=borrowers.categorycode) |
367 |
WHERE 1"; |
363 |
WHERE 1"; |
368 |
|
364 |
|
Lines 388-401
sub calculate {
Link Here
|
388 |
$strsth2 .=" ORDER BY $colorder"; |
384 |
$strsth2 .=" ORDER BY $colorder"; |
389 |
|
385 |
|
390 |
my $sth2 = $dbh->prepare( $strsth2 ); |
386 |
my $sth2 = $dbh->prepare( $strsth2 ); |
|
|
387 |
|
391 |
if (( @colfilter ) and ($colfilter[1])){ |
388 |
if (( @colfilter ) and ($colfilter[1])){ |
392 |
$sth2->execute("'".$colfilter[0]."'","'".$colfilter[1]."'"); |
389 |
$sth2->execute("'".$colfilter[0]."'","'".$colfilter[1]."'"); |
393 |
} elsif ($colfilter[0]) { |
390 |
} elsif ($colfilter[0]) { |
394 |
$sth2->execute($colfilter[0]); |
391 |
$sth2->execute; |
395 |
} else { |
392 |
} else { |
396 |
$sth2->execute; |
393 |
$sth2->execute; |
397 |
} |
394 |
} |
398 |
|
|
|
399 |
|
395 |
|
400 |
while (my ($celvalue) = $sth2->fetchrow) { |
396 |
while (my ($celvalue) = $sth2->fetchrow) { |
401 |
my %cell; |
397 |
my %cell; |
Lines 430-436
sub calculate {
Link Here
|
430 |
|
426 |
|
431 |
# Processing average loanperiods |
427 |
# Processing average loanperiods |
432 |
$strcalc .= "SELECT $linefield, $colfield, "; |
428 |
$strcalc .= "SELECT $linefield, $colfield, "; |
433 |
$strcalc .= " issuedate, returndate, old_issues.timestamp, COUNT(*), date_due, old_issues.renewals, issuelength FROM `old_issues`,borrowers,biblioitems LEFT JOIN items ON (biblioitems.biblioitemnumber=items.biblioitemnumber) LEFT JOIN issuingrules ON (issuingrules.branchcode=branchcode AND issuingrules.itemtype=biblioitems.itemtype AND issuingrules.categorycode=categorycode) WHERE old_issues.itemnumber=items.itemnumber AND old_issues.borrowernumber=borrowers.borrowernumber"; |
429 |
$strcalc .= " issuedate, returndate, old_issues.timestamp, COUNT(*), date_due, old_issues.renewals, issuelength FROM `old_issues`,borrowers,biblioitems LEFT JOIN items ON (biblioitems.biblioitemnumber=items.biblioitemnumber) LEFT JOIN issuingrules ON (issuingrules.branchcode=branchcode AND issuingrules.itemtype=$itype AND issuingrules.categorycode=categorycode) WHERE old_issues.itemnumber=items.itemnumber AND old_issues.borrowernumber=borrowers.borrowernumber"; |
434 |
|
430 |
|
435 |
@$filters[0]=~ s/\*/%/g if (@$filters[0]); |
431 |
@$filters[0]=~ s/\*/%/g if (@$filters[0]); |
436 |
$strcalc .= " AND old_issues.timestamp > '" . @$filters[0] ."'" if ( @$filters[0] ); |
432 |
$strcalc .= " AND old_issues.timestamp > '" . @$filters[0] ."'" if ( @$filters[0] ); |
Lines 443-449
sub calculate {
Link Here
|
443 |
@$filters[8]=~ s/\*/%/g if (@$filters[8]); |
439 |
@$filters[8]=~ s/\*/%/g if (@$filters[8]); |
444 |
$strcalc .= " AND borrowers.categorycode like '" . @$filters[8] ."'" if ( @$filters[8] ); |
440 |
$strcalc .= " AND borrowers.categorycode like '" . @$filters[8] ."'" if ( @$filters[8] ); |
445 |
@$filters[9]=~ s/\*/%/g if (@$filters[9]); |
441 |
@$filters[9]=~ s/\*/%/g if (@$filters[9]); |
446 |
$strcalc .= " AND biblioitems.itemtype like '" . @$filters[9] ."'" if ( @$filters[9] ); |
442 |
$strcalc .= " AND $itype like '" . @$filters[9] ."'" if ( @$filters[9] ); |
447 |
@$filters[10]=~ s/\*/%/g if (@$filters[10]); |
443 |
@$filters[10]=~ s/\*/%/g if (@$filters[10]); |
448 |
$strcalc .= " AND old_issues.branchcode like '" . @$filters[10] ."'" if ( @$filters[10] ); |
444 |
$strcalc .= " AND old_issues.branchcode like '" . @$filters[10] ."'" if ( @$filters[10] ); |
449 |
@$filters[11]=~ s/\*/%/g if (@$filters[11]); |
445 |
@$filters[11]=~ s/\*/%/g if (@$filters[11]); |
Lines 467-473
sub calculate {
Link Here
|
467 |
my $err; |
463 |
my $err; |
468 |
my $emptycol; |
464 |
my $emptycol; |
469 |
my $weightrow; |
465 |
my $weightrow; |
470 |
|
466 |
|
471 |
while (my @data = $dbcalc->fetchrow) { |
467 |
while (my @data = $dbcalc->fetchrow) { |
472 |
my ($row, $col, $issuedate, $returndate, $weight)=@data; |
468 |
my ($row, $col, $issuedate, $returndate, $weight)=@data; |
473 |
# warn "filling table $row / $col / $issuedate / $returndate /$weight"; |
469 |
# warn "filling table $row / $col / $issuedate / $returndate /$weight"; |
Lines 560-565
sub calculate {
Link Here
|
560 |
$globalline{column} = $column; |
556 |
$globalline{column} = $column; |
561 |
push @mainloop,\%globalline; |
557 |
push @mainloop,\%globalline; |
562 |
return \@mainloop; |
558 |
return \@mainloop; |
|
|
559 |
|
563 |
} |
560 |
} |
564 |
|
561 |
|
565 |
1; |
562 |
1; |
566 |
- |
|
|