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