Bug 14965: Remove C4::Dates from 'lists' in folder reports

Remove C4::Dates from:

- reports/bor_issues_top.pl
- reports/borrowers_out.pl
- reports/cat_issues_top.pl
- reports/itemslost.pl

To test:

- Go to Home > Reports
- Verify that following reports behave as before:
  - 'Patrons with the most checkouts (reports/bor_issues_top.pl)
  - 'Most circulated items' (reports/cat_issues_top.pl)
  - 'Patrons who haven't checked out (reports/borrowers_out.pl)
  - 'Items lost'

Amended to fix issue with reports/borrowers_out.pl / see comment #3
Amended to fix issue with reports/bor_issues_top.pl / see comment #7
http://bugs.koha-community.org/show_bug.cgi?id=14965

Signed-off-by: Frederic Demians <f.demians@tamil.fr>
  Code OK. The 4 reports works for me as before (same results).

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:
Marc Véron 2015-10-06 14:39:38 +02:00 committed by Tomas Cohen Arazi
parent 55456b6e7f
commit 80160ac9ef
4 changed files with 20 additions and 14 deletions

View file

@ -29,7 +29,7 @@ use C4::Circulation;
use C4::Members;
use C4::Reports;
use C4::Debug;
use C4::Dates qw(format_date format_date_in_iso);
use Koha::DateUtils;
=head1 NAME
@ -51,7 +51,7 @@ my $limit = $input->param("Limit");
my $column = $input->param("Criteria");
my @filters = $input->param("Filter");
foreach ( @filters[0..3] ) {
$_ and $_ = format_date_in_iso($_);
$_ and $_ = eval { output_pref( { dt => dt_from_string ( $_ ), dateonly => 1, dateformat => 'iso' }); };
}
my $output = $input->param("output");
my $basename = $input->param("basename");

View file

@ -28,7 +28,7 @@ use C4::Output;
use C4::Circulation;
use C4::Reports;
use C4::Members;
use C4::Dates qw/format_date_in_iso/;
use Koha::DateUtils;
=head1 NAME
@ -46,7 +46,9 @@ my $fullreportname = "reports/borrowers_out.tt";
my $limit = $input->param("Limit");
my $column = $input->param("Criteria");
my @filters = $input->param("Filter");
$filters[1] = format_date_in_iso($filters[1]) if $filters[1];
$filters[1] = eval { output_pref( { dt => dt_from_string( $filters[1]), dateonly => 1, dateformat => 'iso' } ); }
if ( $filters[1] );
my $output = $input->param("output");
my $basename = $input->param("basename");
our $sep = $input->param("sep") || '';
@ -230,7 +232,7 @@ sub calculate {
}
$strcalc .= " AND NOT EXISTS (SELECT * FROM issues WHERE issues.borrowernumber=borrowers.borrowernumber ";
if ( @$filters[1] ) {
$strcalc .= " AND issues.timestamap > ?";
$strcalc .= " AND issues.timestamp > ?";
push @query_args, @$filters[1];
}
$strcalc .= ") ";

View file

@ -28,8 +28,8 @@ use C4::Output;
use C4::Koha;
use C4::Circulation;
use C4::Reports;
use C4::Dates qw/format_date format_date_in_iso/;
use C4::Members;
use Koha::DateUtils;
=head1 NAME
@ -47,10 +47,10 @@ my $fullreportname = "reports/cat_issues_top.tt";
my $limit = $input->param("Limit");
my $column = $input->param("Criteria");
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]);
foreach ( @filters[0..3] ) {
$_ and $_ = eval { output_pref( { dt => dt_from_string ( $_ ), dateonly => 1, dateformat => 'iso' } ); };
}
my $output = $input->param("output");
my $basename = $input->param("basename");
#warn "calcul : ".$calc;
@ -181,8 +181,10 @@ sub calculate {
if ($i>=2) {
$cell{filter} .= @$filters[$i];
} else {
$cell{filter} .= format_date(@$filters[$i]);
} $cell{crit} .="Issue From" if ($i==0);
$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);
$cell{crit} .="Return From" if ($i==2);
$cell{crit} .="Return To" if ($i==3);

View file

@ -35,7 +35,7 @@ use C4::Biblio;
use C4::Items;
use C4::Koha; # GetItemTypes
use C4::Branch; # GetBranches
use C4::Dates qw/format_date/;
use Koha::DateUtils;
my $query = new CGI;
my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
@ -68,8 +68,10 @@ if ( $get_items ) {
my $items = GetLostItems( \%where );
foreach my $it (@$items) {
$it->{'datelastseen'} = format_date($it->{'datelastseen'});
$it->{'datelastseen'} = eval { output_pref( { dt => dt_from_string( $it->{'datelastseen'} ), dateonly => 1 }); }
if ( $it->{'datelastseen'} );
}
$template->param(
total => scalar @$items,
itemsloop => $items,