Bug 17835: Replace GetItemTypes with Koha::ItemTypes
[koha-ffzg.git] / reports / borrowers_out.pl
index 55f29ef..50c73b0 100755 (executable)
@@ -28,7 +28,9 @@ use C4::Output;
 use C4::Circulation;
 use C4::Reports;
 use C4::Members;
-use C4::Dates qw/format_date_in_iso/;
+
+use Koha::DateUtils;
+use Koha::Patron::Categories;
 
 =head1 NAME
 
@@ -45,8 +47,10 @@ my $do_it=$input->param('do_it');
 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];
+my @filters = $input->multi_param("Filter");
+$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") || '';
@@ -114,19 +118,12 @@ if ($do_it) {
     
     my $CGIextChoice = ( 'CSV' ); # FIXME translation
        my $CGIsepChoice = GetDelimiterChoices;
-    
-    my ($codes,$labels) = GetborCatFromCatType(undef,undef);
-    my @borcatloop;
-    foreach my $thisborcat (sort keys %$labels) {
-            my %row =(value => $thisborcat,
-                                    description => $labels->{$thisborcat},
-                            );
-            push @borcatloop, \%row;
-    }
+
+    my $patron_categories = Koha::Patron::Categories->search_limited({}, {order_by => ['categorycode']});
     $template->param(
                     CGIextChoice => $CGIextChoice,
                     CGIsepChoice => $CGIsepChoice,
-                    borcatloop =>\@borcatloop,
+                    patron_categories => $patron_categories,
                     );
 output_html_with_http_headers $input, $cookie, $template->output;
 }
@@ -230,7 +227,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 .= ") ";