Bug 14961: Remove C4::Dates from files reports/*_stats.pl
Remove C4::Dates from following files:
- reports/acquisitions_stats.pl
- reports/borrowers_stats.pl
- reports/reserves_stats.pl
- reports/serials_stats.pl
- reports/issues_avg_stats.pl
- reports/issues_stats.pl
To test:
- Go to Home > Reports
- Verify that following reports work as before:
- Other > Average loan time
- Statistic wizards
- Acquisitions
- Patrons
- Circulation
- Serials
- Holds
Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
This commit is contained in:
parent
9faada90bc
commit
17af2c9a1e
|
|
@ -26,9 +26,9 @@ use C4::Reports;
|
|||
use C4::Output;
|
||||
use C4::Koha;
|
||||
use C4::Circulation;
|
||||
use C4::Dates qw/format_date format_date_in_iso/;
|
||||
use C4::Branch;
|
||||
use C4::Biblio;
|
||||
use Koha::DateUtils;
|
||||
|
||||
=head1 NAME
|
||||
|
||||
|
|
@ -46,10 +46,14 @@ my $fullreportname = "reports/acquisitions_stats.tt";
|
|||
my $line = $input->param("Line");
|
||||
my $column = $input->param("Column");
|
||||
my @filters = $input->param("Filter");
|
||||
$filters[0] = format_date_in_iso( $filters[0] );
|
||||
$filters[1] = format_date_in_iso( $filters[1] );
|
||||
$filters[2] = format_date_in_iso( $filters[2] );
|
||||
$filters[3] = format_date_in_iso( $filters[3] );
|
||||
$filters[0] = eval { output_pref( { dt => dt_from_string( $filters[0]), dateonly => 1, dateformat => 'iso' } ); }
|
||||
if ( $filters[0] );
|
||||
$filters[1] = eval { output_pref( { dt => dt_from_string( $filters[1]), dateonly => 1, dateformat => 'iso' } ); }
|
||||
if ( $filters[1] );
|
||||
$filters[2] = eval { output_pref( { dt => dt_from_string( $filters[2]), dateonly => 1, dateformat => 'iso' } ); }
|
||||
if ( $filters[2] );
|
||||
$filters[3] = eval { output_pref( { dt => dt_from_string( $filters[3]), dateonly => 1, dateformat => 'iso' } ); }
|
||||
if ( $filters[3] );
|
||||
my $podsp = $input->param("PlacedOnDisplay");
|
||||
my $rodsp = $input->param("ReceivedOnDisplay");
|
||||
my $calc = $input->param("Cellvalue");
|
||||
|
|
@ -253,7 +257,8 @@ sub calculate {
|
|||
if ($i >= 4) {
|
||||
$cell{filter} = @$filters[$i];
|
||||
} else {
|
||||
$cell{filter} = format_date(@$filters[$i]);
|
||||
$cell{filter} = eval { output_pref( { dt => dt_from_string( @$filters[$i] ), dateonly => 1 }); }
|
||||
if ( @$filters[$i] );
|
||||
}
|
||||
$cell{crit} = $i;
|
||||
push @loopfilter, \%cell;
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ use C4::Auth;
|
|||
use C4::Context;
|
||||
use C4::Branch; # GetBranches
|
||||
use C4::Koha;
|
||||
use C4::Dates;
|
||||
use Koha::DateUtils;
|
||||
use C4::Acquisition;
|
||||
use C4::Output;
|
||||
use C4::Reports;
|
||||
|
|
@ -53,8 +53,10 @@ my $fullreportname = "reports/borrowers_stats.tt";
|
|||
my $line = $input->param("Line");
|
||||
my $column = $input->param("Column");
|
||||
my @filters = $input->param("Filter");
|
||||
$filters[3]=format_date_in_iso($filters[3]);
|
||||
$filters[4]=format_date_in_iso($filters[4]);
|
||||
$filters[3] = eval { output_pref( { dt => dt_from_string( $filters[3]), dateonly => 1, dateformat => 'iso' } ); }
|
||||
if ( $filters[3] );
|
||||
$filters[4] = eval { output_pref ({ dt => dt_from_string( $filters[4]), dateonly => 1, dateformat => 'iso' } ); }
|
||||
if ( $filters[4] );
|
||||
my $digits = $input->param("digits");
|
||||
our $period = $input->param("period");
|
||||
my $borstat = $input->param("status");
|
||||
|
|
@ -221,7 +223,8 @@ sub calculate {
|
|||
my %cell;
|
||||
if ( @$filters[$i] ) {
|
||||
if ($i == 3 or $i == 4) {
|
||||
$cell{filter} = format_date(@$filters[$i]);
|
||||
$cell{filter} = eval { output_pref( { dt => dt_from_string( @$filters[$i] ), dateonly => 1 }); }
|
||||
if ( @$filters[$i] );
|
||||
} else {
|
||||
$cell{filter} = @$filters[$i];
|
||||
}
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ use C4::Output;
|
|||
use C4::Koha;
|
||||
use C4::Circulation;
|
||||
use C4::Reports;
|
||||
use C4::Dates qw/format_date format_date_in_iso/;
|
||||
use Koha::DateUtils;
|
||||
use Date::Calc qw(Delta_Days);
|
||||
|
||||
=head1 NAME
|
||||
|
|
@ -47,10 +47,16 @@ my $fullreportname = "reports/issues_avg_stats.tt";
|
|||
my $line = $input->param("Line");
|
||||
my $column = $input->param("Column");
|
||||
my @filters = $input->param("Filter");
|
||||
$filters[0]=format_date_in_iso($filters[0]);
|
||||
$filters[1]=format_date_in_iso($filters[1]);
|
||||
$filters[2]=format_date_in_iso($filters[2]);
|
||||
$filters[3]=format_date_in_iso($filters[3]);
|
||||
$filters[0] = eval { output_pref( { dt => dt_from_string( $filters[0]), dateonly => 1, dateformat => 'iso' } ); }
|
||||
if ( $filters[0] );
|
||||
$filters[1] = eval { output_pref( { dt => dt_from_string( $filters[1]), dateonly => 1, dateformat => 'iso' } ); }
|
||||
if ( $filters[1] );
|
||||
$filters[2] = eval { output_pref( { dt => dt_from_string( $filters[2]), dateonly => 1, dateformat => 'iso' } ); }
|
||||
if ( $filters[2] );
|
||||
$filters[3] = eval { output_pref( { dt => dt_from_string( $filters[3]), dateonly => 1, dateformat => 'iso' } ); }
|
||||
if ( $filters[3] );
|
||||
|
||||
|
||||
my $podsp = $input->param("IssueDisplay");
|
||||
my $rodsp = $input->param("ReturnDisplay");
|
||||
my $calc = $input->param("Cellvalue");
|
||||
|
|
@ -213,7 +219,8 @@ sub calculate {
|
|||
if ($i>=4) {
|
||||
$cell{filter} .= @$filters[$i];
|
||||
} else {
|
||||
$cell{filter} .= format_date(@$filters[$i]);
|
||||
$cell{filter} .= eval { output_pref( { dt => dt_from_string( @$filters[$i] ), dateonly => 1 }); }
|
||||
if ( @$filters[$i] );
|
||||
}
|
||||
$cell{crit} .="Issue From" if ($i==0);
|
||||
$cell{crit} .="Issue To" if ($i==1);
|
||||
|
|
|
|||
|
|
@ -31,8 +31,8 @@ use C4::Koha;
|
|||
use C4::Output;
|
||||
use C4::Circulation;
|
||||
use C4::Reports;
|
||||
use C4::Dates qw/format_date format_date_in_iso/;
|
||||
use C4::Members;
|
||||
use Koha::DateUtils;
|
||||
|
||||
=head1 NAME
|
||||
|
||||
|
|
@ -51,8 +51,10 @@ my $do_it = $input->param('do_it');
|
|||
my $line = $input->param("Line");
|
||||
my $column = $input->param("Column");
|
||||
my @filters = $input->param("Filter");
|
||||
$filters[0]=format_date_in_iso($filters[0]);
|
||||
$filters[1]=format_date_in_iso($filters[1]);
|
||||
$filters[0] = eval { output_pref( { dt => dt_from_string( $filters[0]), dateonly => 1, dateformat => 'iso' } ); }
|
||||
if ( $filters[0] );
|
||||
$filters[1] = eval { output_pref( { dt => dt_from_string( $filters[1]), dateonly => 1, dateformat => 'iso' } ); }
|
||||
if ( $filters[1] );
|
||||
my $podsp = $input->param("DisplayBy");
|
||||
my $type = $input->param("PeriodTypeSel");
|
||||
my $daysel = $input->param("PeriodDaySel");
|
||||
|
|
@ -189,7 +191,8 @@ sub calculate {
|
|||
if ($i>=2) {
|
||||
$cell{filter} = @$filters[$i];
|
||||
} else {
|
||||
$cell{filter} = format_date(@$filters[$i]);
|
||||
$cell{filter} = eval { output_pref( { dt => dt_from_string( @$filters[$i] ), dateonly => 1 }); }
|
||||
if ( @$filters[$i] );
|
||||
}
|
||||
$cell{crit} =
|
||||
( $i == 0 ) ? "Period From"
|
||||
|
|
@ -261,7 +264,7 @@ sub calculate {
|
|||
$linefield = ($dsp == 1) ? " dayname($line)" :
|
||||
($dsp == 2) ? "monthname($line)" :
|
||||
($dsp == 3) ? " Year($line)" :
|
||||
'date_format(`datetime`,"%Y-%m-%d")'; # Probably should be left alone or passed through C4::Dates
|
||||
'date_format(`datetime`,"%Y-%m-%d")'; # Probably should be left alone or passed through Koha::DateUtils
|
||||
} else {
|
||||
$linefield = $line;
|
||||
}
|
||||
|
|
@ -336,7 +339,7 @@ sub calculate {
|
|||
$colfield = ($dsp == 1) ? " dayname($column)" :
|
||||
($dsp == 2) ? "monthname($column)" :
|
||||
($dsp == 3) ? " Year($column)" :
|
||||
'date_format(`datetime`,"%Y-%m-%d")'; # Probably should be left alone or passed through C4::Dates
|
||||
'date_format(`datetime`,"%Y-%m-%d")'; # Probably should be left alone or passed through Koha::DateUtils
|
||||
} else {
|
||||
$colfield = $column;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -31,8 +31,8 @@ use C4::Koha;
|
|||
use C4::Output;
|
||||
use C4::Reports;
|
||||
use C4::Members;
|
||||
use C4::Dates qw/format_date format_date_in_iso/;
|
||||
use C4::Category;
|
||||
use Koha::DateUtils;
|
||||
use List::MoreUtils qw/any/;
|
||||
use YAML;
|
||||
|
||||
|
|
@ -190,9 +190,10 @@ sub calculate {
|
|||
my @loopfilter;
|
||||
foreach my $filter ( keys %$filters_hashref ) {
|
||||
$filters_hashref->{$filter} =~ s/\*/%/;
|
||||
$filters_hashref->{$filter} =
|
||||
format_date_in_iso( $filters_hashref->{$filter} )
|
||||
if ( $filter =~ /date/ );
|
||||
if ( $filter =~ /date/ ) {
|
||||
$filters_hashref->{$filter} =
|
||||
eval { output_pref( { dt => dt_from_string( $filters_hashref->{$filter} ), dateonly => 1, dateformat => 'iso' }); };
|
||||
}
|
||||
}
|
||||
|
||||
#display
|
||||
|
|
@ -201,7 +202,7 @@ sub calculate {
|
|||
crit => $_,
|
||||
filter => (
|
||||
$_ =~ /date/
|
||||
? format_date( $filters_hashref->{$_} )
|
||||
? eval { output_pref( { dt => dt_from_string( $filters_hashref->{$_} ), dateonly => 1 }); }
|
||||
: $filters_hashref->{$_}
|
||||
)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -23,7 +23,6 @@ use C4::Auth;
|
|||
use CGI qw ( -utf8 );
|
||||
use C4::Context;
|
||||
use C4::Branch; # GetBranches
|
||||
use C4::Dates qw/format_date/;
|
||||
use C4::Output;
|
||||
use C4::Koha;
|
||||
use C4::Reports;
|
||||
|
|
@ -35,8 +34,6 @@ plugin that shows a stats on serials
|
|||
|
||||
=head1 DESCRIPTION
|
||||
|
||||
=over 2
|
||||
|
||||
=cut
|
||||
|
||||
my $input = new CGI;
|
||||
|
|
|
|||
Loading…
Reference in New Issue