View | Details | Raw Unified | Return to bug 7679
Collapse All | Expand All

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

Return to bug 7679