Bug 17835: Replace GetItemTypes with Koha::ItemTypes
[koha-ffzg.git] / reports / catalogue_out.pl
index 45609a0..0c53a79 100755 (executable)
@@ -4,29 +4,27 @@
 #
 # This file is part of Koha.
 #
-# Koha is free software; you can redistribute it and/or modify it under the
-# terms of the GNU General Public License as published by the Free Software
-# Foundation; either version 2 of the License, or (at your option) any later
-# version.
+# Koha is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
 #
-# Koha is distributed in the hope that it will be useful, but WITHOUT ANY
-# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
-# A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
+# Koha is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
 #
-# You should have received a copy of the GNU General Public License along
-# with Koha; if not, write to the Free Software Foundation, Inc.,
-# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+# 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;
-use CGI;
+use CGI qw ( -utf8 );
 
 use C4::Auth;
 use C4::Context;
 use C4::Debug;
-use C4::Branch;    # GetBranchesLoop
 use C4::Output;
-use C4::Koha;      # GetItemTypes
 # use Date::Manip;  # TODO: add not borrowed since date X criteria
 use Data::Dumper;
 
@@ -40,11 +38,11 @@ my $input   = new CGI;
 my $do_it   = $input->param('do_it');
 my $limit   = $input->param("Limit") || 10;
 my $column  = $input->param("Criteria");
-my @filters = $input->param("Filter");
+my @filters = $input->multi_param("Filter");
 
 my ( $template, $borrowernumber, $cookie ) = get_template_and_user(
     {
-        template_name   => "reports/catalogue_out.tmpl",
+        template_name   => "reports/catalogue_out.tt",
         query           => $input,
         type            => "intranet",
         authnotrequired => 0,
@@ -61,24 +59,9 @@ if ($do_it) {
     exit;    # in either case, exit after do_it
 }
 
-# Displaying choices (i.e., not do_it)
-my $itemtypes = GetItemTypes();
-my @itemtypeloop;
-foreach (
-    sort { $itemtypes->{$a}->{'description'} cmp $itemtypes->{$b}->{'description'} }
-    keys %$itemtypes
-  )
-{
-    push @itemtypeloop,
-      {
-        value       => $_,
-        description => $itemtypes->{$_}->{'description'},
-      };
-}
-
+my $itemtypes = Koha::ItemTypes->search_with_localization;
 $template->param(
-    itemtypeloop => \@itemtypeloop,
-    branchloop   => GetBranchesLoop(),
+    itemtypes => $itemtypes,
 );
 output_html_with_http_headers $input, $cookie, $template->output;