Lines 318-325
sub calculate {
Link Here
|
318 |
( $linesource eq 'items' ) |
318 |
( $linesource eq 'items' ) |
319 |
? " LEFT JOIN items ON (statistics.itemnumber = items.itemnumber) " |
319 |
? " LEFT JOIN items ON (statistics.itemnumber = items.itemnumber) " |
320 |
: " LEFT JOIN borrowers ON (statistics.borrowernumber = borrowers.borrowernumber) "; |
320 |
: " LEFT JOIN borrowers ON (statistics.borrowernumber = borrowers.borrowernumber) "; |
|
|
321 |
$strsth .= " WHERE $line is not null "; |
321 |
} |
322 |
} |
322 |
$strsth .= " WHERE $line is not null "; |
|
|
323 |
|
323 |
|
324 |
if ( $line =~ /datetime/ ) { |
324 |
if ( $line =~ /datetime/ ) { |
325 |
if ( $linefilter[1] and ( $linefilter[0] ) ) { |
325 |
if ( $linefilter[1] and ( $linefilter[0] ) ) { |
Lines 406-413
sub calculate {
Link Here
|
406 |
( $colsource eq 'items' ) |
406 |
( $colsource eq 'items' ) |
407 |
? "LEFT JOIN items ON (statistics.itemnumber = items.itemnumber) " |
407 |
? "LEFT JOIN items ON (statistics.itemnumber = items.itemnumber) " |
408 |
: "LEFT JOIN borrowers ON (statistics.borrowernumber = borrowers.borrowernumber) "; |
408 |
: "LEFT JOIN borrowers ON (statistics.borrowernumber = borrowers.borrowernumber) "; |
|
|
409 |
$strsth2 .= " WHERE $column IS NOT NULL "; |
409 |
} |
410 |
} |
410 |
$strsth2 .= " WHERE $column IS NOT NULL "; |
|
|
411 |
|
411 |
|
412 |
if ( $column =~ /datetime/ ) { |
412 |
if ( $column =~ /datetime/ ) { |
413 |
if ( ( $colfilter[1] ) and ( $colfilter[0] ) ) { |
413 |
if ( ( $colfilter[1] ) and ( $colfilter[0] ) ) { |
Lines 606-612
sub calculate {
Link Here
|
606 |
for my $col (@loopcol) { |
606 |
for my $col (@loopcol) { |
607 |
my $total = 0; |
607 |
my $total = 0; |
608 |
foreach my $row (@looprow) { |
608 |
foreach my $row (@looprow) { |
609 |
$total += table_get(\%table, $row->{rowtitle}, $col->{coltitle}); |
609 |
$total += table_get(\%table, $row->{rowtitle}, $col->{coltitle}) || 0; |
610 |
$debug and warn "value added " . table_get(\%table, $row->{rowtitle}, $col->{coltitle}) . "for line " . $row->{rowtitle}; |
610 |
$debug and warn "value added " . table_get(\%table, $row->{rowtitle}, $col->{coltitle}) . "for line " . $row->{rowtitle}; |
611 |
} |
611 |
} |
612 |
push @loopfooter, { 'totalcol' => $total }; |
612 |
push @loopfooter, { 'totalcol' => $total }; |
Lines 652-658
sub table_get {
Link Here
|
652 |
sub table_inc { |
652 |
sub table_inc { |
653 |
my ($table, $row, $col, $inc) = @_; |
653 |
my ($table, $row, $col, $inc) = @_; |
654 |
|
654 |
|
655 |
$table->{ null_to_zzempty(lc($row)) }->{ null_to_zzempty(lc($col)) } += $inc; |
655 |
$table->{ null_to_zzempty(lc($row // '')) }->{ null_to_zzempty(lc($col // '')) } += $inc; |
656 |
} |
656 |
} |
657 |
|
657 |
|
658 |
1; |
658 |
1; |
659 |
- |
|
|