use Modern::Perl;
use CGI qw ( -utf8 );
-use Date::Manip;
-use C4::Auth;
-use C4::Debug;
+use C4::Auth qw( get_template_and_user );
use C4::Context;
-use C4::Koha;
-use C4::Output;
-use C4::Circulation;
-use C4::Reports;
-use C4::Members;
+use C4::Koha qw( GetAuthorisedValues );
+use C4::Output qw( output_html_with_http_headers );
+use C4::Reports qw( GetDelimiterChoices );
use Koha::AuthorisedValues;
-use Koha::DateUtils;
+use Koha::DateUtils qw( dt_from_string output_pref );
use Koha::ItemTypes;
use Koha::Patron::Attribute::Types;
=cut
-# my $debug = 1; # override for now.
my $input = CGI->new;
my $fullreportname = "reports/issues_stats.tt";
my $do_it = $input->param('do_it');
query => $input,
type => "intranet",
flagsrequired => {reports => '*'},
- debug => 0,
});
our $sep = $input->param("sep") // ';';
$sep = "\t" if ($sep eq 'tabulation');
our $itemtypes = Koha::ItemTypes->search_with_localization->unblessed;
-our @patron_categories = Koha::Patron::Categories->search_limited({}, {order_by => ['description']});
+our @patron_categories = Koha::Patron::Categories->search_with_library_limits({}, {order_by => ['description']});
our $locations = { map { ( $_->{authorised_value} => $_->{lib} ) } Koha::AuthorisedValues->get_descriptions_by_koha_field( { frameworkcode => '', kohafield => 'items.location' }, { order_by => ['description'] } ) };
our $ccodes = { map { ( $_->{authorised_value} => $_->{lib} ) } Koha::AuthorisedValues->get_descriptions_by_koha_field( { frameworkcode => '', kohafield => 'items.ccode' }, { order_by => ['description'] } ) };
push @loopfilter, { crit => "Select Month", filter => $monthsel } if ($monthsel);
my @linefilter;
- $debug and warn "filtres " . join "|", @$filters;
my ( $colsource, $linesource ) = ('', '');
$linefilter[1] = @$filters[1] if ( $line =~ /datetime/ );
$linefilter[0] =
$strsth .= " AND $line LIKE ? ";
}
$strsth .= " group by $linefield order by $lineorder ";
- $debug and warn $strsth;
push @loopfilter, { crit => 'SQL =', sql => 1, filter => $strsth };
my $sth = $dbh->prepare($strsth);
if ( (@linefilter) and ($linefilter[0]) and ($linefilter[1]) ) {
}
$strsth2 .= " group by $colfield order by $colorder ";
- $debug and warn $strsth2;
push @loopfilter, { crit => 'SQL =', sql => 1, filter => $strsth2 };
my $sth2 = $dbh->prepare($strsth2);
if ( (@colfilter) and ($colfilter[0]) and ($colfilter[1]) ) {
my %table;
foreach my $row (@loopline) {
foreach my $col (@loopcol) {
- $debug and warn " init table : $row->{rowtitle} ( $row->{rowtitle_display} ) / $col->{coltitle} ( $col->{coltitle_display} ) ";
table_set(\%table, $row->{rowtitle}, $col->{coltitle}, 0);
}
table_set(\%table, $row->{rowtitle}, 'totalrow', 0);
$strcalc .= " $colorder ";
}
- ($debug) and warn $strcalc;
my $dbcalc = $dbh->prepare($strcalc);
push @loopfilter, { crit => 'SQL =', sql => 1, filter => $strcalc };
$dbcalc->execute;
my ( $emptycol, $emptyrow );
while ( my ( $row, $col, $value ) = $dbcalc->fetchrow ) {
- ($debug) and warn "filling table $row / $col / $value ";
unless ( defined $col ) {
$emptycol = 1;
}
my $total = 0;
foreach my $row (@looprow) {
$total += table_get(\%table, $row->{rowtitle}, $col->{coltitle}) || 0;
- $debug and warn "value added " . table_get(\%table, $row->{rowtitle}, $col->{coltitle}) . "for line " . $row->{rowtitle};
}
push @loopfooter, { 'totalcol' => $total };
}