Lines 23-28
use warnings;
Link Here
|
23 |
|
23 |
|
24 |
use CGI; |
24 |
use CGI; |
25 |
use Date::Manip; |
25 |
use Date::Manip; |
|
|
26 |
use Text::Unaccent; |
26 |
|
27 |
|
27 |
use C4::Auth; |
28 |
use C4::Auth; |
28 |
use C4::Debug; |
29 |
use C4::Debug; |
Lines 324-330
sub calculate {
Link Here
|
324 |
( $linesource eq 'items' ) |
325 |
( $linesource eq 'items' ) |
325 |
? " LEFT JOIN items ON (statistics.itemnumber = items.itemnumber) " |
326 |
? " LEFT JOIN items ON (statistics.itemnumber = items.itemnumber) " |
326 |
: " LEFT JOIN borrowers ON (statistics.borrowernumber = borrowers.borrowernumber) "; |
327 |
: " LEFT JOIN borrowers ON (statistics.borrowernumber = borrowers.borrowernumber) "; |
327 |
$strsth .= " WHERE $line is not null "; |
328 |
$strsth .= " WHERE $line is not null AND $line != '' "; |
328 |
} |
329 |
} |
329 |
|
330 |
|
330 |
if ( $line =~ /datetime/ ) { |
331 |
if ( $line =~ /datetime/ ) { |
Lines 412-418
sub calculate {
Link Here
|
412 |
( $colsource eq 'items' ) |
413 |
( $colsource eq 'items' ) |
413 |
? "LEFT JOIN items ON (statistics.itemnumber = items.itemnumber) " |
414 |
? "LEFT JOIN items ON (statistics.itemnumber = items.itemnumber) " |
414 |
: "LEFT JOIN borrowers ON (statistics.borrowernumber = borrowers.borrowernumber) "; |
415 |
: "LEFT JOIN borrowers ON (statistics.borrowernumber = borrowers.borrowernumber) "; |
415 |
$strsth2 .= " WHERE $column IS NOT NULL "; |
416 |
$strsth2 .= " WHERE $column IS NOT NULL AND $column != '' "; |
416 |
} |
417 |
} |
417 |
|
418 |
|
418 |
if ( $column =~ /datetime/ ) { |
419 |
if ( $column =~ /datetime/ ) { |
Lines 484-497
sub calculate {
Link Here
|
484 |
# preparing calculation |
485 |
# preparing calculation |
485 |
my $strcalc = "SELECT "; |
486 |
my $strcalc = "SELECT "; |
486 |
if($line_attribute_type) { |
487 |
if($line_attribute_type) { |
487 |
$strcalc .= "attribute_$line_attribute_type.attribute AS line_attribute, "; |
488 |
$strcalc .= "TRIM(attribute_$line_attribute_type.attribute) AS line_attribute, "; |
488 |
} else { |
489 |
} else { |
489 |
$strcalc .= "$linefield, "; |
490 |
$strcalc .= "TRIM($linefield), "; |
490 |
} |
491 |
} |
491 |
if($column_attribute_type) { |
492 |
if($column_attribute_type) { |
492 |
$strcalc .= "attribute_$column_attribute_type.attribute AS column_attribute, "; |
493 |
$strcalc .= "TRIM(attribute_$column_attribute_type.attribute) AS column_attribute, "; |
493 |
} else { |
494 |
} else { |
494 |
$strcalc .= "$colfield, "; |
495 |
$strcalc .= "TRIM($colfield), "; |
495 |
} |
496 |
} |
496 |
$strcalc .= |
497 |
$strcalc .= |
497 |
( $process == 1 ) ? " COUNT(*) " |
498 |
( $process == 1 ) ? " COUNT(*) " |
Lines 646-664
sub null_to_zzempty {
Link Here
|
646 |
sub table_set { |
647 |
sub table_set { |
647 |
my ($table, $row, $col, $val) = @_; |
648 |
my ($table, $row, $col, $val) = @_; |
648 |
|
649 |
|
649 |
$table->{ null_to_zzempty(lc($row)) }->{ null_to_zzempty(lc($col)) } = $val; |
650 |
$row = lc(unac_string('utf-8', $row // '')); |
|
|
651 |
$col = lc(unac_string('utf-8', $col // '')); |
652 |
$table->{ null_to_zzempty($row) }->{ null_to_zzempty($col) } = $val; |
650 |
} |
653 |
} |
651 |
|
654 |
|
652 |
sub table_get { |
655 |
sub table_get { |
653 |
my ($table, $row, $col) = @_; |
656 |
my ($table, $row, $col) = @_; |
654 |
|
657 |
|
655 |
return $table->{ null_to_zzempty(lc($row)) }->{ null_to_zzempty(lc($col)) }; |
658 |
$row = lc(unac_string('utf-8', $row // '')); |
|
|
659 |
$col = lc(unac_string('utf-8', $col // '')); |
660 |
return $table->{ null_to_zzempty($row) }->{ null_to_zzempty($col) }; |
656 |
} |
661 |
} |
657 |
|
662 |
|
658 |
sub table_inc { |
663 |
sub table_inc { |
659 |
my ($table, $row, $col, $inc) = @_; |
664 |
my ($table, $row, $col, $inc) = @_; |
660 |
|
665 |
|
661 |
$table->{ null_to_zzempty(lc($row // '')) }->{ null_to_zzempty(lc($col // '')) } += $inc; |
666 |
$row = lc(unac_string('utf-8', $row // '')); |
|
|
667 |
$col = lc(unac_string('utf-8', $col // '')); |
668 |
$table->{ null_to_zzempty($row) }->{ null_to_zzempty($col) } += $inc; |
662 |
} |
669 |
} |
663 |
|
670 |
|
664 |
1; |
671 |
1; |
665 |
- |
|
|