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

(-)a/reports/issues_stats.pl (-10 / +16 lines)
Lines 22-27 use warnings; Link Here
22
22
23
use CGI qw ( -utf8 );
23
use CGI qw ( -utf8 );
24
use Date::Manip;
24
use Date::Manip;
25
use Text::Unaccent;
25
26
26
use C4::Auth;
27
use C4::Auth;
27
use C4::Debug;
28
use C4::Debug;
Lines 320-326 sub calculate { Link Here
320
          ( $linesource eq 'items' )
321
          ( $linesource eq 'items' )
321
          ? " LEFT JOIN items ON (statistics.itemnumber = items.itemnumber) "
322
          ? " LEFT JOIN items ON (statistics.itemnumber = items.itemnumber) "
322
          : " LEFT JOIN borrowers ON (statistics.borrowernumber = borrowers.borrowernumber) ";
323
          : " LEFT JOIN borrowers ON (statistics.borrowernumber = borrowers.borrowernumber) ";
323
        $strsth .= " WHERE $line is not null ";
324
        $strsth .= " WHERE $line is not null AND $line != '' ";
324
    }
325
    }
325
326
326
    if ( $line =~ /datetime/ ) {
327
    if ( $line =~ /datetime/ ) {
Lines 408-414 sub calculate { Link Here
408
          ( $colsource eq 'items' )
409
          ( $colsource eq 'items' )
409
          ? "LEFT JOIN items ON (statistics.itemnumber = items.itemnumber) "
410
          ? "LEFT JOIN items ON (statistics.itemnumber = items.itemnumber) "
410
          : "LEFT JOIN borrowers ON (statistics.borrowernumber = borrowers.borrowernumber) ";
411
          : "LEFT JOIN borrowers ON (statistics.borrowernumber = borrowers.borrowernumber) ";
411
        $strsth2 .= " WHERE $column IS NOT NULL ";
412
        $strsth2 .= " WHERE $column IS NOT NULL AND $column != '' ";
412
    }
413
    }
413
414
414
    if ( $column =~ /datetime/ ) {
415
    if ( $column =~ /datetime/ ) {
Lines 480-493 sub calculate { Link Here
480
    # preparing calculation
481
    # preparing calculation
481
    my $strcalc = "SELECT ";
482
    my $strcalc = "SELECT ";
482
    if($line_attribute_type) {
483
    if($line_attribute_type) {
483
        $strcalc .= "attribute_$line_attribute_type.attribute AS line_attribute, ";
484
        $strcalc .= "TRIM(attribute_$line_attribute_type.attribute) AS line_attribute, ";
484
    } else {
485
    } else {
485
        $strcalc .= "$linefield, ";
486
        $strcalc .= "TRIM($linefield), ";
486
    }
487
    }
487
    if($column_attribute_type) {
488
    if($column_attribute_type) {
488
        $strcalc .= "attribute_$column_attribute_type.attribute AS column_attribute, ";
489
        $strcalc .= "TRIM(attribute_$column_attribute_type.attribute) AS column_attribute, ";
489
    } else {
490
    } else {
490
        $strcalc .= "$colfield, ";
491
        $strcalc .= "TRIM($colfield), ";
491
    }
492
    }
492
    $strcalc .=
493
    $strcalc .=
493
        ( $process == 1 ) ? " COUNT(*) "
494
        ( $process == 1 ) ? " COUNT(*) "
Lines 642-660 sub null_to_zzempty { Link Here
642
sub table_set {
643
sub table_set {
643
    my ($table, $row, $col, $val) = @_;
644
    my ($table, $row, $col, $val) = @_;
644
645
645
    $table->{ null_to_zzempty(lc($row)) }->{ null_to_zzempty(lc($col)) } = $val;
646
    $row = lc(unac_string('utf-8', $row // ''));
647
    $col = lc(unac_string('utf-8', $col // ''));
648
    $table->{ null_to_zzempty($row) }->{ null_to_zzempty($col) } = $val;
646
}
649
}
647
650
648
sub table_get {
651
sub table_get {
649
    my ($table, $row, $col) = @_;
652
    my ($table, $row, $col) = @_;
650
653
651
    return $table->{ null_to_zzempty(lc($row)) }->{ null_to_zzempty(lc($col)) };
654
    $row = lc(unac_string('utf-8', $row // ''));
655
    $col = lc(unac_string('utf-8', $col // ''));
656
    return $table->{ null_to_zzempty($row) }->{ null_to_zzempty($col) };
652
}
657
}
653
658
654
sub table_inc {
659
sub table_inc {
655
    my ($table, $row, $col, $inc) = @_;
660
    my ($table, $row, $col, $inc) = @_;
656
661
657
    $table->{ null_to_zzempty(lc($row // '')) }->{ null_to_zzempty(lc($col // '')) } += $inc;
662
    $row = lc(unac_string('utf-8', $row // ''));
663
    $col = lc(unac_string('utf-8', $col // ''));
664
    $table->{ null_to_zzempty($row) }->{ null_to_zzempty($col) } += $inc;
658
}
665
}
659
666
660
1;
667
1;
661
- 

Return to bug 7679