Bug 33146: Unit tests
[koha-ffzg.git] / reports / dictionary.pl
index 7d86f8d..5920e22 100755 (executable)
 #
 # You should have received a copy of the GNU General Public License
 # along with Koha; if not, see <http://www.gnu.org/licenses>.
-use CGI::Carp qw(fatalsToBrowser warningsToBrowser);
-use strict;
-use warnings;
-use C4::Auth;
+use Modern::Perl;
+use C4::Auth qw( get_template_and_user );
 use CGI qw ( -utf8 );
-use C4::Output;
-use C4::Reports::Guided;
-use Koha::DateUtils;
+use C4::Output qw( output_html_with_http_headers );
+use C4::Reports::Guided qw( get_from_dictionary get_columns get_column_type get_distinct_values save_dictionary delete_definition get_report_areas );
+use Koha::DateUtils qw( dt_from_string output_pref );
 
 =head1 NAME
 
@@ -33,7 +31,7 @@ Script to control the guided report creation
 
 =cut
 
-my $input = new CGI;
+my $input = CGI->new;
 my $referer = $input->referer();
 
 my $phase = $input->param('phase') || 'View Dictionary';
@@ -45,9 +43,7 @@ my ( $template, $borrowernumber, $cookie ) = get_template_and_user(
     {   template_name   => "reports/dictionary.tt",
         query           => $input,
         type            => "intranet",
-        authnotrequired => 0,
         flagsrequired   => { reports => '*' },
-        debug           => 1,
     }
        );
 
@@ -141,9 +137,6 @@ elsif ( $phase eq 'New Term step 5' ) {
             $tmp_hash{'name'}  = $crit;
             $tmp_hash{'value'} = $value;
             push @criteria_loop, \%tmp_hash;
-            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'";
         }
@@ -155,9 +148,6 @@ elsif ( $phase eq 'New Term step 5' ) {
                     $tmp_hash{'name'}  = "$crit Start";
                     $tmp_hash{'value'} = $value;
                     push @criteria_loop, \%tmp_hash;
-                    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'";
                 }
@@ -167,9 +157,6 @@ elsif ( $phase eq 'New Term step 5' ) {
                     $tmp_hash{'name'}  = "$crit End";
                     $tmp_hash{'value'} = $value;
                     push @criteria_loop, \%tmp_hash;
-                    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'";
                 }