Bug 14982: Remove C4::Dates from guided report wizard and dictionary

This patch removes C4::Dates from files:
- reports/guided_reports.pl
- reports/dictionary.pl
- C4/Reports/Guided.pm

To test:
- Go to Home > Reports > Guided reports wizard
- Then go to 'View Dictionary' (menue at teh left)
- Click 'New definition' and step through
- In step 2. select e.g. borrowers
- In step 3 select a date field
- In step 4, select date range and test start / end dates
- In step 5, verify that dates display properly
- Save and verify that dates are insertet properly in sql definition

- Go back to Home > Reports > Guided reports wizard
- Step through the wizard and verify that it works as before.

http://bugs.koha-community.org/show_bug.cgi?id=14982
Signed-off-by: Josef Moravec <josef.moravec@gmail.com>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
This commit is contained in:
Marc Véron 2015-10-08 19:34:56 +02:00 committed by Tomas Cohen Arazi
parent 17af2c9a1e
commit d331bcfbee
3 changed files with 17 additions and 16 deletions

View file

@ -23,9 +23,9 @@ use Carp;
use vars qw($VERSION @ISA @EXPORT @EXPORT_OK %EXPORT_TAGS);
use C4::Context;
use C4::Dates qw/format_date format_date_in_iso/;
use C4::Templates qw/themelanguage/;
use C4::Koha;
use Koha::DateUtils;
use C4::Output;
use XML::Simple;
use XML::Dumper;
@ -675,7 +675,7 @@ sub get_saved_reports {
my (@cond,@args);
if ($filter) {
if (my $date = $filter->{date}) {
$date = format_date_in_iso($date);
$date = eval { output_pref( { dt => dt_from_string( $date ), dateonly => 1, dateformat => 'iso' }); };
push @cond, "DATE(date_run) = ? OR
DATE(date_created) = ? OR
DATE(last_modified) = ? OR

View file

@ -23,7 +23,7 @@ use C4::Auth;
use CGI qw ( -utf8 );
use C4::Output;
use C4::Reports::Guided;
use C4::Dates;
use Koha::DateUtils;
=head1 NAME
@ -141,34 +141,36 @@ elsif ( $phase eq 'New Term step 5' ) {
$tmp_hash{'name'} = $crit;
$tmp_hash{'value'} = $value;
push @criteria_loop, \%tmp_hash;
if ( $value =~ C4::Dates->regexp( C4::Context->preference('dateformat') ) ) {
my $date = C4::Dates->new($value);
$value = $date->output("iso");
}
my $value_dt = eval { dt_from_string( $value ) };
$value = output_pref( { dt => $value_dt, dateonly => 1, dateformat => 'iso' } )
if ( $value_dt );
$query_criteria .= " AND $crit='$value'";
}
$value = $input->param( $crit . "_start_value" );
if ($value) {
my %tmp_hash;
$tmp_hash{'name'} = "$crit Start";
$tmp_hash{'value'} = $value;
push @criteria_loop, \%tmp_hash;
if ( $value =~ C4::Dates->regexp( C4::Context->preference('dateformat') ) ) {
my $date = C4::Dates->new($value);
$value = $date->output("iso");
}
my $value_dt = eval { dt_from_string( $value ) };
$value = output_pref( { dt => $value_dt, dateonly => 1, dateformat => 'iso' } )
if ( $value_dt );
$query_criteria .= " AND $crit >= '$value'";
}
$value = $input->param( $crit . "_end_value" );
if ($value) {
my %tmp_hash;
$tmp_hash{'name'} = "$crit End";
$tmp_hash{'value'} = $value;
push @criteria_loop, \%tmp_hash;
if ( $value =~ C4::Dates->regexp( C4::Context->preference('dateformat') ) ) {
my $date = C4::Dates->new($value);
$value = $date->output("iso");
}
my $value_dt = eval { dt_from_string( $value ) };
$value = output_pref( { dt => $value_dt, dateonly => 1, dateformat => 'iso' } )
if ( $value_dt );
$query_criteria .= " AND $crit <= '$value'";
}
}

View file

@ -27,7 +27,6 @@ use File::Basename qw( dirname );
use C4::Reports::Guided;
use C4::Auth qw/:DEFAULT get_session/;
use C4::Output;
use C4::Dates qw/format_date/;
use C4::Debug;
use C4::Branch; # XXX subfield_is_koha_internal_p
use C4::Koha qw/IsAuthorisedValueCategory GetFrameworksLoop/;