|
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 317-323
sub calculate {
Link Here
|
| 317 |
( $linesource eq 'items' ) |
318 |
( $linesource eq 'items' ) |
| 318 |
? " LEFT JOIN items ON (statistics.itemnumber = items.itemnumber) " |
319 |
? " LEFT JOIN items ON (statistics.itemnumber = items.itemnumber) " |
| 319 |
: " LEFT JOIN borrowers ON (statistics.borrowernumber = borrowers.borrowernumber) "; |
320 |
: " LEFT JOIN borrowers ON (statistics.borrowernumber = borrowers.borrowernumber) "; |
| 320 |
$strsth .= " WHERE $line is not null "; |
321 |
$strsth .= " WHERE $line is not null AND $line != '' "; |
| 321 |
} |
322 |
} |
| 322 |
|
323 |
|
| 323 |
if ( $line =~ /datetime/ ) { |
324 |
if ( $line =~ /datetime/ ) { |
|
Lines 405-411
sub calculate {
Link Here
|
| 405 |
( $colsource eq 'items' ) |
406 |
( $colsource eq 'items' ) |
| 406 |
? "LEFT JOIN items ON (statistics.itemnumber = items.itemnumber) " |
407 |
? "LEFT JOIN items ON (statistics.itemnumber = items.itemnumber) " |
| 407 |
: "LEFT JOIN borrowers ON (statistics.borrowernumber = borrowers.borrowernumber) "; |
408 |
: "LEFT JOIN borrowers ON (statistics.borrowernumber = borrowers.borrowernumber) "; |
| 408 |
$strsth2 .= " WHERE $column IS NOT NULL "; |
409 |
$strsth2 .= " WHERE $column IS NOT NULL AND $column != '' "; |
| 409 |
} |
410 |
} |
| 410 |
|
411 |
|
| 411 |
if ( $column =~ /datetime/ ) { |
412 |
if ( $column =~ /datetime/ ) { |
|
Lines 477-490
sub calculate {
Link Here
|
| 477 |
# preparing calculation |
478 |
# preparing calculation |
| 478 |
my $strcalc = "SELECT "; |
479 |
my $strcalc = "SELECT "; |
| 479 |
if($line_attribute_type) { |
480 |
if($line_attribute_type) { |
| 480 |
$strcalc .= "attribute_$line_attribute_type.attribute AS line_attribute, "; |
481 |
$strcalc .= "TRIM(attribute_$line_attribute_type.attribute) AS line_attribute, "; |
| 481 |
} else { |
482 |
} else { |
| 482 |
$strcalc .= "$linefield, "; |
483 |
$strcalc .= "TRIM($linefield), "; |
| 483 |
} |
484 |
} |
| 484 |
if($column_attribute_type) { |
485 |
if($column_attribute_type) { |
| 485 |
$strcalc .= "attribute_$column_attribute_type.attribute AS column_attribute, "; |
486 |
$strcalc .= "TRIM(attribute_$column_attribute_type.attribute) AS column_attribute, "; |
| 486 |
} else { |
487 |
} else { |
| 487 |
$strcalc .= "$colfield, "; |
488 |
$strcalc .= "TRIM($colfield), "; |
| 488 |
} |
489 |
} |
| 489 |
$strcalc .= |
490 |
$strcalc .= |
| 490 |
( $process == 1 ) ? " COUNT(*) " |
491 |
( $process == 1 ) ? " COUNT(*) " |
|
Lines 639-657
sub null_to_zzempty {
Link Here
|
| 639 |
sub table_set { |
640 |
sub table_set { |
| 640 |
my ($table, $row, $col, $val) = @_; |
641 |
my ($table, $row, $col, $val) = @_; |
| 641 |
|
642 |
|
| 642 |
$table->{ null_to_zzempty(lc($row)) }->{ null_to_zzempty(lc($col)) } = $val; |
643 |
$row = lc(unac_string('utf-8', $row // '')); |
|
|
644 |
$col = lc(unac_string('utf-8', $col // '')); |
| 645 |
$table->{ null_to_zzempty($row) }->{ null_to_zzempty($col) } = $val; |
| 643 |
} |
646 |
} |
| 644 |
|
647 |
|
| 645 |
sub table_get { |
648 |
sub table_get { |
| 646 |
my ($table, $row, $col) = @_; |
649 |
my ($table, $row, $col) = @_; |
| 647 |
|
650 |
|
| 648 |
return $table->{ null_to_zzempty(lc($row)) }->{ null_to_zzempty(lc($col)) }; |
651 |
$row = lc(unac_string('utf-8', $row // '')); |
|
|
652 |
$col = lc(unac_string('utf-8', $col // '')); |
| 653 |
return $table->{ null_to_zzempty($row) }->{ null_to_zzempty($col) }; |
| 649 |
} |
654 |
} |
| 650 |
|
655 |
|
| 651 |
sub table_inc { |
656 |
sub table_inc { |
| 652 |
my ($table, $row, $col, $inc) = @_; |
657 |
my ($table, $row, $col, $inc) = @_; |
| 653 |
|
658 |
|
| 654 |
$table->{ null_to_zzempty(lc($row // '')) }->{ null_to_zzempty(lc($col // '')) } += $inc; |
659 |
$row = lc(unac_string('utf-8', $row // '')); |
|
|
660 |
$col = lc(unac_string('utf-8', $col // '')); |
| 661 |
$table->{ null_to_zzempty($row) }->{ null_to_zzempty($col) } += $inc; |
| 655 |
} |
662 |
} |
| 656 |
|
663 |
|
| 657 |
1; |
664 |
1; |
| 658 |
- |
|
|