ffzg/recall_notices.pl: added --interval and --dedup
[koha.git] / reports / bor_issues_top.pl
index cd2964b..84a46a3 100755 (executable)
@@ -17,8 +17,8 @@
 # You should have received a copy of the GNU General Public License
 # along with Koha; if not, see <http://www.gnu.org/licenses>.
 
-use strict;
-#use warnings; FIXME - Bug 2505
+use Modern::Perl;
+
 use CGI qw ( -utf8 );
 use C4::Auth;
 use C4::Output;
@@ -30,6 +30,7 @@ use C4::Reports;
 use C4::Debug;
 
 use Koha::DateUtils;
+use Koha::ItemTypes;
 use Koha::Patron::Categories;
 
 =head1 NAME
@@ -40,7 +41,6 @@ plugin that shows a stats on borrowers
 
 =cut
 
-$debug = 1;
 $debug and open DEBUG, ">/tmp/bor_issues_top.debug.log";
 
 my $input = new CGI;
@@ -62,7 +62,7 @@ my ($template, $borrowernumber, $cookie)
                 flagsrequired => {reports => '*'},
                 debug => 1,
                 });
-our $sep     = $input->param("sep");
+our $sep     = $input->param("sep") || C4::Context->preference('delimiter') || ',';
 $sep = "\t" if ($sep eq 'tabulation');
 $template->param(do_it => $do_it,
         );
@@ -110,21 +110,12 @@ my @values;
 my @mime  = ( map { {type =>$_} } (split /[;:]/, 'CSV') ); # FIXME translation
 my $delims = GetDelimiterChoices;
 
-my $itemtypes = GetItemTypes;
-my @itemtypeloop;
-foreach (sort {$itemtypes->{$a}->{translated_description} cmp $itemtypes->{$b}->{translated_description}} keys %$itemtypes) {
-       my %row = (value => $_,
-               translated_description => $itemtypes->{$_}->{translated_description},
-              );
-    push @itemtypeloop, \%row;
-}
-
 my $patron_categories = Koha::Patron::Categories->search_limited({}, {order_by => ['categorycode']});
-
+my $itemtypes = Koha::ItemTypes->search_with_localization;
 $template->param(
            mimeloop => \@mime,
          CGIseplist => $delims,
-       itemtypeloop => \@itemtypeloop,
+      itemtypes => $itemtypes,
 patron_categories => $patron_categories,
 );
 output_html_with_http_headers $input, $cookie, $template->output;