Bug 17600: Standardize our EXPORT_OK
[srvgit] / pos / pay.pl
index 5cc4279..b401f12 100755 (executable)
@@ -1,12 +1,29 @@
 #!/usr/bin/perl
 
+# Copyright 2020 PTFS-Europe Ltd
+#
+# 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 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.
+#
+# You should have received a copy of the GNU General Public License
+# along with Koha; if not, see <http://www.gnu.org/licenses>.
+
 use Modern::Perl;
 
 use CGI;
 use JSON qw( from_json );
 
-use C4::Auth qw/:DEFAULT get_session/;
-use C4::Output;
+use C4::Auth qw( get_session get_template_and_user );
+use C4::Output qw( output_html_with_http_headers );
 use C4::Context;
 
 use Koha::Account::DebitTypes;
@@ -32,31 +49,10 @@ my $logged_in_user = Koha::Patrons->find($loggedinuser) or die "Not logged in";
 
 my $library_id         = C4::Context->userenv->{'branch'};
 my $registerid         = $input->param('registerid');
-my $default_registerid = $input->param('default_register');
-my $registers          = Koha::Cash::Registers->search(
-    { branch   => $library_id, archived => 0 },
-    { order_by => { '-asc' => 'name' } }
-);
-
-if ( !$registers->count ) {
-    $template->param( error_registers => 1 );
-}
-else {
-    if ( !$default_registerid ) {
-        my $default_register = Koha::Cash::Registers->find(
-            { branch => $library_id, branch_default => 1 } );
-        $default_registerid =
-          $default_register ? $default_register->id : $registers->next->id;
-    }
-
-    $template->param(
-        default_register => $default_registerid,
-        registers        => $registers,
-    );
-}
 
 my $invoice_types =
-  Koha::Account::DebitTypes->search_with_library_limits( { can_be_sold => 1 },
+  Koha::Account::DebitTypes->search_with_library_limits(
+    { can_be_sold => 1, archived => 0 },
     {}, $library_id );
 $template->param( invoice_types => $invoice_types );