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

(-)a/reports/issues_stats.pl (-5 / +4 lines)
Lines 324-331 sub calculate { Link Here
324
          ( $linesource eq 'items' )
324
          ( $linesource eq 'items' )
325
          ? " LEFT JOIN items ON (statistics.itemnumber = items.itemnumber) "
325
          ? " LEFT JOIN items ON (statistics.itemnumber = items.itemnumber) "
326
          : " LEFT JOIN borrowers ON (statistics.borrowernumber = borrowers.borrowernumber) ";
326
          : " LEFT JOIN borrowers ON (statistics.borrowernumber = borrowers.borrowernumber) ";
327
        $strsth .= " WHERE $line is not null ";
327
    }
328
    }
328
    $strsth .= " WHERE $line is not null ";
329
329
330
    if ( $line =~ /datetime/ ) {
330
    if ( $line =~ /datetime/ ) {
331
        if ( $linefilter[1] and ( $linefilter[0] ) ) {
331
        if ( $linefilter[1] and ( $linefilter[0] ) ) {
Lines 412-419 sub calculate { Link Here
412
          ( $colsource eq 'items' )
412
          ( $colsource eq 'items' )
413
          ? "LEFT JOIN items ON (statistics.itemnumber = items.itemnumber) "
413
          ? "LEFT JOIN items ON (statistics.itemnumber = items.itemnumber) "
414
          : "LEFT JOIN borrowers ON (statistics.borrowernumber = borrowers.borrowernumber) ";
414
          : "LEFT JOIN borrowers ON (statistics.borrowernumber = borrowers.borrowernumber) ";
415
        $strsth2 .= " WHERE $column IS NOT NULL ";
415
    }
416
    }
416
    $strsth2 .= " WHERE $column IS NOT NULL ";
417
417
418
    if ( $column =~ /datetime/ ) {
418
    if ( $column =~ /datetime/ ) {
419
        if ( ( $colfilter[1] ) and ( $colfilter[0] ) ) {
419
        if ( ( $colfilter[1] ) and ( $colfilter[0] ) ) {
Lines 612-618 sub calculate { Link Here
612
    for my $col (@loopcol) {
612
    for my $col (@loopcol) {
613
        my $total = 0;
613
        my $total = 0;
614
        foreach my $row (@looprow) {
614
        foreach my $row (@looprow) {
615
            $total += table_get(\%table, $row->{rowtitle}, $col->{coltitle});
615
            $total += table_get(\%table, $row->{rowtitle}, $col->{coltitle}) || 0;
616
            $debug and warn "value added " . table_get(\%table, $row->{rowtitle}, $col->{coltitle}) . "for line " . $row->{rowtitle};
616
            $debug and warn "value added " . table_get(\%table, $row->{rowtitle}, $col->{coltitle}) . "for line " . $row->{rowtitle};
617
        }
617
        }
618
        push @loopfooter, { 'totalcol' => $total };
618
        push @loopfooter, { 'totalcol' => $total };
Lines 658-664 sub table_get { Link Here
658
sub table_inc {
658
sub table_inc {
659
    my ($table, $row, $col, $inc) = @_;
659
    my ($table, $row, $col, $inc) = @_;
660
660
661
    $table->{ null_to_zzempty(lc($row)) }->{ null_to_zzempty(lc($col)) } += $inc;
661
    $table->{ null_to_zzempty(lc($row // '')) }->{ null_to_zzempty(lc($col // '')) } += $inc;
662
}
662
}
663
663
664
1;
664
1;
665
- 

Return to bug 7679