Bug 24545: Fix license statements
[srvgit] / reports / cash_register_stats.pl
index da7b511..98390ac 100755 (executable)
@@ -2,17 +2,18 @@
 #
 # 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;
+# 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 Modern::Perl;
 use C4::Auth;
@@ -27,6 +28,7 @@ use Koha::DateUtils;
 use Text::CSV::Encoded;
 use List::Util qw/any/;
 
+use Koha::Account::CreditTypes;
 use Koha::Account::DebitTypes;
 
 my $input            = new CGI;
@@ -58,12 +60,14 @@ my $toDate   = dt_from_string;
 
 my @debit_types =
   Koha::Account::DebitTypes->search()->as_list;
+my @credit_types =
+  Koha::Account::CreditTypes->search()->as_list;
 
 if ($do_it) {
 
-    $fromDate = output_pref({ dt => eval { dt_from_string($input->param("from")) } || dt_from_string,
+    $fromDate = output_pref({ dt => eval { dt_from_string(scalar $input->param("from")) } || dt_from_string,
             dateformat => 'sql', dateonly => 1 }); #for sql query
-    $toDate   = output_pref({ dt => eval { dt_from_string($input->param("to")) } || dt_from_string,
+    $toDate   = output_pref({ dt => eval { dt_from_string(scalar $input->param("to")) } || dt_from_string,
             dateformat => 'sql', dateonly => 1 }); #for sql query
 
     my $whereTType = q{};
@@ -74,7 +78,7 @@ if ($do_it) {
     } elsif ($transaction_type eq 'ACT') { #Active
         $whereTType = q{ AND credit_type_code IN ('PAYMENT','CREDIT') };
     } elsif ($transaction_type eq 'FORW') {
-        $whereTType = q{ AND credit_type_code IN ('FORGIVEN','W') };
+        $whereTType = q{ AND credit_type_code IN ('FORGIVEN','WRITEOFF') };
     } else {
         if ( any { $transaction_type eq $_->code } @debit_types ) {
             $whereTType = q{ AND debit_type_code = ? };
@@ -128,7 +132,7 @@ if ($do_it) {
             if($row->{credit_type_code} =~ /^CREDIT$/){
                 $grantotal -= abs($row->{amount});
                 $row->{amount} = '-' . $row->{amount};
-            }elsif($row->{credit_type_code} eq 'FORGIVEN' || $row->{credit_type_code} eq 'W'){
+            }elsif($row->{credit_type_code} eq 'FORGIVEN' || $row->{credit_type_code} eq 'WRITEOFF'){
             }else{
                 $grantotal += abs($row->{amount});
             }
@@ -187,6 +191,7 @@ $template->param(
     transaction_type => $transaction_type,
     branchloop       => Koha::Libraries->search({}, { order_by => ['branchname'] })->unblessed,
     debit_types      => \@debit_types,
+    credit_types     => \@credit_types,
     CGIsepChoice => GetDelimiterChoices,
 );