use CGI qw ( -utf8 );
use Date::Manip;
+use Text::Unaccent;
use C4::Auth;
use C4::Debug;
( $linesource eq 'items' )
? " LEFT JOIN items ON (statistics.itemnumber = items.itemnumber) "
: " LEFT JOIN borrowers ON (statistics.borrowernumber = borrowers.borrowernumber) ";
- $strsth .= " WHERE $line is not null ";
+ $strsth .= " WHERE $line is not null AND $line != '' ";
}
if ( $line =~ /datetime/ ) {
( $colsource eq 'items' )
? "LEFT JOIN items ON (statistics.itemnumber = items.itemnumber) "
: "LEFT JOIN borrowers ON (statistics.borrowernumber = borrowers.borrowernumber) ";
- $strsth2 .= " WHERE $column IS NOT NULL ";
+ $strsth2 .= " WHERE $column IS NOT NULL AND $column != '' ";
}
if ( $column =~ /datetime/ ) {
# preparing calculation
my $strcalc = "SELECT ";
if($line_attribute_type) {
- $strcalc .= "attribute_$line_attribute_type.attribute AS line_attribute, ";
+ $strcalc .= "TRIM(attribute_$line_attribute_type.attribute) AS line_attribute, ";
} else {
- $strcalc .= "$linefield, ";
+ $strcalc .= "TRIM($linefield), ";
}
if($column_attribute_type) {
- $strcalc .= "attribute_$column_attribute_type.attribute AS column_attribute, ";
+ $strcalc .= "TRIM(attribute_$column_attribute_type.attribute) AS column_attribute, ";
} else {
- $strcalc .= "$colfield, ";
+ $strcalc .= "TRIM($colfield), ";
}
$strcalc .=
( $process == 1 ) ? " COUNT(*) "
sub table_set {
my ($table, $row, $col, $val) = @_;
- $table->{ null_to_zzempty(lc($row)) }->{ null_to_zzempty(lc($col)) } = $val;
+ $row = lc(unac_string('utf-8', $row // ''));
+ $col = lc(unac_string('utf-8', $col // ''));
+ $table->{ null_to_zzempty($row) }->{ null_to_zzempty($col) } = $val;
}
sub table_get {
my ($table, $row, $col) = @_;
- return $table->{ null_to_zzempty(lc($row)) }->{ null_to_zzempty(lc($col)) };
+ $row = lc(unac_string('utf-8', $row // ''));
+ $col = lc(unac_string('utf-8', $col // ''));
+ return $table->{ null_to_zzempty($row) }->{ null_to_zzempty($col) };
}
sub table_inc {
my ($table, $row, $col, $inc) = @_;
- $table->{ null_to_zzempty(lc($row // '')) }->{ null_to_zzempty(lc($col // '')) } += $inc;
+ $row = lc(unac_string('utf-8', $row // ''));
+ $col = lc(unac_string('utf-8', $col // ''));
+ $table->{ null_to_zzempty($row) }->{ null_to_zzempty($col) } += $inc;
}
1;