Bugzilla – Attachment 43970 Details for
Bug 14982
Remove C4::Dates from guided report wizard and dictionary
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Remove C4::Dates from guided report wizard and dictionary
Remove-C4Dates-from-guided-report-wizard-and-dicti.patch (text/plain), 4.78 KB, created by
Josef Moravec
on 2015-10-26 07:14:52 UTC
(
hide
)
Description:
Remove C4::Dates from guided report wizard and dictionary
Filename:
MIME Type:
Creator:
Josef Moravec
Created:
2015-10-26 07:14:52 UTC
Size:
4.78 KB
patch
obsolete
>From b02de4b6d9aaa9967a6ef4dc6a20a63058b66185 Mon Sep 17 00:00:00 2001 >From: =?UTF-8?q?Marc=20V=C3=A9ron?= <veron@veron.ch> >Date: Thu, 8 Oct 2015 19:34:56 +0200 >Subject: [PATCH] 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> >--- > C4/Reports/Guided.pm | 4 ++-- > reports/dictionary.pl | 28 +++++++++++++++------------- > reports/guided_reports.pl | 1 - > 3 files changed, 17 insertions(+), 16 deletions(-) > >diff --git a/C4/Reports/Guided.pm b/C4/Reports/Guided.pm >index cb09651..37eaf98 100644 >--- a/C4/Reports/Guided.pm >+++ b/C4/Reports/Guided.pm >@@ -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 >diff --git a/reports/dictionary.pl b/reports/dictionary.pl >index 400790c..964f76f 100755 >--- a/reports/dictionary.pl >+++ b/reports/dictionary.pl >@@ -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'"; > } > } >diff --git a/reports/guided_reports.pl b/reports/guided_reports.pl >index 0cee490..71b9253 100755 >--- a/reports/guided_reports.pl >+++ b/reports/guided_reports.pl >@@ -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/; >-- >2.1.4
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 14982
:
43276
|
43283
|
43970
|
43971