View | Details | Raw Unified | Return to bug 14961
Collapse All | Expand All

(-)a/reports/acquisitions_stats.pl (-6 / +11 lines)
Lines 26-34 use C4::Reports; Link Here
26
use C4::Output;
26
use C4::Output;
27
use C4::Koha;
27
use C4::Koha;
28
use C4::Circulation;
28
use C4::Circulation;
29
use C4::Dates qw/format_date format_date_in_iso/;
30
use C4::Branch;
29
use C4::Branch;
31
use C4::Biblio;
30
use C4::Biblio;
31
use Koha::DateUtils;
32
32
33
=head1 NAME
33
=head1 NAME
34
34
Lines 46-55 my $fullreportname = "reports/acquisitions_stats.tt"; Link Here
46
my $line           = $input->param("Line");
46
my $line           = $input->param("Line");
47
my $column         = $input->param("Column");
47
my $column         = $input->param("Column");
48
my @filters        = $input->param("Filter");
48
my @filters        = $input->param("Filter");
49
$filters[0] = format_date_in_iso( $filters[0] );
49
$filters[0] = eval { output_pref( { dt => dt_from_string( $filters[0]), dateonly => 1, dateformat => 'iso' } ); }
50
$filters[1] = format_date_in_iso( $filters[1] );
50
    if ( $filters[0] );
51
$filters[2] = format_date_in_iso( $filters[2] );
51
$filters[1] = eval { output_pref( { dt => dt_from_string( $filters[1]), dateonly => 1, dateformat => 'iso' } ); }
52
$filters[3] = format_date_in_iso( $filters[3] );
52
    if ( $filters[1] );
53
$filters[2] = eval { output_pref( { dt => dt_from_string( $filters[2]), dateonly => 1, dateformat => 'iso' } ); }
54
    if ( $filters[2] );
55
$filters[3] = eval { output_pref( { dt => dt_from_string( $filters[3]), dateonly => 1, dateformat => 'iso' } ); }
56
    if ( $filters[3] );
53
my $podsp          = $input->param("PlacedOnDisplay");
57
my $podsp          = $input->param("PlacedOnDisplay");
54
my $rodsp          = $input->param("ReceivedOnDisplay");
58
my $rodsp          = $input->param("ReceivedOnDisplay");
55
my $calc           = $input->param("Cellvalue");
59
my $calc           = $input->param("Cellvalue");
Lines 253-259 sub calculate { Link Here
253
            if ($i >= 4) {
257
            if ($i >= 4) {
254
                $cell{filter} = @$filters[$i];
258
                $cell{filter} = @$filters[$i];
255
            } else {
259
            } else {
256
                $cell{filter} = format_date(@$filters[$i]);
260
                $cell{filter} = eval { output_pref( { dt => dt_from_string( @$filters[$i] ), dateonly => 1 }); }
261
                   if ( @$filters[$i] );
257
            }
262
            }
258
            $cell{crit} = $i;
263
            $cell{crit} = $i;
259
            push @loopfilter, \%cell;
264
            push @loopfilter, \%cell;
(-)a/reports/borrowers_stats.pl (-4 / +7 lines)
Lines 25-31 use C4::Auth; Link Here
25
use C4::Context;
25
use C4::Context;
26
use C4::Branch; # GetBranches
26
use C4::Branch; # GetBranches
27
use C4::Koha;
27
use C4::Koha;
28
use C4::Dates;
28
use Koha::DateUtils;
29
use C4::Acquisition;
29
use C4::Acquisition;
30
use C4::Output;
30
use C4::Output;
31
use C4::Reports;
31
use C4::Reports;
Lines 53-60 my $fullreportname = "reports/borrowers_stats.tt"; Link Here
53
my $line = $input->param("Line");
53
my $line = $input->param("Line");
54
my $column = $input->param("Column");
54
my $column = $input->param("Column");
55
my @filters = $input->param("Filter");
55
my @filters = $input->param("Filter");
56
$filters[3]=format_date_in_iso($filters[3]);
56
$filters[3] = eval { output_pref( { dt => dt_from_string( $filters[3]), dateonly => 1, dateformat => 'iso' } ); }
57
$filters[4]=format_date_in_iso($filters[4]);
57
    if ( $filters[3] );
58
$filters[4] = eval { output_pref ({ dt => dt_from_string( $filters[4]), dateonly => 1, dateformat => 'iso' } ); }
59
    if ( $filters[4] );
58
my $digits = $input->param("digits");
60
my $digits = $input->param("digits");
59
our $period = $input->param("period");
61
our $period = $input->param("period");
60
my $borstat = $input->param("status");
62
my $borstat = $input->param("status");
Lines 221-227 sub calculate { Link Here
221
        my %cell;
223
        my %cell;
222
        if ( @$filters[$i] ) {
224
        if ( @$filters[$i] ) {
223
            if ($i == 3 or $i == 4) {
225
            if ($i == 3 or $i == 4) {
224
                $cell{filter} = format_date(@$filters[$i]);
226
                $cell{filter} = eval { output_pref( { dt => dt_from_string( @$filters[$i] ), dateonly => 1 }); }
227
                    if ( @$filters[$i] );
225
            } else {
228
            } else {
226
                $cell{filter} = @$filters[$i];
229
                $cell{filter} = @$filters[$i];
227
            }
230
            }
(-)a/reports/issues_avg_stats.pl (-6 / +13 lines)
Lines 28-34 use C4::Output; Link Here
28
use C4::Koha;
28
use C4::Koha;
29
use C4::Circulation;
29
use C4::Circulation;
30
use C4::Reports;
30
use C4::Reports;
31
use C4::Dates qw/format_date format_date_in_iso/;
31
use Koha::DateUtils;
32
use Date::Calc qw(Delta_Days);
32
use Date::Calc qw(Delta_Days);
33
33
34
=head1 NAME
34
=head1 NAME
Lines 47-56 my $fullreportname = "reports/issues_avg_stats.tt"; Link Here
47
my $line = $input->param("Line");
47
my $line = $input->param("Line");
48
my $column = $input->param("Column");
48
my $column = $input->param("Column");
49
my @filters = $input->param("Filter");
49
my @filters = $input->param("Filter");
50
$filters[0]=format_date_in_iso($filters[0]);
50
$filters[0] = eval { output_pref( { dt => dt_from_string( $filters[0]), dateonly => 1, dateformat => 'iso' } ); }
51
$filters[1]=format_date_in_iso($filters[1]);
51
    if ( $filters[0] );
52
$filters[2]=format_date_in_iso($filters[2]);
52
$filters[1] = eval { output_pref( { dt => dt_from_string( $filters[1]), dateonly => 1, dateformat => 'iso' } ); }
53
$filters[3]=format_date_in_iso($filters[3]);
53
    if ( $filters[1] );
54
$filters[2] = eval { output_pref( { dt => dt_from_string( $filters[2]), dateonly => 1, dateformat => 'iso' } ); }
55
    if ( $filters[2] );
56
$filters[3] = eval { output_pref( { dt => dt_from_string( $filters[3]), dateonly => 1, dateformat => 'iso' } ); }
57
    if ( $filters[3] );
58
59
54
my $podsp = $input->param("IssueDisplay");
60
my $podsp = $input->param("IssueDisplay");
55
my $rodsp = $input->param("ReturnDisplay");
61
my $rodsp = $input->param("ReturnDisplay");
56
my $calc = $input->param("Cellvalue");
62
my $calc = $input->param("Cellvalue");
Lines 213-219 sub calculate { Link Here
213
            if ($i>=4) {
219
            if ($i>=4) {
214
                $cell{filter} .= @$filters[$i];
220
                $cell{filter} .= @$filters[$i];
215
            } else {
221
            } else {
216
                $cell{filter} .= format_date(@$filters[$i]);
222
                $cell{filter} .= eval { output_pref( { dt => dt_from_string( @$filters[$i] ), dateonly => 1 }); }
223
                   if ( @$filters[$i] );
217
            }
224
            }
218
            $cell{crit} .="Issue From" if ($i==0);
225
            $cell{crit} .="Issue From" if ($i==0);
219
            $cell{crit} .="Issue To" if ($i==1);
226
            $cell{crit} .="Issue To" if ($i==1);
(-)a/reports/issues_stats.pl (-6 / +9 lines)
Lines 31-38 use C4::Koha; Link Here
31
use C4::Output;
31
use C4::Output;
32
use C4::Circulation;
32
use C4::Circulation;
33
use C4::Reports;
33
use C4::Reports;
34
use C4::Dates qw/format_date format_date_in_iso/;
35
use C4::Members;
34
use C4::Members;
35
use Koha::DateUtils;
36
36
37
=head1 NAME
37
=head1 NAME
38
38
Lines 51-58 my $do_it = $input->param('do_it'); Link Here
51
my $line     = $input->param("Line");
51
my $line     = $input->param("Line");
52
my $column   = $input->param("Column");
52
my $column   = $input->param("Column");
53
my @filters  = $input->param("Filter");
53
my @filters  = $input->param("Filter");
54
$filters[0]=format_date_in_iso($filters[0]);
54
$filters[0] = eval { output_pref( { dt => dt_from_string( $filters[0]), dateonly => 1, dateformat => 'iso' } ); }
55
$filters[1]=format_date_in_iso($filters[1]);
55
    if ( $filters[0] );
56
$filters[1] = eval { output_pref( { dt => dt_from_string( $filters[1]), dateonly => 1, dateformat => 'iso' } ); }
57
    if ( $filters[1] );
56
my $podsp    = $input->param("DisplayBy");
58
my $podsp    = $input->param("DisplayBy");
57
my $type     = $input->param("PeriodTypeSel");
59
my $type     = $input->param("PeriodTypeSel");
58
my $daysel   = $input->param("PeriodDaySel");
60
my $daysel   = $input->param("PeriodDaySel");
Lines 189-195 sub calculate { Link Here
189
        if ($i>=2) {
191
        if ($i>=2) {
190
          	$cell{filter} = @$filters[$i];
192
          	$cell{filter} = @$filters[$i];
191
        } else {
193
        } else {
192
          	$cell{filter} = format_date(@$filters[$i]);
194
                $cell{filter} = eval { output_pref( { dt => dt_from_string( @$filters[$i] ), dateonly => 1 }); }
195
                   if ( @$filters[$i] );
193
		}
196
		}
194
		$cell{crit} = 
197
		$cell{crit} = 
195
            ( $i == 0 )  ? "Period From"
198
            ( $i == 0 )  ? "Period From"
Lines 261-267 sub calculate { Link Here
261
		$linefield = ($dsp == 1) ? "  dayname($line)" :
264
		$linefield = ($dsp == 1) ? "  dayname($line)" :
262
					 ($dsp == 2) ? "monthname($line)" :
265
					 ($dsp == 2) ? "monthname($line)" :
263
					 ($dsp == 3) ? "     Year($line)" :
266
					 ($dsp == 3) ? "     Year($line)" :
264
					'date_format(`datetime`,"%Y-%m-%d")'; # Probably should be left alone or passed through C4::Dates
267
                                         'date_format(`datetime`,"%Y-%m-%d")'; # Probably should be left alone or passed through Koha::DateUtils
265
	} else {
268
	} else {
266
		$linefield = $line;
269
		$linefield = $line;
267
	}
270
	}
Lines 336-342 sub calculate { Link Here
336
		$colfield = ($dsp == 1) ? "  dayname($column)" :
339
		$colfield = ($dsp == 1) ? "  dayname($column)" :
337
					($dsp == 2) ? "monthname($column)" :
340
					($dsp == 2) ? "monthname($column)" :
338
					($dsp == 3) ? "     Year($column)" :
341
					($dsp == 3) ? "     Year($column)" :
339
					'date_format(`datetime`,"%Y-%m-%d")'; # Probably should be left alone or passed through C4::Dates
342
                                        'date_format(`datetime`,"%Y-%m-%d")'; # Probably should be left alone or passed through Koha::DateUtils
340
	} else {
343
	} else {
341
		$colfield = $column;
344
		$colfield = $column;
342
	}
345
	}
(-)a/reports/reserves_stats.pl (-5 / +6 lines)
Lines 31-38 use C4::Koha; Link Here
31
use C4::Output;
31
use C4::Output;
32
use C4::Reports;
32
use C4::Reports;
33
use C4::Members;
33
use C4::Members;
34
use C4::Dates qw/format_date format_date_in_iso/;
35
use C4::Category;
34
use C4::Category;
35
use Koha::DateUtils;
36
use List::MoreUtils qw/any/;
36
use List::MoreUtils qw/any/;
37
use YAML;
37
use YAML;
38
38
Lines 190-198 sub calculate { Link Here
190
    my @loopfilter;
190
    my @loopfilter;
191
    foreach my $filter ( keys %$filters_hashref ) {
191
    foreach my $filter ( keys %$filters_hashref ) {
192
        $filters_hashref->{$filter} =~ s/\*/%/;
192
        $filters_hashref->{$filter} =~ s/\*/%/;
193
        $filters_hashref->{$filter} =
193
        if ( $filter =~ /date/ ) {
194
          format_date_in_iso( $filters_hashref->{$filter} )
194
            $filters_hashref->{$filter} =
195
          if ( $filter =~ /date/ );
195
                eval { output_pref( { dt => dt_from_string( $filters_hashref->{$filter} ), dateonly => 1, dateformat => 'iso' }); };
196
        }
196
    }
197
    }
197
198
198
    #display
199
    #display
Lines 201-207 sub calculate { Link Here
201
            crit   => $_,
202
            crit   => $_,
202
            filter => (
203
            filter => (
203
                $_ =~ /date/
204
                $_ =~ /date/
204
                ? format_date( $filters_hashref->{$_} )
205
                ? eval { output_pref( { dt => dt_from_string( $filters_hashref->{$_} ), dateonly => 1 }); }
205
                : $filters_hashref->{$_}
206
                : $filters_hashref->{$_}
206
            )
207
            )
207
        }
208
        }
(-)a/reports/serials_stats.pl (-4 lines)
Lines 23-29 use C4::Auth; Link Here
23
use CGI qw ( -utf8 );
23
use CGI qw ( -utf8 );
24
use C4::Context;
24
use C4::Context;
25
use C4::Branch; # GetBranches
25
use C4::Branch; # GetBranches
26
use C4::Dates qw/format_date/;
27
use C4::Output;
26
use C4::Output;
28
use C4::Koha;
27
use C4::Koha;
29
use C4::Reports;
28
use C4::Reports;
Lines 35-42 plugin that shows a stats on serials Link Here
35
34
36
=head1 DESCRIPTION
35
=head1 DESCRIPTION
37
36
38
=over 2
39
40
=cut
37
=cut
41
38
42
my $input      = new CGI;
39
my $input      = new CGI;
43
- 

Return to bug 14961