From bcc7c203ee6b6ab484fc0749876aa4787ed035ee Mon Sep 17 00:00:00 2001 From: Kyle M Hall Date: Tue, 15 Jul 2014 10:41:21 -0400 Subject: [PATCH] Bug 6427 - Delete unused and unnecessary files --- C4/Accounts.pm | 834 -------------------- Koha/Schema/Result/Accountline.pm | 222 ------ Koha/Schema/Result/Accountoffset.pm | 106 --- circ/stats.pl | 189 ----- .../intranet-tmpl/prog/en/modules/circ/stats.tt | 55 -- .../prog/en/modules/members/boraccount.tt | 122 --- .../prog/en/modules/members/mancredit.tt | 63 -- .../prog/en/modules/members/maninvoice.tt | 87 -- .../intranet-tmpl/prog/en/modules/members/pay.tt | 178 ----- .../prog/en/modules/members/paycollect.tt | 233 ------ .../prog/en/modules/members/printfeercpt.tt | 59 -- .../prog/en/modules/members/printinvoice.tt | 61 -- .../prog/en/modules/reports/stats_screen.tt | 131 --- members/boraccount.pl | 145 ---- members/mancredit.pl | 126 --- members/maninvoice.pl | 152 ---- members/pay.pl | 267 ------- members/paycollect.pl | 192 ----- members/printfeercpt.pl | 143 ---- members/printinvoice.pl | 142 ---- misc/maintenance/fix_accountlines_date.pl | 171 ---- reports/stats.print.pl | 178 ----- reports/stats.screen.pl | 265 ------- 23 files changed, 0 insertions(+), 4121 deletions(-) delete mode 100644 C4/Accounts.pm delete mode 100644 Koha/Schema/Result/Accountline.pm delete mode 100644 Koha/Schema/Result/Accountoffset.pm delete mode 100755 circ/stats.pl delete mode 100644 koha-tmpl/intranet-tmpl/prog/en/modules/circ/stats.tt delete mode 100644 koha-tmpl/intranet-tmpl/prog/en/modules/members/boraccount.tt delete mode 100644 koha-tmpl/intranet-tmpl/prog/en/modules/members/mancredit.tt delete mode 100644 koha-tmpl/intranet-tmpl/prog/en/modules/members/maninvoice.tt delete mode 100644 koha-tmpl/intranet-tmpl/prog/en/modules/members/pay.tt delete mode 100644 koha-tmpl/intranet-tmpl/prog/en/modules/members/paycollect.tt delete mode 100644 koha-tmpl/intranet-tmpl/prog/en/modules/members/printfeercpt.tt delete mode 100644 koha-tmpl/intranet-tmpl/prog/en/modules/members/printinvoice.tt delete mode 100644 koha-tmpl/intranet-tmpl/prog/en/modules/reports/stats_screen.tt delete mode 100755 members/boraccount.pl delete mode 100755 members/mancredit.pl delete mode 100755 members/maninvoice.pl delete mode 100755 members/pay.pl delete mode 100755 members/paycollect.pl delete mode 100755 members/printfeercpt.pl delete mode 100755 members/printinvoice.pl delete mode 100755 misc/maintenance/fix_accountlines_date.pl delete mode 100755 reports/stats.print.pl delete mode 100755 reports/stats.screen.pl diff --git a/C4/Accounts.pm b/C4/Accounts.pm deleted file mode 100644 index 8cd9100..0000000 --- a/C4/Accounts.pm +++ /dev/null @@ -1,834 +0,0 @@ -package C4::Accounts; - -# Copyright 2000-2002 Katipo Communications -# -# 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 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. - - -use strict; -#use warnings; FIXME - Bug 2505 -use C4::Context; -use C4::Stats; -use C4::Members; -use C4::Circulation qw(ReturnLostItem); -use C4::Log qw(logaction); - -use Data::Dumper qw(Dumper); - -use vars qw($VERSION @ISA @EXPORT); - -BEGIN { - # set the version for version checking - $VERSION = 3.07.00.049; - require Exporter; - @ISA = qw(Exporter); - @EXPORT = qw( - &recordpayment - &makepayment - &manualinvoice - &getnextacctno - &getcharges - &ModNote - &getcredits - &getrefunds - &chargelostitem - &ReversePayment - &makepartialpayment - &recordpayment_selectaccts - &WriteOffFee - ); -} - -=head1 NAME - -C4::Accounts - Functions for dealing with Koha accounts - -=head1 SYNOPSIS - -use C4::Accounts; - -=head1 DESCRIPTION - -The functions in this module deal with the monetary aspect of Koha, -including looking up and modifying the amount of money owed by a -patron. - -=head1 FUNCTIONS - -=head2 recordpayment - - &recordpayment($borrowernumber, $payment, $sip_paytype); - -Record payment by a patron. C<$borrowernumber> is the patron's -borrower number. C<$payment> is a floating-point number, giving the -amount that was paid. C<$sip_paytype> is an optional flag to indicate this -payment was made over a SIP2 interface, rather than the staff client. The -value passed is the SIP2 payment type value (message 37, characters 21-22) - -Amounts owed are paid off oldest first. That is, if the patron has a -$1 fine from Feb. 1, another $1 fine from Mar. 1, and makes a payment -of $1.50, then the oldest fine will be paid off in full, and $0.50 -will be credited to the next one. - -=cut - -#' -sub recordpayment { - - #here we update the account lines - my ( $borrowernumber, $data, $sip_paytype ) = @_; - my $dbh = C4::Context->dbh; - my $newamtos = 0; - my $accdata = ""; - my $branch = C4::Context->userenv->{'branch'}; - my $amountleft = $data; - my $manager_id = 0; - $manager_id = C4::Context->userenv->{'number'} if C4::Context->userenv; - - # begin transaction - my $nextaccntno = getnextacctno($borrowernumber); - - # get lines with outstanding amounts to offset - my $sth = $dbh->prepare( - "SELECT * FROM accountlines - WHERE (borrowernumber = ?) AND (amountoutstanding<>0) - ORDER BY date" - ); - $sth->execute($borrowernumber); - - # offset transactions - my @ids; - while ( ( $accdata = $sth->fetchrow_hashref ) and ( $amountleft > 0 ) ) { - if ( $accdata->{'amountoutstanding'} < $amountleft ) { - $newamtos = 0; - $amountleft -= $accdata->{'amountoutstanding'}; - } - else { - $newamtos = $accdata->{'amountoutstanding'} - $amountleft; - $amountleft = 0; - } - my $thisacct = $accdata->{accountlines_id}; - my $usth = $dbh->prepare( - "UPDATE accountlines SET amountoutstanding= ? - WHERE (accountlines_id = ?)" - ); - $usth->execute( $newamtos, $thisacct ); - - if ( C4::Context->preference("FinesLog") ) { - $accdata->{'amountoutstanding_new'} = $newamtos; - logaction("FINES", 'MODIFY', $borrowernumber, Dumper({ - action => 'fee_payment', - borrowernumber => $accdata->{'borrowernumber'}, - old_amountoutstanding => $accdata->{'amountoutstanding'}, - new_amountoutstanding => $newamtos, - amount_paid => $accdata->{'amountoutstanding'} - $newamtos, - accountlines_id => $accdata->{'accountlines_id'}, - accountno => $accdata->{'accountno'}, - manager_id => $manager_id, - })); - push( @ids, $accdata->{'accountlines_id'} ); - } - } - - # create new line - my $usth = $dbh->prepare( - "INSERT INTO accountlines - (borrowernumber, accountno,date,amount,description,accounttype,amountoutstanding,manager_id) - VALUES (?,?,now(),?,'',?,?,?)" - ); - - my $paytype = "Pay"; - $paytype .= $sip_paytype if defined $sip_paytype; - $usth->execute( $borrowernumber, $nextaccntno, 0 - $data, $paytype, 0 - $amountleft, $manager_id ); - $usth->finish; - - UpdateStats({ - branch => $branch, - type =>'payment', - amount => $data, - borrowernumber => $borrowernumber, - accountno => $nextaccntno } - ); - - if ( C4::Context->preference("FinesLog") ) { - $accdata->{'amountoutstanding_new'} = $newamtos; - logaction("FINES", 'CREATE',$borrowernumber,Dumper({ - action => 'create_payment', - borrowernumber => $borrowernumber, - accountno => $nextaccntno, - amount => $data * -1, - amountoutstanding => $amountleft * -1, - accounttype => 'Pay', - accountlines_paid => \@ids, - manager_id => $manager_id, - })); - } - -} - -=head2 makepayment - - &makepayment($accountlines_id, $borrowernumber, $acctnumber, $amount, $branchcode); - -Records the fact that a patron has paid off the entire amount he or -she owes. - -C<$borrowernumber> is the patron's borrower number. C<$acctnumber> is -the account that was credited. C<$amount> is the amount paid (this is -only used to record the payment. It is assumed to be equal to the -amount owed). C<$branchcode> is the code of the branch where payment -was made. - -=cut - -#' -# FIXME - I'm not at all sure about the above, because I don't -# understand what the acct* tables in the Koha database are for. -sub makepayment { - - #here we update both the accountoffsets and the account lines - #updated to check, if they are paying off a lost item, we return the item - # from their card, and put a note on the item record - my ( $accountlines_id, $borrowernumber, $accountno, $amount, $user, $branch, $payment_note ) = @_; - my $dbh = C4::Context->dbh; - my $manager_id = 0; - $manager_id = C4::Context->userenv->{'number'} if C4::Context->userenv; - - # begin transaction - my $nextaccntno = getnextacctno($borrowernumber); - my $newamtos = 0; - my $sth = $dbh->prepare("SELECT * FROM accountlines WHERE accountlines_id=?"); - $sth->execute( $accountlines_id ); - my $data = $sth->fetchrow_hashref; - - my $payment; - if ( $data->{'accounttype'} eq "Pay" ){ - my $udp = - $dbh->prepare( - "UPDATE accountlines - SET amountoutstanding = 0 - WHERE accountlines_id = ? - " - ); - $udp->execute($accountlines_id); - }else{ - my $udp = - $dbh->prepare( - "UPDATE accountlines - SET amountoutstanding = 0 - WHERE accountlines_id = ? - " - ); - $udp->execute($accountlines_id); - - # create new line - my $payment = 0 - $amount; - $payment_note //= ""; - - my $ins = - $dbh->prepare( - "INSERT - INTO accountlines (borrowernumber, accountno, date, amount, itemnumber, description, accounttype, amountoutstanding, manager_id, note) - VALUES ( ?, ?, now(), ?, ?, '', 'Pay', 0, ?, ?)" - ); - $ins->execute($borrowernumber, $nextaccntno, $payment, $data->{'itemnumber'}, $manager_id, $payment_note); - } - - if ( C4::Context->preference("FinesLog") ) { - logaction("FINES", 'MODIFY', $borrowernumber, Dumper({ - action => 'fee_payment', - borrowernumber => $borrowernumber, - old_amountoutstanding => $data->{'amountoutstanding'}, - new_amountoutstanding => 0, - amount_paid => $data->{'amountoutstanding'}, - accountlines_id => $data->{'accountlines_id'}, - accountno => $data->{'accountno'}, - manager_id => $manager_id, - })); - - - logaction("FINES", 'CREATE',$borrowernumber,Dumper({ - action => 'create_payment', - borrowernumber => $borrowernumber, - accountno => $nextaccntno, - amount => $payment, - amountoutstanding => 0,, - accounttype => 'Pay', - accountlines_paid => [$data->{'accountlines_id'}], - manager_id => $manager_id, - })); - } - - UpdateStats({ - branch => $user, - type => 'payment', - amount => $amount, - borrowernumber => $borrowernumber, - accountno => $accountno} - ); - - #check to see what accounttype - if ( $data->{'accounttype'} eq 'Rep' || $data->{'accounttype'} eq 'L' ) { - C4::Circulation::ReturnLostItem( $borrowernumber, $data->{'itemnumber'} ); - } - my $sthr = $dbh->prepare("SELECT max(accountlines_id) AS lastinsertid FROM accountlines"); - $sthr->execute(); - my $datalastinsertid = $sthr->fetchrow_hashref; - return $datalastinsertid->{'lastinsertid'}; -} - -=head2 getnextacctno - - $nextacct = &getnextacctno($borrowernumber); - -Returns the next unused account number for the patron with the given -borrower number. - -=cut - -#' -# FIXME - Okay, so what does the above actually _mean_? -sub getnextacctno { - my ($borrowernumber) = shift or return; - my $sth = C4::Context->dbh->prepare( - "SELECT accountno+1 FROM accountlines - WHERE (borrowernumber = ?) - ORDER BY accountno DESC - LIMIT 1" - ); - $sth->execute($borrowernumber); - return ($sth->fetchrow || 1); -} - -=head2 fixaccounts (removed) - - &fixaccounts($accountlines_id, $borrowernumber, $accountnumber, $amount); - -#' -# FIXME - I don't understand what this function does. -sub fixaccounts { - my ( $accountlines_id, $borrowernumber, $accountno, $amount ) = @_; - my $dbh = C4::Context->dbh; - my $sth = $dbh->prepare( - "SELECT * FROM accountlines WHERE accountlines_id=?" - ); - $sth->execute( $accountlines_id ); - my $data = $sth->fetchrow_hashref; - - # FIXME - Error-checking - my $diff = $amount - $data->{'amount'}; - my $outstanding = $data->{'amountoutstanding'} + $diff; - $sth->finish; - - $dbh->do(<dbh(); - my ($borrowernumber, $itemnumber, $amount, $description) = @_; - - # first make sure the borrower hasn't already been charged for this item - my $sth1=$dbh->prepare("SELECT * from accountlines - WHERE borrowernumber=? AND itemnumber=? and accounttype='L'"); - $sth1->execute($borrowernumber,$itemnumber); - my $existing_charge_hashref=$sth1->fetchrow_hashref(); - - # OK, they haven't - unless ($existing_charge_hashref) { - my $manager_id = 0; - $manager_id = C4::Context->userenv->{'number'} if C4::Context->userenv; - # This item is on issue ... add replacement cost to the borrower's record and mark it returned - # Note that we add this to the account even if there's no replacement price, allowing some other - # process (or person) to update it, since we don't handle any defaults for replacement prices. - my $accountno = getnextacctno($borrowernumber); - my $sth2=$dbh->prepare("INSERT INTO accountlines - (borrowernumber,accountno,date,amount,description,accounttype,amountoutstanding,itemnumber,manager_id) - VALUES (?,?,now(),?,?,'L',?,?,?)"); - $sth2->execute($borrowernumber,$accountno,$amount, - $description,$amount,$itemnumber,$manager_id); - - if ( C4::Context->preference("FinesLog") ) { - logaction("FINES", 'CREATE', $borrowernumber, Dumper({ - action => 'create_fee', - borrowernumber => $borrowernumber, - accountno => $accountno, - amount => $amount, - amountoutstanding => $amount, - description => $description, - accounttype => 'L', - itemnumber => $itemnumber, - manager_id => $manager_id, - })); - } - - } -} - -=head2 manualinvoice - - &manualinvoice($borrowernumber, $itemnumber, $description, $type, - $amount, $note); - -C<$borrowernumber> is the patron's borrower number. -C<$description> is a description of the transaction. -C<$type> may be one of C, C, C, C, C, C, C, -or C. -C<$itemnumber> is the item involved, if pertinent; otherwise, it -should be the empty string. - -=cut - -#' -# FIXME: In Koha 3.0 , the only account adjustment 'types' passed to this function -# are : -# 'C' = CREDIT -# 'FOR' = FORGIVEN (Formerly 'F', but 'F' is taken to mean 'FINE' elsewhere) -# 'N' = New Card fee -# 'F' = Fine -# 'A' = Account Management fee -# 'M' = Sundry -# 'L' = Lost Item -# - -sub manualinvoice { - my ( $borrowernumber, $itemnum, $desc, $type, $amount, $note ) = @_; - my $manager_id = 0; - $manager_id = C4::Context->userenv->{'number'} if C4::Context->userenv; - my $dbh = C4::Context->dbh; - my $notifyid = 0; - my $insert; - my $accountno = getnextacctno($borrowernumber); - my $amountleft = $amount; - - if ( ( $type eq 'L' ) - or ( $type eq 'F' ) - or ( $type eq 'A' ) - or ( $type eq 'N' ) - or ( $type eq 'M' ) ) - { - $notifyid = 1; - } - - if ( $itemnum ) { - $desc .= ' ' . $itemnum; - my $sth = $dbh->prepare( - 'INSERT INTO accountlines - (borrowernumber, accountno, date, amount, description, accounttype, amountoutstanding, itemnumber,notify_id, note, manager_id) - VALUES (?, ?, now(), ?,?, ?,?,?,?,?,?)'); - $sth->execute($borrowernumber, $accountno, $amount, $desc, $type, $amountleft, $itemnum,$notifyid, $note, $manager_id) || return $sth->errstr; - } else { - my $sth=$dbh->prepare("INSERT INTO accountlines - (borrowernumber, accountno, date, amount, description, accounttype, amountoutstanding,notify_id, note, manager_id) - VALUES (?, ?, now(), ?, ?, ?, ?,?,?,?)" - ); - $sth->execute( $borrowernumber, $accountno, $amount, $desc, $type, - $amountleft, $notifyid, $note, $manager_id ); - } - - if ( C4::Context->preference("FinesLog") ) { - logaction("FINES", 'CREATE',$borrowernumber,Dumper({ - action => 'create_fee', - borrowernumber => $borrowernumber, - accountno => $accountno, - amount => $amount, - description => $desc, - accounttype => $type, - amountoutstanding => $amountleft, - notify_id => $notifyid, - note => $note, - itemnumber => $itemnum, - manager_id => $manager_id, - })); - } - - return 0; -} - -sub getcharges { - my ( $borrowerno, $timestamp, $accountno ) = @_; - my $dbh = C4::Context->dbh; - my $timestamp2 = $timestamp - 1; - my $query = ""; - my $sth = $dbh->prepare( - "SELECT * FROM accountlines WHERE borrowernumber=? AND accountno = ?" - ); - $sth->execute( $borrowerno, $accountno ); - - my @results; - while ( my $data = $sth->fetchrow_hashref ) { - push @results,$data; - } - return (@results); -} - -sub ModNote { - my ( $accountlines_id, $note ) = @_; - my $dbh = C4::Context->dbh; - my $sth = $dbh->prepare('UPDATE accountlines SET note = ? WHERE accountlines_id = ?'); - $sth->execute( $note, $accountlines_id ); -} - -sub getcredits { - my ( $date, $date2 ) = @_; - my $dbh = C4::Context->dbh; - my $sth = $dbh->prepare( - "SELECT * FROM accountlines,borrowers - WHERE amount < 0 AND accounttype not like 'Pay%' AND accountlines.borrowernumber = borrowers.borrowernumber - AND timestamp >=TIMESTAMP(?) AND timestamp < TIMESTAMP(?)" - ); - - $sth->execute( $date, $date2 ); - my @results; - while ( my $data = $sth->fetchrow_hashref ) { - $data->{'date'} = $data->{'timestamp'}; - push @results,$data; - } - return (@results); -} - - -sub getrefunds { - my ( $date, $date2 ) = @_; - my $dbh = C4::Context->dbh; - - my $sth = $dbh->prepare( - "SELECT *,timestamp AS datetime - FROM accountlines,borrowers - WHERE (accounttype = 'REF' - AND accountlines.borrowernumber = borrowers.borrowernumber - AND date >=? AND date execute( $date, $date2 ); - - my @results; - while ( my $data = $sth->fetchrow_hashref ) { - push @results,$data; - - } - return (@results); -} - -sub ReversePayment { - my ( $accountlines_id ) = @_; - my $dbh = C4::Context->dbh; - - my $sth = $dbh->prepare('SELECT * FROM accountlines WHERE accountlines_id = ?'); - $sth->execute( $accountlines_id ); - my $row = $sth->fetchrow_hashref(); - my $amount_outstanding = $row->{'amountoutstanding'}; - - if ( $amount_outstanding <= 0 ) { - $sth = $dbh->prepare('UPDATE accountlines SET amountoutstanding = amount * -1, description = CONCAT( description, " Reversed -" ) WHERE accountlines_id = ?'); - $sth->execute( $accountlines_id ); - } else { - $sth = $dbh->prepare('UPDATE accountlines SET amountoutstanding = 0, description = CONCAT( description, " Reversed -" ) WHERE accountlines_id = ?'); - $sth->execute( $accountlines_id ); - } - - if ( C4::Context->preference("FinesLog") ) { - my $manager_id = 0; - $manager_id = C4::Context->userenv->{'number'} if C4::Context->userenv; - - if ( $amount_outstanding <= 0 ) { - $row->{'amountoutstanding'} *= -1; - } else { - $row->{'amountoutstanding'} = '0'; - } - $row->{'description'} .= ' Reversed -'; - logaction("FINES", 'MODIFY', $row->{'borrowernumber'}, Dumper({ - action => 'reverse_fee_payment', - borrowernumber => $row->{'borrowernumber'}, - old_amountoutstanding => $row->{'amountoutstanding'}, - new_amountoutstanding => 0 - $amount_outstanding,, - accountlines_id => $row->{'accountlines_id'}, - accountno => $row->{'accountno'}, - manager_id => $manager_id, - })); - - } - -} - -=head2 recordpayment_selectaccts - - recordpayment_selectaccts($borrowernumber, $payment,$accts); - -Record payment by a patron. C<$borrowernumber> is the patron's -borrower number. C<$payment> is a floating-point number, giving the -amount that was paid. C<$accts> is an array ref to a list of -accountnos which the payment can be recorded against - -Amounts owed are paid off oldest first. That is, if the patron has a -$1 fine from Feb. 1, another $1 fine from Mar. 1, and makes a payment -of $1.50, then the oldest fine will be paid off in full, and $0.50 -will be credited to the next one. - -=cut - -sub recordpayment_selectaccts { - my ( $borrowernumber, $amount, $accts, $note ) = @_; - - my $dbh = C4::Context->dbh; - my $newamtos = 0; - my $accdata = q{}; - my $branch = C4::Context->userenv->{branch}; - my $amountleft = $amount; - my $manager_id = 0; - $manager_id = C4::Context->userenv->{'number'} if C4::Context->userenv; - my $sql = 'SELECT * FROM accountlines WHERE (borrowernumber = ?) ' . - 'AND (amountoutstanding<>0) '; - if (@{$accts} ) { - $sql .= ' AND accountno IN ( ' . join ',', @{$accts}; - $sql .= ' ) '; - } - $sql .= ' ORDER BY date'; - # begin transaction - my $nextaccntno = getnextacctno($borrowernumber); - - # get lines with outstanding amounts to offset - my $rows = $dbh->selectall_arrayref($sql, { Slice => {} }, $borrowernumber); - - # offset transactions - my $sth = $dbh->prepare('UPDATE accountlines SET amountoutstanding= ? ' . - 'WHERE accountlines_id=?'); - - my @ids; - for my $accdata ( @{$rows} ) { - if ($amountleft == 0) { - last; - } - if ( $accdata->{amountoutstanding} < $amountleft ) { - $newamtos = 0; - $amountleft -= $accdata->{amountoutstanding}; - } - else { - $newamtos = $accdata->{amountoutstanding} - $amountleft; - $amountleft = 0; - } - my $thisacct = $accdata->{accountlines_id}; - $sth->execute( $newamtos, $thisacct ); - - if ( C4::Context->preference("FinesLog") ) { - logaction("FINES", 'MODIFY', $borrowernumber, Dumper({ - action => 'fee_payment', - borrowernumber => $borrowernumber, - old_amountoutstanding => $accdata->{'amountoutstanding'}, - new_amountoutstanding => $newamtos, - amount_paid => $accdata->{'amountoutstanding'} - $newamtos, - accountlines_id => $accdata->{'accountlines_id'}, - accountno => $accdata->{'accountno'}, - manager_id => $manager_id, - })); - push( @ids, $accdata->{'accountlines_id'} ); - } - - } - - # create new line - $sql = 'INSERT INTO accountlines ' . - '(borrowernumber, accountno,date,amount,description,accounttype,amountoutstanding,manager_id,note) ' . - q|VALUES (?,?,now(),?,'','Pay',?,?,?)|; - $dbh->do($sql,{},$borrowernumber, $nextaccntno, 0 - $amount, 0 - $amountleft, $manager_id, $note ); - UpdateStats({ - branch => $branch, - type => 'payment', - amount => $amount, - borrowernumber => $borrowernumber, - accountno => $nextaccntno} - ); - - if ( C4::Context->preference("FinesLog") ) { - logaction("FINES", 'CREATE',$borrowernumber,Dumper({ - action => 'create_payment', - borrowernumber => $borrowernumber, - accountno => $nextaccntno, - amount => 0 - $amount, - amountoutstanding => 0 - $amountleft, - accounttype => 'Pay', - accountlines_paid => \@ids, - manager_id => $manager_id, - })); - } - - return; -} - -# makepayment needs to be fixed to handle partials till then this separate subroutine -# fills in -sub makepartialpayment { - my ( $accountlines_id, $borrowernumber, $accountno, $amount, $user, $branch, $payment_note ) = @_; - my $manager_id = 0; - $manager_id = C4::Context->userenv->{'number'} if C4::Context->userenv; - if (!$amount || $amount < 0) { - return; - } - $payment_note //= ""; - my $dbh = C4::Context->dbh; - - my $nextaccntno = getnextacctno($borrowernumber); - my $newamtos = 0; - - my $data = $dbh->selectrow_hashref( - 'SELECT * FROM accountlines WHERE accountlines_id=?',undef,$accountlines_id); - my $new_outstanding = $data->{amountoutstanding} - $amount; - - my $update = 'UPDATE accountlines SET amountoutstanding = ? WHERE accountlines_id = ? '; - $dbh->do( $update, undef, $new_outstanding, $accountlines_id); - - if ( C4::Context->preference("FinesLog") ) { - logaction("FINES", 'MODIFY', $borrowernumber, Dumper({ - action => 'fee_payment', - borrowernumber => $borrowernumber, - old_amountoutstanding => $data->{'amountoutstanding'}, - new_amountoutstanding => $new_outstanding, - amount_paid => $data->{'amountoutstanding'} - $new_outstanding, - accountlines_id => $data->{'accountlines_id'}, - accountno => $data->{'accountno'}, - manager_id => $manager_id, - })); - } - - # create new line - my $insert = 'INSERT INTO accountlines (borrowernumber, accountno, date, amount, ' - . 'description, accounttype, amountoutstanding, itemnumber, manager_id, note) ' - . ' VALUES (?, ?, now(), ?, ?, ?, 0, ?, ?, ?)'; - - $dbh->do( $insert, undef, $borrowernumber, $nextaccntno, $amount, - "Payment, thanks - $user", 'Pay', $data->{'itemnumber'}, $manager_id, $payment_note); - - UpdateStats({ - branch => $user, - type => 'payment', - amount => $amount, - borrowernumber => $borrowernumber, - accountno => $accountno} - ); - - if ( C4::Context->preference("FinesLog") ) { - logaction("FINES", 'CREATE',$borrowernumber,Dumper({ - action => 'create_payment', - borrowernumber => $user, - accountno => $nextaccntno, - amount => 0 - $amount, - accounttype => 'Pay', - itemnumber => $data->{'itemnumber'}, - accountlines_paid => [ $data->{'accountlines_id'} ], - manager_id => $manager_id, - })); - } - - return; -} - -=head2 WriteOffFee - - WriteOffFee( $borrowernumber, $accountline_id, $itemnum, $accounttype, $amount, $branch, $payment_note ); - -Write off a fine for a patron. -C<$borrowernumber> is the patron's borrower number. -C<$accountline_id> is the accountline_id of the fee to write off. -C<$itemnum> is the itemnumber of of item whose fine is being written off. -C<$accounttype> is the account type of the fine being written off. -C<$amount> is a floating-point number, giving the amount that is being written off. -C<$branch> is the branchcode of the library where the writeoff occurred. -C<$payment_note> is the note to attach to this payment - -=cut - -sub WriteOffFee { - my ( $borrowernumber, $accountlines_id, $itemnum, $accounttype, $amount, $branch, $payment_note ) = @_; - $payment_note //= ""; - $branch ||= C4::Context->userenv->{branch}; - my $manager_id = 0; - $manager_id = C4::Context->userenv->{'number'} if C4::Context->userenv; - - # if no item is attached to fine, make sure to store it as a NULL - $itemnum ||= undef; - - my ( $sth, $query ); - my $dbh = C4::Context->dbh(); - - $query = " - UPDATE accountlines SET amountoutstanding = 0 - WHERE accountlines_id = ? AND borrowernumber = ? - "; - $sth = $dbh->prepare( $query ); - $sth->execute( $accountlines_id, $borrowernumber ); - - if ( C4::Context->preference("FinesLog") ) { - logaction("FINES", 'MODIFY', $borrowernumber, Dumper({ - action => 'fee_writeoff', - borrowernumber => $borrowernumber, - accountlines_id => $accountlines_id, - manager_id => $manager_id, - })); - } - - $query =" - INSERT INTO accountlines - ( borrowernumber, accountno, itemnumber, date, amount, description, accounttype, manager_id, note ) - VALUES ( ?, ?, ?, NOW(), ?, 'Writeoff', 'W', ?, ? ) - "; - $sth = $dbh->prepare( $query ); - my $acct = getnextacctno($borrowernumber); - $sth->execute( $borrowernumber, $acct, $itemnum, $amount, $manager_id, $payment_note ); - - if ( C4::Context->preference("FinesLog") ) { - logaction("FINES", 'CREATE',$borrowernumber,Dumper({ - action => 'create_writeoff', - borrowernumber => $borrowernumber, - accountno => $acct, - amount => 0 - $amount, - accounttype => 'W', - itemnumber => $itemnum, - accountlines_paid => [ $accountlines_id ], - manager_id => $manager_id, - })); - } - - UpdateStats({ - branch => $branch, - type => 'writeoff', - amount => $amount, - borrowernumber => $borrowernumber} - ); - -} - -END { } # module clean-up code here (global destructor) - -1; -__END__ - -=head1 SEE ALSO - -DBI(3) - -=cut - diff --git a/Koha/Schema/Result/Accountline.pm b/Koha/Schema/Result/Accountline.pm deleted file mode 100644 index e83ef40..0000000 --- a/Koha/Schema/Result/Accountline.pm +++ /dev/null @@ -1,222 +0,0 @@ -use utf8; -package Koha::Schema::Result::Accountline; - -# Created by DBIx::Class::Schema::Loader -# DO NOT MODIFY THE FIRST PART OF THIS FILE - -=head1 NAME - -Koha::Schema::Result::Accountline - -=cut - -use strict; -use warnings; - -use base 'DBIx::Class::Core'; - -=head1 TABLE: C - -=cut - -__PACKAGE__->table("accountlines"); - -=head1 ACCESSORS - -=head2 accountlines_id - - data_type: 'integer' - is_auto_increment: 1 - is_nullable: 0 - -=head2 borrowernumber - - data_type: 'integer' - default_value: 0 - is_foreign_key: 1 - is_nullable: 0 - -=head2 accountno - - data_type: 'smallint' - default_value: 0 - is_nullable: 0 - -=head2 itemnumber - - data_type: 'integer' - is_foreign_key: 1 - is_nullable: 1 - -=head2 date - - data_type: 'date' - datetime_undef_if_invalid: 1 - is_nullable: 1 - -=head2 amount - - data_type: 'decimal' - is_nullable: 1 - size: [28,6] - -=head2 description - - data_type: 'mediumtext' - is_nullable: 1 - -=head2 dispute - - data_type: 'mediumtext' - is_nullable: 1 - -=head2 accounttype - - data_type: 'varchar' - is_nullable: 1 - size: 5 - -=head2 amountoutstanding - - data_type: 'decimal' - is_nullable: 1 - size: [28,6] - -=head2 lastincrement - - data_type: 'decimal' - is_nullable: 1 - size: [28,6] - -=head2 timestamp - - data_type: 'timestamp' - datetime_undef_if_invalid: 1 - default_value: current_timestamp - is_nullable: 0 - -=head2 notify_id - - data_type: 'integer' - default_value: 0 - is_nullable: 0 - -=head2 notify_level - - data_type: 'integer' - default_value: 0 - is_nullable: 0 - -=head2 note - - data_type: 'text' - is_nullable: 1 - -=head2 manager_id - - data_type: 'integer' - is_nullable: 1 - -=cut - -__PACKAGE__->add_columns( - "accountlines_id", - { data_type => "integer", is_auto_increment => 1, is_nullable => 0 }, - "borrowernumber", - { - data_type => "integer", - default_value => 0, - is_foreign_key => 1, - is_nullable => 0, - }, - "accountno", - { data_type => "smallint", default_value => 0, is_nullable => 0 }, - "itemnumber", - { data_type => "integer", is_foreign_key => 1, is_nullable => 1 }, - "date", - { data_type => "date", datetime_undef_if_invalid => 1, is_nullable => 1 }, - "amount", - { data_type => "decimal", is_nullable => 1, size => [28, 6] }, - "description", - { data_type => "mediumtext", is_nullable => 1 }, - "dispute", - { data_type => "mediumtext", is_nullable => 1 }, - "accounttype", - { data_type => "varchar", is_nullable => 1, size => 5 }, - "amountoutstanding", - { data_type => "decimal", is_nullable => 1, size => [28, 6] }, - "lastincrement", - { data_type => "decimal", is_nullable => 1, size => [28, 6] }, - "timestamp", - { - data_type => "timestamp", - datetime_undef_if_invalid => 1, - default_value => \"current_timestamp", - is_nullable => 0, - }, - "notify_id", - { data_type => "integer", default_value => 0, is_nullable => 0 }, - "notify_level", - { data_type => "integer", default_value => 0, is_nullable => 0 }, - "note", - { data_type => "text", is_nullable => 1 }, - "manager_id", - { data_type => "integer", is_nullable => 1 }, -); - -=head1 PRIMARY KEY - -=over 4 - -=item * L - -=back - -=cut - -__PACKAGE__->set_primary_key("accountlines_id"); - -=head1 RELATIONS - -=head2 borrowernumber - -Type: belongs_to - -Related object: L - -=cut - -__PACKAGE__->belongs_to( - "borrowernumber", - "Koha::Schema::Result::Borrower", - { borrowernumber => "borrowernumber" }, - { is_deferrable => 1, on_delete => "CASCADE", on_update => "CASCADE" }, -); - -=head2 itemnumber - -Type: belongs_to - -Related object: L - -=cut - -__PACKAGE__->belongs_to( - "itemnumber", - "Koha::Schema::Result::Item", - { itemnumber => "itemnumber" }, - { - is_deferrable => 1, - join_type => "LEFT", - on_delete => "SET NULL", - on_update => "SET NULL", - }, -); - - -# Created by DBIx::Class::Schema::Loader v0.07039 @ 2014-07-11 09:26:55 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:jUiCeLLPg5228rNEBW0w2g - - -# You can replace this text with custom content, and it will be preserved on regeneration -1; diff --git a/Koha/Schema/Result/Accountoffset.pm b/Koha/Schema/Result/Accountoffset.pm deleted file mode 100644 index e9d8c2f..0000000 --- a/Koha/Schema/Result/Accountoffset.pm +++ /dev/null @@ -1,106 +0,0 @@ -use utf8; -package Koha::Schema::Result::Accountoffset; - -# Created by DBIx::Class::Schema::Loader -# DO NOT MODIFY THE FIRST PART OF THIS FILE - -=head1 NAME - -Koha::Schema::Result::Accountoffset - -=cut - -use strict; -use warnings; - -use base 'DBIx::Class::Core'; - -=head1 TABLE: C - -=cut - -__PACKAGE__->table("accountoffsets"); - -=head1 ACCESSORS - -=head2 borrowernumber - - data_type: 'integer' - default_value: 0 - is_foreign_key: 1 - is_nullable: 0 - -=head2 accountno - - data_type: 'smallint' - default_value: 0 - is_nullable: 0 - -=head2 offsetaccount - - data_type: 'smallint' - default_value: 0 - is_nullable: 0 - -=head2 offsetamount - - data_type: 'decimal' - is_nullable: 1 - size: [28,6] - -=head2 timestamp - - data_type: 'timestamp' - datetime_undef_if_invalid: 1 - default_value: current_timestamp - is_nullable: 0 - -=cut - -__PACKAGE__->add_columns( - "borrowernumber", - { - data_type => "integer", - default_value => 0, - is_foreign_key => 1, - is_nullable => 0, - }, - "accountno", - { data_type => "smallint", default_value => 0, is_nullable => 0 }, - "offsetaccount", - { data_type => "smallint", default_value => 0, is_nullable => 0 }, - "offsetamount", - { data_type => "decimal", is_nullable => 1, size => [28, 6] }, - "timestamp", - { - data_type => "timestamp", - datetime_undef_if_invalid => 1, - default_value => \"current_timestamp", - is_nullable => 0, - }, -); - -=head1 RELATIONS - -=head2 borrowernumber - -Type: belongs_to - -Related object: L - -=cut - -__PACKAGE__->belongs_to( - "borrowernumber", - "Koha::Schema::Result::Borrower", - { borrowernumber => "borrowernumber" }, - { is_deferrable => 1, on_delete => "CASCADE", on_update => "CASCADE" }, -); - - -# Created by DBIx::Class::Schema::Loader v0.07025 @ 2013-10-14 20:56:21 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:OTfcUiJCPb5aU/gjqAb/bA - - -# You can replace this text with custom content, and it will be preserved on regeneration -1; diff --git a/circ/stats.pl b/circ/stats.pl deleted file mode 100755 index 3fc8283..0000000 --- a/circ/stats.pl +++ /dev/null @@ -1,189 +0,0 @@ -#!/usr/bin/perl - - -#written 14/1/2000 -#script to display reports - -# Copyright 2000-2002 Katipo Communications -# -# 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 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. - -use strict; -#use warnings; FIXME - Bug 2505 -use CGI; -use C4::Context; -use C4::Output; -use C4::Auth; -use Date::Manip; -use C4::Stats; -use C4::Debug; - -use vars qw($debug); - -my $input = new CGI; -my $time = $input->param('time') || ''; - -my ( $template, $loggedinuser, $cookie ) = get_template_and_user( - { - template_name => "circ/stats.tt", - query => $input, - type => "intranet", - authnotrequired => 0, - flagsrequired => { reports => 1 }, - debug => 1, - } -); - -my $date; -my $date2; -if ( $time eq 'yesterday' ) { - $date = ParseDate('yesterday'); - $date2 = ParseDate('today'); -} -elsif ( $time eq 'today' ) { - $date = ParseDate('today'); - $date2 = ParseDate('tomorrow'); -} -elsif ( $time eq 'daybefore' ) { - $date = ParseDate('2 days ago'); - $date2 = ParseDate('yesterday'); -} -elsif ( $time eq 'month' ) { - $date = ParseDate('1 month ago'); - $date2 = ParseDate('today'); -} -elsif ( $time =~ /\// ) { - $date = ParseDate($time); - $date2 = ParseDateDelta('+ 1 day'); - $date2 = DateCalc( $date, $date2 ); -} else { - $template->param(notime => '1'); # TODO: add error feedback if time sent, but unrecognized - output_html_with_http_headers $input, $cookie, $template->output; - exit; -} - -$debug and warn "d : $date // d2 : $date2"; -$date = UnixDate( $date, '%Y-%m-%d' ); -$date2 = UnixDate( $date2, '%Y-%m-%d' ); -$debug and warn "d : $date // d2 : $date2"; -my @payments = TotalPaid( $date, $date2 ); -my $count = @payments; -my $total = 0; -my $totalw = 0; -my $oldtime; -my @loop; -my %row; -my $i = 0; - -while ( $i < $count ) { - $debug and warn " pay : " . $payments[$i]{'timestamp'}; - my $time = $payments[$i]{'datetime'}; - my $payments = $payments[$i]{'value'}; - my $charge = 0; - my @temp = split(/ /, $payments[$i]{'datetime'}); - my $date = $temp[0]; - my @charges = - getcharges( $payments[$i]{'borrowernumber'}, $payments[$i]{'timestamp'} ); - my $count = @charges; - my $temptotalf = 0; - my $temptotalr = 0; - my $temptotalres = 0; - my $temptotalren = 0; - my $temptotalw = 0; - - # FIXME: way too much logic to live only here in a report script - for ( my $i2 = 0 ; $i2 < $count ; $i2++ ) { - $charge += $charges[$i2]->{'amount'}; - %row = ( - name => $charges[$i2]->{'description'}, - type => $charges[$i2]->{'accounttype'}, - time => $charges[$i2]->{'timestamp'}, - amount => $charges[$i2]->{'amount'}, - branch => $charges[$i2]->{'amountoutstanding'} - ); - push( @loop, \%row ); - if ( $payments[$i]{'accountytpe'} ne 'W' ) { - if ( $charges[$i2]->{'accounttype'} eq 'Rent' ) { - $temptotalr += - $charges[$i2]->{'amount'} - - $charges[$i2]->{'amountoutstanding'}; - } - if ( $charges[$i2]->{'accounttype'} eq 'F' - || $charges[$i2]->{'accounttype'} eq 'FU' - || $charges[$i2]->{'accounttype'} eq 'FN' ) - { - $temptotalf += - $charges[$i2]->{'amount'} - - $charges[$i2]->{'amountoutstanding'}; - } - if ( $charges[$i2]->{'accounttype'} eq 'Res' ) { - $temptotalres += - $charges[$i2]->{'amount'} - - $charges[$i2]->{'amountoutstanding'}; - } - if ( $charges[$i2]->{'accounttype'} eq 'R' ) { - $temptotalren += - $charges[$i2]->{'amount'} - - $charges[$i2]->{'amountoutstanding'}; - } - } - } - my $time2 = $payments[$i]{'date'}; - my $branch = Getpaidbranch( $time2, $payments[$i]{'borrowernumber'} ); - my $borrowernumber = $payments[$i]{'borrowernumber'}; - my $oldtime = $payments[$i]{'timestamp'}; - my $oldtype = $payments[$i]{'accounttype'}; - - while ($borrowernumber eq $payments[$i]{'borrowernumber'} - && $oldtype == $payments[$i]{'accounttype'} - && $oldtime eq $payments[$i]{'timestamp'} ) - { - my $xtime2 = $payments[$i]{'date'}; - my $branch = Getpaidbranch( $xtime2, $payments[$i]{'borrowernumber'} ); - if ( $payments[$i]{'accounttype'} eq 'W' ) { - $totalw += $payments[$i]{'amount'}; - } - else { - $payments[$i]{'amount'} = $payments[$i]{'amount'} * -1; - $total += $payments[$i]{'amount'}; - } - - #FIXME: display layer HTML - %row = ( - name => "" - . $payments[$i]{'firstname'} - . $payments[$i]{'surname'} . "", - type => $payments[$i]{'accounttype'}, - time => $payments[$i]{'date'}, - amount => $payments[$i]{'amount'}, - branch => $branch - ); - push( @loop, \%row ); - $oldtype = $payments[$i]{'accounttype'}; - $oldtime = $payments[$i]{'timestamp'}; - $borrowernumber = $payments[$i]{'borrowernumber'}; - $i++; - } -} - -$template->param( - loop1 => \@loop, - totalw => $totalw, - total => $total -); - -output_html_with_http_headers $input, $cookie, $template->output; - diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/stats.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/stats.tt deleted file mode 100644 index d62c1af..0000000 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/stats.tt +++ /dev/null @@ -1,55 +0,0 @@ -[% INCLUDE 'doc-head-open.inc' %] -Koha › Circulation › Statistics -[% INCLUDE 'doc-head-close.inc' %] - - -[% INCLUDE 'header.inc' %] -[% INCLUDE 'circ-search.inc' %] - - - -
- -
-
-
- - [% IF ( notime ) %] -

Display statistics for:

-
    -
  • yesterday
  • -
  • today
  • - [% ELSE %] - [% IF ( loop1 ) %] - - - - - - - - - - [% FOREACH loop IN loop1 %] - - - - - - - - [% END %] -
    Statistics
    NameTypeDate/timeAmountLibrary
    [% loop.name %][% loop.type %][% loop.time %][% loop.amount %][% loop.branch %]
    -

    Total paid: [% total %]
    Total written off: [% totalw %]

    - [% ELSE %] -

    No statistics to report

    - [% END %] - - [% END %] -
-
-
-[% INCLUDE 'circ-menu.inc' %] -
-
-[% INCLUDE 'intranet-bottom.inc' %] \ No newline at end of file diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/members/boraccount.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/members/boraccount.tt deleted file mode 100644 index 26808a3..0000000 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/boraccount.tt +++ /dev/null @@ -1,122 +0,0 @@ -[% INCLUDE 'doc-head-open.inc' %] -Koha › Patrons › Account for [% INCLUDE 'patron-title.inc' %] -[% INCLUDE 'doc-head-close.inc' %] - - -[% INCLUDE 'header.inc' %] -[% INCLUDE 'patron-search.inc' %] - - - -
- -
-
-
-[% INCLUDE 'members-toolbar.inc' %] -
- - -
- -
- - - - - - - - - [% IF ( reverse_col ) %] - - [% END %] - - - - - [% FOREACH account IN accounts %] - - [% IF ( loop.odd ) %][% ELSE %][% END %] - - - - [% IF ( account.amountcredit ) %] - [% IF ( account.amountoutstandingcredit ) %] - [% IF ( reverse_col ) %] - - [% END %] - - - - [% END %] - - - - [% IF ( totalcredit ) %] - [% IF ( reverse_col ) %] - - - -
DateDescription of chargesNoteAmountOutstanding Print
[% account.date %] - [% SWITCH account.accounttype %] - [% CASE 'Pay' %]Payment, thanks - [% CASE 'Pay00' %]Payment, thanks (cash via SIP2) - [% CASE 'Pay01' %]Payment, thanks (VISA via SIP2) - [% CASE 'Pay02' %]Payment, thanks (credit card via SIP2) - [% CASE 'N' %]New card - [% CASE 'F' %]Fine - [% CASE 'A' %]Account management fee - [% CASE 'M' %]Sundry - [% CASE 'L' %]Lost item - [% CASE 'W' %]Writeoff - [% CASE 'FU' %]Accruing fine - [% CASE 'Rent' %]Rental fee - [% CASE 'FOR' %]Forgiven - [% CASE 'LR' %]Lost item fee refund - [% CASE 'PAY' %]Payment - [% CASE 'WO' %]Writeoff - [% CASE 'C' %]Credit - [% CASE 'CR' %]Credit - [% CASE %][% account.accounttype %] - [%- END -%] - [%- IF account.description %], [% account.description %][% END %] -  [% IF ( account.itemnumber ) %]View item [% END %][% account.title |html %][% account.note | html_line_break %][% ELSE %][% END %][% account.amount %][% ELSE %][% END %][% account.amountoutstanding %] - [% IF ( account.payment ) %] - Reverse - [% ELSE %] -   - [% END %] - - [% IF ( account.payment ) %] - Print - [% ELSE %] - Print - [% END %] -
Total due - [% ELSE %] - - [% END %] - [% ELSE %] - [% IF ( reverse_col ) %] - - [% ELSE %] - - [% END %] - [% END %] - [% total %]
-
- -
-
- -
-[% INCLUDE 'circ-menu.inc' %] -
-
-[% INCLUDE 'intranet-bottom.inc' %] diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/members/mancredit.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/members/mancredit.tt deleted file mode 100644 index 13500ab..0000000 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/mancredit.tt +++ /dev/null @@ -1,63 +0,0 @@ -[% INCLUDE 'doc-head-open.inc' %] -Koha › Patrons › Create manual credit -[% INCLUDE 'doc-head-close.inc' %] - - - -[% INCLUDE 'header.inc' %] -[% INCLUDE 'patron-search.inc' %] - - - -
- -
-
-
-[% INCLUDE 'members-toolbar.inc' %] - - -
- -
- -
- - -
-Manual credit
    -
  1. -
  2. -
  3. -
  4. -
  5. Example: 5.00
  6. -
- -
Cancel
-
- -
- -
-
- -
-[% INCLUDE 'circ-menu.inc' %] -
-
-[% INCLUDE 'intranet-bottom.inc' %] diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/members/maninvoice.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/members/maninvoice.tt deleted file mode 100644 index 445fffe..0000000 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/maninvoice.tt +++ /dev/null @@ -1,87 +0,0 @@ -[% INCLUDE 'doc-head-open.inc' %] -Koha › Patrons › Create manual invoice -[% INCLUDE 'doc-head-close.inc' %] - - - -[% INCLUDE 'header.inc' %] -[% INCLUDE 'patron-search.inc' %] - - - -
- -
-
-
-[% INCLUDE 'members-toolbar.inc' %] - - -
- -
- -[% IF ( ERROR ) %] -[% IF ( ITEMNUMBER ) %] - ERROR an invalid itemnumber was entered, please hit back and try again -[% END %] -[% ELSE %] -
-
- Manual invoice -
    -
  1. - - - -
  2. -
  3. -
  4. -
  5. -
  6. Example: 5.00
  7. -
-
Cancel
-
- -[% END %] -
- -
-
- -
-[% INCLUDE 'circ-menu.inc' %] -
-
-[% INCLUDE 'intranet-bottom.inc' %] diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/members/pay.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/members/pay.tt deleted file mode 100644 index 7ba26d8..0000000 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/pay.tt +++ /dev/null @@ -1,178 +0,0 @@ -[% INCLUDE 'doc-head-open.inc' %] -Koha › Patrons › Pay Fines for [% borrower.firstname %] [% borrower.surname %] -[% INCLUDE 'doc-head-close.inc' %] - - - - -[% INCLUDE 'header.inc' %] -[% INCLUDE 'patron-search.inc' %] - - - -
- -
-
-
-[% INCLUDE 'members-toolbar.inc' borrowernumber=borrower.borrowernumber %] - - -
- -
- -[% IF ( accounts ) %] -
- -

Select all | Clear all

- - - - - - - - - - - - - - - - - - - - - -[% FOREACH account_grp IN accounts %] - [% FOREACH line IN account_grp.accountlines %] - - - - - - - - - - - -[% END %] -[% IF ( account_grp.total ) %] - - - - - -[% END %] -[% END %] - -
 Fines & chargesDescriptionPayment noteAccount typeNotify idLevelAmountAmount outstanding
Total due:[% total | format('%.2f') %]
- [% IF ( line.amountoutstanding > 0 ) %] - - [% END %] - - [% IF ( line.amountoutstanding > 0 ) %] - - [% IF CAN_user_updatecharges_writeoff %][% END %] - [% END %] - - - - - - - - - - - - - [% SWITCH line.accounttype %] - [% CASE 'Pay' %]Payment, thanks - [% CASE 'Pay00' %]Payment, thanks (cash via SIP2) - [% CASE 'Pay01' %]Payment, thanks (VISA via SIP2) - [% CASE 'Pay02' %]Payment, thanks (credit card via SIP2) - [% CASE 'N' %]New card - [% CASE 'F' %]Fine - [% CASE 'A' %]Account management fee - [% CASE 'M' %]Sundry - [% CASE 'L' %]Lost item - [% CASE 'W' %]Writeoff - [% CASE 'FU' %]Accruing fine - [% CASE 'Rent' %]Rental fee - [% CASE 'FOR' %]Forgiven - [% CASE 'LR' %]Lost item fee refund - [% CASE 'PAY' %]Payment - [% CASE 'WO' %]Writeoff - [% CASE 'C' %]Credit - [% CASE 'CR' %]Credit - [% CASE %][% line.accounttype %] - [%- END -%] - [%- IF line.description %], [% line.description %][% END %] - [% IF line.title %]([% line.title |html_entity %])[% END %] - [% line.accounttype %][% line.notify_id %][% line.notify_level %][% line.amount | format('%.2f') %][% line.amountoutstanding | format('%.2f') %]
Sub total:[% account_grp.total | format('%.2f') %]
-
- -[% IF CAN_user_updatecharges_writeoff %][% END %] - -Cancel -
-
-[% ELSE %] -

[% borrower.firstname %] [% borrower.surname %] has no outstanding fines.

-[% END %] -
- -
-
- -
-[% INCLUDE 'circ-menu.tt' %] -
-
-[% INCLUDE 'intranet-bottom.inc' %] diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/members/paycollect.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/members/paycollect.tt deleted file mode 100644 index 9cec275..0000000 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/paycollect.tt +++ /dev/null @@ -1,233 +0,0 @@ -[% INCLUDE 'doc-head-open.inc' %] -Koha › Patrons › Collect fine payment for [% borrower.firstname %] [% borrower.surname %] -[% INCLUDE 'doc-head-close.inc' %] - - - - -[% INCLUDE 'header.inc' %] -[% INCLUDE 'patron-search.inc' %] - - -
- -
-
-
-[% INCLUDE 'members-toolbar.inc' borrowernumber=borrower.borrowernumber %] - - - -
- -
-[% IF ( error_over ) %] -
- You must pay a value less than or equal to [% total_due | format('%.2f') %]. -
-[% END %] - -[% IF ( pay_individual ) %] -
- - - - - - - - - - - - - -
- Pay an individual fine - - - - - - - - - - - - - - - - - - - - - -
DescriptionAccount typeNotify idLevelAmountAmount outstanding
Total amount payable:[% amountoutstanding | format('%.2f') %]
- [% description %] [% title %] - [% accounttype %][% notify_id %][% notify_level %][% amount | format('%.2f') %][% amountoutstanding | format('%.2f') %]
- -
    - -
  1. - - - -
  2. -
-
- - -
-[% ELSIF ( writeoff_individual ) %] -
-
- Write off an individual fine - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
DescriptionAccount typeNotify idLevelAmountAmount outstanding
Total amount to be written off:[% amountoutstanding | format('%.2f') %]
[% description %] [% title %][% accounttype %][% notify_id %][% notify_level %][% amount | format('%.2f') %][% amountoutstanding | format('%.2f') %]
-
- -
-[% ELSE %] - -
- - - - -
- [% IF ( selected_accts ) %]Pay an amount toward selected fines[% ELSE %]Pay an amount toward all fines[% END %] -
    -
  1. - Total amount outstanding: - [% total | format('%.2f') %] -
  2. -
  3. - - - -
  4. -
  5. - - -
  6. -
-
- -
-[% END %] -
-
-
- -
-[% INCLUDE 'circ-menu.tt' %] -
-
-[% INCLUDE 'intranet-bottom.inc' %] - diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/members/printfeercpt.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/members/printfeercpt.tt deleted file mode 100644 index 64bbf35..0000000 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/printfeercpt.tt +++ /dev/null @@ -1,59 +0,0 @@ -[% USE Koha %] -[% INCLUDE 'doc-head-open.inc' %] -Print Receipt for [% cardnumber %] - - - -[% INCLUDE 'slip-print.inc' #printThenClose %] - - - -
- - -[% IF ( LibraryName ) %] - - - -[% END %] - - - - - - - - - - - - - - - - [% FOREACH account IN accounts %] - - - - [% IF ( account.amountcredit ) %] - - - [% END %] - - - - [% IF ( totalcredit ) %] - - -
-

[% LibraryName %]

-
-

Fee receipt

-
- [% IF ( branchname ) %]

[% branchname %]

[% END %] -
- Received with thanks from [% firstname %] [% surname %]
- Card number : [% cardnumber %]
-
DateDescription of chargesAmount
[% account.date %][% account.description %][% ELSE %][% END %][% account.amount %]
Total outstanding dues as on date : [% ELSE %][% END %][% total %]
-
-[% INCLUDE 'intranet-bottom.inc' %] diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/members/printinvoice.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/members/printinvoice.tt deleted file mode 100644 index 29e64da..0000000 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/printinvoice.tt +++ /dev/null @@ -1,61 +0,0 @@ -[% USE Koha %] -[% INCLUDE 'doc-head-open.inc' %] -Print Receipt for [% cardnumber %] - - - -[% INCLUDE 'slip-print.inc' #printThenClose %] - - - -
- - -[% IF ( LibraryName ) %] - - - -[% END %] - - - - - - - - - - - - - - - - - [% FOREACH account IN accounts %] - - - - [% IF ( account.amountcredit ) %] - [% IF ( account.amountoutstandingcredit ) %] - - - [% END %] - - - - [% IF ( totalcredit ) %] - - -
-

[% LibraryName %]

-
-

INVOICE

-
- [% IF ( branchname ) %]

[% branchname %]

[% END %] -
- Bill to: [% firstname %] [% surname %]
- Card number: [% cardnumber %]
-
DateDescription of chargesAmountAmount outstanding
[% account.date %][% account.description %][% ELSE %][% END %][% account.amount %][% ELSE %][% END %][% account.amountoutstanding %]
Total outstanding dues as on date: [% ELSE %][% END %][% total %]
-
-[% INCLUDE 'intranet-bottom.inc' %] diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/reports/stats_screen.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/reports/stats_screen.tt deleted file mode 100644 index df53367..0000000 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/reports/stats_screen.tt +++ /dev/null @@ -1,131 +0,0 @@ -[% INCLUDE 'doc-head-open.inc' %] -Koha › Reports › Till reconciliation -[% INCLUDE 'doc-head-close.inc' %] -[% INCLUDE 'calendar.inc' %] - - -[% INCLUDE 'header.inc' %] -[% INCLUDE 'circ-search.inc' %] - - -
- -
-
-
- -

Till reconciliation

- -
Search between two dates -
- - - - - -
- - -

Payments

- - - - - - - - - - - - - - - [% FOREACH loop IN loop1 %] - - - - - - - - - - - - [% END %] -
LibraryDate/timeSurnameFirst nameDescriptionCharge typeInvoice amountPayment typePayment amount
[% loop.branch %][% loop.datetime %][% loop.surname %][% loop.firstname %][% loop.description %][% loop.accounttype %][% loop.amount %][% loop.type %][% loop.value %]
- -

- Total amount paid: [% totalpaid %] -

- - -

Credits

- - - - - - - - - - - - - [% FOREACH loop IN loop2 %] - - - - - - - - - - [% END %] -
LibraryDate/timeSurnameFirst nameDescriptionCharge typeInvoice amount
[% loop.creditbranch %][% loop.creditdate %][% loop.creditsurname %][% loop.creditfirstname %][% loop.creditdescription %][% loop.creditaccounttype %][% loop.creditamount %]
-

-

  • Total amount credits: [% totalcredits %]
  • -
  • Total number written off: [% totalwritten %] charges
-

- - -

Refunds

- - - - - - - - - - - - - [% FOREACH loop IN loop3 %] - - - - - - - - - - [% END %] -
LibraryDate/timeSurnameFirst nameDescriptionCharge typeInvoice amount
[% loop.refundbranch %][% loop.refunddate %][% loop.refundsurname %][% loop.refundfirstname %][% loop.refunddescription %][% loop.refundaccounttype %][% loop.refundamount %]
-

-

  • Total amount refunds: [% totalrefund %]
  • -
  • Total amount of cash collected: [% totalcash %]
-

-
-
-
-[% INCLUDE 'reports-menu.inc' %] -
-
-[% INCLUDE 'intranet-bottom.inc' %] diff --git a/members/boraccount.pl b/members/boraccount.pl deleted file mode 100755 index 50f5db9..0000000 --- a/members/boraccount.pl +++ /dev/null @@ -1,145 +0,0 @@ -#!/usr/bin/perl - - -#writen 11/1/2000 by chris@katipo.oc.nz -#script to display borrowers account details - - -# Copyright 2000-2002 Katipo Communications -# -# 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 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. - -use strict; -use warnings; - -use C4::Auth; -use C4::Output; -use C4::Dates qw/format_date/; -use CGI; -use C4::Members; -use C4::Branch; -use C4::Accounts; -use C4::Members::Attributes qw(GetBorrowerAttributes); - -my $input=new CGI; - - -my ($template, $loggedinuser, $cookie) = get_template_and_user( - { - template_name => "members/boraccount.tt", - query => $input, - type => "intranet", - authnotrequired => 0, - flagsrequired => { borrowers => 1, - updatecharges => 'remaining_permissions'}, - debug => 1, - } -); - -my $borrowernumber=$input->param('borrowernumber'); -my $action = $input->param('action') || ''; - -#get borrower details -my $data=GetMember('borrowernumber' => $borrowernumber); - -if ( $action eq 'reverse' ) { - ReversePayment( $input->param('accountlines_id') ); -} - -if ( $data->{'category_type'} eq 'C') { - my ( $catcodes, $labels ) = GetborCatFromCatType( 'A', 'WHERE category_type = ?' ); - my $cnt = scalar(@$catcodes); - $template->param( 'CATCODE_MULTI' => 1) if $cnt > 1; - $template->param( 'catcode' => $catcodes->[0]) if $cnt == 1; -} - -#get account details -my ($total,$accts,undef)=GetMemberAccountRecords($borrowernumber); -my $totalcredit; -if($total <= 0){ - $totalcredit = 1; -} - -my $reverse_col = 0; # Flag whether we need to show the reverse column -foreach my $accountline ( @{$accts}) { - $accountline->{amount} += 0.00; - if ($accountline->{amount} <= 0 ) { - $accountline->{amountcredit} = 1; - } - $accountline->{amountoutstanding} += 0.00; - if ( $accountline->{amountoutstanding} <= 0 ) { - $accountline->{amountoutstandingcredit} = 1; - } - - $accountline->{date} = format_date($accountline->{date}); - $accountline->{amount} = sprintf '%.2f', $accountline->{amount}; - $accountline->{amountoutstanding} = sprintf '%.2f', $accountline->{amountoutstanding}; - if ($accountline->{accounttype} =~ /^Pay/) { - $accountline->{payment} = 1; - $reverse_col = 1; - } -} - -$template->param( adultborrower => 1 ) if ( $data->{'category_type'} eq 'A' ); - -my ($picture, $dberror) = GetPatronImage($data->{'borrowernumber'}); -$template->param( picture => 1 ) if $picture; - -if (C4::Context->preference('ExtendedPatronAttributes')) { - my $attributes = GetBorrowerAttributes($borrowernumber); - $template->param( - ExtendedPatronAttributes => 1, - extendedattributes => $attributes - ); -} - -# Computes full borrower address -my $roadtype = C4::Koha::GetAuthorisedValueByCode( 'ROADTYPE', $data->{streettype} ); -my $address = $data->{'streetnumber'} . " $roadtype " . $data->{'address'}; - -$template->param( - finesview => 1, - firstname => $data->{'firstname'}, - surname => $data->{'surname'}, - othernames => $data->{'othernames'}, - borrowernumber => $borrowernumber, - cardnumber => $data->{'cardnumber'}, - categorycode => $data->{'categorycode'}, - category_type => $data->{'category_type'}, - categoryname => $data->{'description'}, - address => $address, - address2 => $data->{'address2'}, - city => $data->{'city'}, - state => $data->{'state'}, - zipcode => $data->{'zipcode'}, - country => $data->{'country'}, - phone => $data->{'phone'}, - phonepro => $data->{'phonepro'}, - mobile => $data->{'mobile'}, - email => $data->{'email'}, - emailpro => $data->{'emailpro'}, - branchcode => $data->{'branchcode'}, - branchname => GetBranchName($data->{'branchcode'}), - total => sprintf("%.2f",$total), - totalcredit => $totalcredit, - is_child => ($data->{'category_type'} eq 'C'), - reverse_col => $reverse_col, - accounts => $accts, - activeBorrowerRelationship => (C4::Context->preference('borrowerRelationship') ne ''), - RoutingSerials => C4::Context->preference('RoutingSerials'), -); - -output_html_with_http_headers $input, $cookie, $template->output; diff --git a/members/mancredit.pl b/members/mancredit.pl deleted file mode 100755 index c8eb619..0000000 --- a/members/mancredit.pl +++ /dev/null @@ -1,126 +0,0 @@ -#!/usr/bin/perl - -#written 11/1/2000 by chris@katipo.oc.nz -#script to display borrowers account details - - -# Copyright 2000-2002 Katipo Communications -# Copyright 2010 BibLibre -# -# 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 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. - -use strict; -use warnings; - -use C4::Auth; -use C4::Output; -use CGI; - -use C4::Members; -use C4::Branch; -use C4::Accounts; -use C4::Items; -use C4::Members::Attributes qw(GetBorrowerAttributes); - -my $input=new CGI; -my $flagsrequired = { borrowers => 1, updatecharges => 1 }; - -my $borrowernumber=$input->param('borrowernumber'); - -#get borrower details -my $data=GetMember('borrowernumber' => $borrowernumber); -my $add=$input->param('add'); - -if ($add){ - if ( checkauth( $input, 0, $flagsrequired, 'intranet' ) ) { - my $barcode = $input->param('barcode'); - my $itemnum; - if ($barcode) { - $itemnum = GetItemnumberFromBarcode($barcode); - } - my $desc = $input->param('desc'); - my $note = $input->param('note'); - my $amount = $input->param('amount') || 0; - $amount = -$amount; - my $type = $input->param('type'); - manualinvoice( $borrowernumber, $itemnum, $desc, $type, $amount, $note ); - print $input->redirect("/cgi-bin/koha/members/boraccount.pl?borrowernumber=$borrowernumber"); - } -} else { - my ($template, $loggedinuser, $cookie) = get_template_and_user( - { - template_name => "members/mancredit.tt", - query => $input, - type => "intranet", - authnotrequired => 0, - flagsrequired => { borrowers => 1, - updatecharges => 'remaining_permissions' }, - debug => 1, - } - ); - - if ( $data->{'category_type'} eq 'C') { - my ( $catcodes, $labels ) = GetborCatFromCatType( 'A', 'WHERE category_type = ?' ); - my $cnt = scalar(@$catcodes); - $template->param( 'CATCODE_MULTI' => 1) if $cnt > 1; - $template->param( 'catcode' => $catcodes->[0]) if $cnt == 1; - } - - $template->param( adultborrower => 1 ) if ( $data->{category_type} eq 'A' ); - my ($picture, $dberror) = GetPatronImage($data->{'borrowernumber'}); - $template->param( picture => 1 ) if $picture; - -if (C4::Context->preference('ExtendedPatronAttributes')) { - my $attributes = GetBorrowerAttributes($borrowernumber); - $template->param( - ExtendedPatronAttributes => 1, - extendedattributes => $attributes - ); -} - -# Computes full borrower address -my $roadtype = C4::Koha::GetAuthorisedValueByCode( 'ROADTYPE', $data->{streettype} ); -my $address = $data->{'streetnumber'} . " $roadtype " . $data->{'address'}; - - $template->param( - finesview => 1, - borrowernumber => $borrowernumber, - firstname => $data->{'firstname'}, - surname => $data->{'surname'}, - othernames => $data->{'othernames'}, - cardnumber => $data->{'cardnumber'}, - categorycode => $data->{'categorycode'}, - category_type => $data->{'category_type'}, - categoryname => $data->{'description'}, - address => $address, - address2 => $data->{'address2'}, - city => $data->{'city'}, - state => $data->{'state'}, - zipcode => $data->{'zipcode'}, - country => $data->{'country'}, - phone => $data->{'phone'}, - phonepro => $data->{'phonepro'}, - mobile => $data->{'mobile'}, - email => $data->{'email'}, - emailpro => $data->{'emailpro'}, - branchcode => $data->{'branchcode'}, - branchname => GetBranchName($data->{'branchcode'}), - is_child => ($data->{'category_type'} eq 'C'), - activeBorrowerRelationship => (C4::Context->preference('borrowerRelationship') ne ''), - RoutingSerials => C4::Context->preference('RoutingSerials'), - ); - output_html_with_http_headers $input, $cookie, $template->output; -} diff --git a/members/maninvoice.pl b/members/maninvoice.pl deleted file mode 100755 index c72b387..0000000 --- a/members/maninvoice.pl +++ /dev/null @@ -1,152 +0,0 @@ -#!/usr/bin/perl - -#written 11/1/2000 by chris@katipo.oc.nz -#script to display borrowers account details - - -# Copyright 2000-2002 Katipo Communications -# Copyright 2010 BibLibre -# -# 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 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. - -use strict; -use warnings; - -use C4::Auth; -use C4::Output; -use CGI; -use C4::Members; -use C4::Accounts; -use C4::Items; -use C4::Branch; -use C4::Members::Attributes qw(GetBorrowerAttributes); - -my $input=new CGI; -my $flagsrequired = { borrowers => 1 }; - -my $borrowernumber=$input->param('borrowernumber'); - - -# get borrower details -my $data=GetMember('borrowernumber'=>$borrowernumber); -my $add=$input->param('add'); -if ($add){ - if ( checkauth( $input, 0, $flagsrequired, 'intranet' ) ) { - # print $input->header; - my $barcode=$input->param('barcode'); - my $itemnum; - if ($barcode) { - $itemnum = GetItemnumberFromBarcode($barcode); - } - my $desc=$input->param('desc'); - my $amount=$input->param('amount'); - my $type=$input->param('type'); - my $note = $input->param('note'); - my $error = manualinvoice( $borrowernumber, $itemnum, $desc, $type, $amount, $note ); - if ($error) { - my ( $template, $loggedinuser, $cookie ) = get_template_and_user( - { template_name => "members/maninvoice.tt", - query => $input, - type => "intranet", - authnotrequired => 0, - flagsrequired => $flagsrequired, - debug => 1, - } - ); - if ( $error =~ /FOREIGN KEY/ && $error =~ /itemnumber/ ) { - $template->param( 'ITEMNUMBER' => 1 ); - } - $template->param( 'ERROR' => $error ); - output_html_with_http_headers $input, $cookie, $template->output; - } else { - print $input->redirect("/cgi-bin/koha/members/boraccount.pl?borrowernumber=$borrowernumber"); - exit; - } - } -} else { - - my ($template, $loggedinuser, $cookie) = get_template_and_user({ - template_name => "members/maninvoice.tt", - query => $input, - type => "intranet", - authnotrequired => 0, - flagsrequired => { borrowers => 1, - updatecharges => 'remaining_permissions' }, - debug => 1, - }); - - # get authorised values with type of MANUAL_INV - my @invoice_types; - my $dbh = C4::Context->dbh; - my $sth = $dbh->prepare('SELECT * FROM authorised_values WHERE category = "MANUAL_INV"'); - $sth->execute(); - while ( my $row = $sth->fetchrow_hashref() ) { - push @invoice_types, $row; - } - $template->param( invoice_types_loop => \@invoice_types ); - - if ( $data->{'category_type'} eq 'C') { - my ( $catcodes, $labels ) = GetborCatFromCatType( 'A', 'WHERE category_type = ?' ); - my $cnt = scalar(@$catcodes); - $template->param( 'CATCODE_MULTI' => 1) if $cnt > 1; - $template->param( 'catcode' => $catcodes->[0]) if $cnt == 1; - } - - $template->param( adultborrower => 1 ) if ( $data->{'category_type'} eq 'A' ); - my ($picture, $dberror) = GetPatronImage($data->{'borrowernumber'}); - $template->param( picture => 1 ) if $picture; - -if (C4::Context->preference('ExtendedPatronAttributes')) { - my $attributes = GetBorrowerAttributes($borrowernumber); - $template->param( - ExtendedPatronAttributes => 1, - extendedattributes => $attributes - ); -} - -# Computes full borrower address -my $roadtype = C4::Koha::GetAuthorisedValueByCode( 'ROADTYPE', $data->{streettype} ); -my $address = $data->{'streetnumber'} . " $roadtype " . $data->{'address'}; - - $template->param( - finesview => 1, - borrowernumber => $borrowernumber, - firstname => $data->{'firstname'}, - surname => $data->{'surname'}, - othernames => $data->{'othernames'}, - cardnumber => $data->{'cardnumber'}, - categorycode => $data->{'categorycode'}, - category_type => $data->{'category_type'}, - categoryname => $data->{'description'}, - address => $address, - address2 => $data->{'address2'}, - city => $data->{'city'}, - state => $data->{'state'}, - zipcode => $data->{'zipcode'}, - country => $data->{'country'}, - phone => $data->{'phone'}, - phonepro => $data->{'phonepro'}, - mobile => $data->{'mobile'}, - email => $data->{'email'}, - emailpro => $data->{'emailpro'}, - branchcode => $data->{'branchcode'}, - branchname => GetBranchName($data->{'branchcode'}), - is_child => ($data->{'category_type'} eq 'C'), - activeBorrowerRelationship => (C4::Context->preference('borrowerRelationship') ne ''), - RoutingSerials => C4::Context->preference('RoutingSerials'), - ); - output_html_with_http_headers $input, $cookie, $template->output; -} diff --git a/members/pay.pl b/members/pay.pl deleted file mode 100755 index a543823..0000000 --- a/members/pay.pl +++ /dev/null @@ -1,267 +0,0 @@ -#!/usr/bin/perl - -# Copyright 2000-2002 Katipo Communications -# Copyright 2010 BibLibre -# Copyright 2010,2011 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 2 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, write to the Free Software Foundation, Inc., -# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - -=head1 pay.pl - - written 11/1/2000 by chris@katipo.oc.nz - part of the koha library system, script to facilitate paying off fines - -=cut - -use strict; -use warnings; - -use URI::Escape; -use C4::Context; -use C4::Auth; -use C4::Output; -use CGI; -use C4::Members; -use C4::Accounts; -use C4::Stats; -use C4::Koha; -use C4::Overdues; -use C4::Branch; -use C4::Members::Attributes qw(GetBorrowerAttributes); - -our $input = CGI->new; - -my $updatecharges_permissions = $input->param('woall') ? 'writeoff' : 'remaining_permissions'; -our ( $template, $loggedinuser, $cookie ) = get_template_and_user( - { template_name => 'members/pay.tt', - query => $input, - type => 'intranet', - authnotrequired => 0, - flagsrequired => { borrowers => 1, updatecharges => $updatecharges_permissions }, - debug => 1, - } -); - -my @names = $input->param; - -our $borrowernumber = $input->param('borrowernumber'); -if ( !$borrowernumber ) { - $borrowernumber = $input->param('borrowernumber0'); -} - -# get borrower details -our $borrower = GetMember( borrowernumber => $borrowernumber ); -our $user = $input->remote_user; -$user ||= q{}; - -my $branches = GetBranches(); -our $branch = GetBranch( $input, $branches ); - -my $writeoff_item = $input->param('confirm_writeoff'); -my $paycollect = $input->param('paycollect'); -if ($paycollect) { - print $input->redirect( - "/cgi-bin/koha/members/paycollect.pl?borrowernumber=$borrowernumber"); -} -my $payselected = $input->param('payselected'); -if ($payselected) { - payselected(@names); -} - -my $writeoff_all = $input->param('woall'); # writeoff all fines -if ($writeoff_all) { - writeoff_all(@names); -} elsif ($writeoff_item) { - my $accountlines_id = $input->param('accountlines_id'); - my $itemno = $input->param('itemnumber'); - my $account_type = $input->param('accounttype'); - my $amount = $input->param('amountoutstanding'); - my $payment_note = $input->param("payment_note"); - WriteOffFee( $borrowernumber, $accountlines_id, $itemno, $account_type, $amount, $branch, $payment_note ); -} - -for (@names) { - if (/^pay_indiv_(\d+)$/) { - my $line_no = $1; - redirect_to_paycollect( 'pay_individual', $line_no ); - } elsif (/^wo_indiv_(\d+)$/) { - my $line_no = $1; - redirect_to_paycollect( 'writeoff_individual', $line_no ); - } -} - -$template->param( - finesview => 1, - activeBorrowerRelationship => (C4::Context->preference('borrowerRelationship') ne ''), - RoutingSerials => C4::Context->preference('RoutingSerials'), -); - -add_accounts_to_template(); - -output_html_with_http_headers $input, $cookie, $template->output; - -sub add_accounts_to_template { - - my ( $total, undef, undef ) = GetMemberAccountRecords($borrowernumber); - my $accounts = []; - my @notify = NumberNotifyId($borrowernumber); - - my $notify_groups = []; - for my $notify_id (@notify) { - my ( $acct_total, $accountlines, undef ) = - GetBorNotifyAcctRecord( $borrowernumber, $notify_id ); - if ( @{$accountlines} ) { - my $totalnotify = AmountNotify( $notify_id, $borrowernumber ); - push @{$accounts}, - { accountlines => $accountlines, - notify => $notify_id, - total => $totalnotify, - }; - } - } - borrower_add_additional_fields($borrower); - $template->param( - accounts => $accounts, - borrower => $borrower, - total => $total, - ); - return; - -} - -sub get_for_redirect { - my ( $name, $name_in, $money ) = @_; - my $s = q{&} . $name . q{=}; - my $value = $input->param($name_in); - if ( !defined $value ) { - $value = ( $money == 1 ) ? 0 : q{}; - } - if ($money) { - $s .= sprintf '%.2f', $value; - } else { - $s .= $value; - } - return $s; -} - -sub redirect_to_paycollect { - my ( $action, $line_no ) = @_; - my $redirect = - "/cgi-bin/koha/members/paycollect.pl?borrowernumber=$borrowernumber"; - $redirect .= q{&}; - $redirect .= "$action=1"; - $redirect .= get_for_redirect( 'accounttype', "accounttype$line_no", 0 ); - $redirect .= get_for_redirect( 'amount', "amount$line_no", 1 ); - $redirect .= - get_for_redirect( 'amountoutstanding', "amountoutstanding$line_no", 1 ); - $redirect .= get_for_redirect( 'accountno', "accountno$line_no", 0 ); - $redirect .= get_for_redirect( 'title', "title$line_no", 0 ); - $redirect .= get_for_redirect( 'itemnumber', "itemnumber$line_no", 0 ); - $redirect .= get_for_redirect( 'notify_id', "notify_id$line_no", 0 ); - $redirect .= get_for_redirect( 'notify_level', "notify_level$line_no", 0 ); - $redirect .= get_for_redirect( 'accountlines_id', "accountlines_id$line_no", 0 ); - $redirect .= q{&} . 'payment_note' . q{=} . uri_escape( $input->param("payment_note_$line_no") ); - $redirect .= '&remote_user='; - $redirect .= $user; - return print $input->redirect($redirect); -} - -sub writeoff_all { - my @params = @_; - my @wo_lines = grep { /^accountno\d+$/ } @params; - for (@wo_lines) { - if (/(\d+)/) { - my $value = $1; - my $accounttype = $input->param("accounttype$value"); - - # my $borrowernum = $input->param("borrowernumber$value"); - my $itemno = $input->param("itemnumber$value"); - my $amount = $input->param("amountoutstanding$value"); - my $accountno = $input->param("accountno$value"); - my $accountlines_id = $input->param("accountlines_id$value"); - my $payment_note = $input->param("payment_note_$value"); - WriteOffFee( $borrowernumber, $accountlines_id, $itemno, $accounttype, $amount, $branch, $payment_note ); - } - } - - $borrowernumber = $input->param('borrowernumber'); - print $input->redirect( - "/cgi-bin/koha/members/boraccount.pl?borrowernumber=$borrowernumber"); - return; -} - -sub borrower_add_additional_fields { - my $b_ref = shift; - -# some borrower info is not returned in the standard call despite being assumed -# in a number of templates. It should not be the business of this script but in lieu of -# a revised api here it is ... - if ( $b_ref->{category_type} eq 'C' ) { - my ( $catcodes, $labels ) = - GetborCatFromCatType( 'A', 'WHERE category_type = ?' ); - if ( @{$catcodes} ) { - if ( @{$catcodes} > 1 ) { - $b_ref->{CATCODE_MULTI} = 1; - } elsif ( @{$catcodes} == 1 ) { - $b_ref->{catcode} = $catcodes->[0]; - } - } - } elsif ( $b_ref->{category_type} eq 'A' ) { - $b_ref->{adultborrower} = 1; - } - my ( $picture, $dberror ) = GetPatronImage( $b_ref->{borrowernumber} ); - if ($picture) { - $b_ref->{has_picture} = 1; - } - - # Computes full borrower address - my $roadtype = C4::Koha::GetAuthorisedValueByCode( 'ROADTYPE', $borrower->{streettype} ); - $b_ref->{address} = $borrower->{'streetnumber'} . " $roadtype " . $borrower->{'address'}; - - if (C4::Context->preference('ExtendedPatronAttributes')) { - $b_ref->{extendedattributes} = GetBorrowerAttributes($borrowernumber); - $template->param( - ExtendedPatronAttributes => 1, - ); - } - - $b_ref->{branchname} = GetBranchName( $b_ref->{branchcode} ); - return; -} - -sub payselected { - my @params = @_; - my $amt = 0; - my @lines_to_pay; - foreach (@params) { - if (/^incl_par_(\d+)$/) { - my $index = $1; - push @lines_to_pay, $input->param("accountno$index"); - $amt += $input->param("amountoutstanding$index"); - } - } - $amt = '&amt=' . $amt; - my $sel = '&selected=' . join ',', @lines_to_pay; - my $notes = '¬es=' . join("%0A", map { $input->param("payment_note_$_") } @lines_to_pay ); - my $redirect = - "/cgi-bin/koha/members/paycollect.pl?borrowernumber=$borrowernumber" - . $amt - . $sel - . $notes; - - print $input->redirect($redirect); - return; -} diff --git a/members/paycollect.pl b/members/paycollect.pl deleted file mode 100755 index 01536b0..0000000 --- a/members/paycollect.pl +++ /dev/null @@ -1,192 +0,0 @@ -#!/usr/bin/perl -# Copyright 2009,2010 PTFS Inc. -# Copyright 2011 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 2 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, write to the Free Software Foundation, Inc., -# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - -use strict; -use warnings; -use URI::Escape; -use C4::Context; -use C4::Auth; -use C4::Output; -use CGI; -use C4::Members; -use C4::Members::Attributes qw(GetBorrowerAttributes); -use C4::Accounts; -use C4::Koha; -use C4::Branch; - -my $input = CGI->new(); - -my $updatecharges_permissions = $input->param('writeoff_individual') ? 'writeoff' : 'remaining_permissions'; -my ( $template, $loggedinuser, $cookie ) = get_template_and_user( - { template_name => 'members/paycollect.tt', - query => $input, - type => 'intranet', - authnotrequired => 0, - flagsrequired => { borrowers => 1, updatecharges => $updatecharges_permissions }, - debug => 1, - } -); - -# get borrower details -my $borrowernumber = $input->param('borrowernumber'); -my $borrower = GetMember( borrowernumber => $borrowernumber ); -my $user = $input->remote_user; - -# get account details -my $branch = GetBranch( $input, GetBranches() ); - -my ( $total_due, $accts, $numaccts ) = GetMemberAccountRecords($borrowernumber); -my $total_paid = $input->param('paid'); - -my $individual = $input->param('pay_individual'); -my $writeoff = $input->param('writeoff_individual'); -my $select_lines = $input->param('selected'); -my $select = $input->param('selected_accts'); -my $payment_note = uri_unescape $input->param('payment_note'); -my $accountno; -my $accountlines_id; -if ( $individual || $writeoff ) { - if ($individual) { - $template->param( pay_individual => 1 ); - } elsif ($writeoff) { - $template->param( writeoff_individual => 1 ); - } - my $accounttype = $input->param('accounttype'); - $accountlines_id = $input->param('accountlines_id'); - my $amount = $input->param('amount'); - my $amountoutstanding = $input->param('amountoutstanding'); - $accountno = $input->param('accountno'); - my $itemnumber = $input->param('itemnumber'); - my $description = $input->param('description'); - my $title = $input->param('title'); - my $notify_id = $input->param('notify_id'); - my $notify_level = $input->param('notify_level'); - $total_due = $amountoutstanding; - $template->param( - accounttype => $accounttype, - accountlines_id => $accountlines_id, - accountno => $accountno, - amount => $amount, - amountoutstanding => $amountoutstanding, - title => $title, - itemnumber => $itemnumber, - description => $description, - notify_id => $notify_id, - notify_level => $notify_level, - payment_note => $payment_note, - ); -} elsif ($select_lines) { - $total_due = $input->param('amt'); - $template->param( - selected_accts => $select_lines, - amt => $total_due, - selected_accts_notes => $input->param('notes'), - ); -} - -if ( $total_paid and $total_paid ne '0.00' ) { - if ( $total_paid < 0 or $total_paid > $total_due ) { - $template->param( - error_over => 1, - total_due => $total_due - ); - } else { - if ($individual) { - if ( $total_paid == $total_due ) { - makepayment( $accountlines_id, $borrowernumber, $accountno, $total_paid, $user, - $branch, $payment_note ); - } else { - makepartialpayment( $accountlines_id, $borrowernumber, $accountno, $total_paid, - $user, $branch, $payment_note ); - } - print $input->redirect( - "/cgi-bin/koha/members/pay.pl?borrowernumber=$borrowernumber"); - } else { - if ($select) { - if ( $select =~ /^([\d,]*).*/ ) { - $select = $1; # ensure passing no junk - } - my @acc = split /,/, $select; - my $note = $input->param('selected_accts_notes'); - recordpayment_selectaccts( $borrowernumber, $total_paid, \@acc, $note ); - } else { - recordpayment( $borrowernumber, $total_paid ); - } - -# recordpayment does not return success or failure so lets redisplay the boraccount - - print $input->redirect( -"/cgi-bin/koha/members/boraccount.pl?borrowernumber=$borrowernumber" - ); - } - } -} else { - $total_paid = '0.00'; #TODO not right with pay_individual -} - -borrower_add_additional_fields($borrower); - -$template->param( - borrowernumber => $borrowernumber, # some templates require global - borrower => $borrower, - total => $total_due, - activeBorrowerRelationship => (C4::Context->preference('borrowerRelationship') ne ''), - RoutingSerials => C4::Context->preference('RoutingSerials'), -); - -output_html_with_http_headers $input, $cookie, $template->output; - -sub borrower_add_additional_fields { - my $b_ref = shift; - -# some borrower info is not returned in the standard call despite being assumed -# in a number of templates. It should not be the business of this script but in lieu of -# a revised api here it is ... - if ( $b_ref->{category_type} eq 'C' ) { - my ( $catcodes, $labels ) = - GetborCatFromCatType( 'A', 'WHERE category_type = ?' ); - if ( @{$catcodes} ) { - if ( @{$catcodes} > 1 ) { - $b_ref->{CATCODE_MULTI} = 1; - } elsif ( @{$catcodes} == 1 ) { - $b_ref->{catcode} = $catcodes->[0]; - } - } - } elsif ( $b_ref->{category_type} eq 'A' ) { - $b_ref->{adultborrower} = 1; - } - my ( $picture, $dberror ) = GetPatronImage( $b_ref->{borrowernumber} ); - if ($picture) { - $b_ref->{has_picture} = 1; - } - - if (C4::Context->preference('ExtendedPatronAttributes')) { - $b_ref->{extendedattributes} = GetBorrowerAttributes($borrowernumber); - $template->param( - ExtendedPatronAttributes => 1, - ); - } - - # Computes full borrower address - my $roadtype = C4::Koha::GetAuthorisedValueByCode( 'ROADTYPE', $borrower->{streettype} ); - $b_ref->{address} = $borrower->{'streetnumber'} . " $roadtype " . $borrower->{'address'}; - - $b_ref->{branchname} = GetBranchName( $b_ref->{branchcode} ); - return; -} diff --git a/members/printfeercpt.pl b/members/printfeercpt.pl deleted file mode 100755 index cf14264..0000000 --- a/members/printfeercpt.pl +++ /dev/null @@ -1,143 +0,0 @@ -#!/usr/bin/perl - - -#writen 3rd May 2010 by kmkale@anantcorp.com adapted from boraccount.pl by chris@katipo.oc.nz -#script to print fee receipts - - -# Copyright Koustubha Kale -# -# 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 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. - -use strict; -use warnings; - -use C4::Auth; -use C4::Output; -use C4::Dates qw/format_date/; -use CGI; -use C4::Members; -use C4::Branch; -use C4::Accounts; - -my $input=new CGI; - - -my ($template, $loggedinuser, $cookie) - = get_template_and_user({template_name => "members/printfeercpt.tt", - query => $input, - type => "intranet", - authnotrequired => 0, - flagsrequired => {borrowers => 1, updatecharges => 'remaining_permissions'}, - debug => 1, - }); - -my $borrowernumber=$input->param('borrowernumber'); -my $action = $input->param('action') || ''; -my $accountlines_id = $input->param('accountlines_id'); - -#get borrower details -my $data=GetMember('borrowernumber' => $borrowernumber); - -if ( $action eq 'print' ) { -# ReversePayment( $borrowernumber, $input->param('accountno') ); -} - -if ( $data->{'category_type'} eq 'C') { - my ( $catcodes, $labels ) = GetborCatFromCatType( 'A', 'WHERE category_type = ?' ); - my $cnt = scalar(@$catcodes); - $template->param( 'CATCODE_MULTI' => 1) if $cnt > 1; - $template->param( 'catcode' => $catcodes->[0]) if $cnt == 1; -} - -#get account details -my ($total,$accts,$numaccts)=GetMemberAccountRecords($borrowernumber); -my $totalcredit; -if($total <= 0){ - $totalcredit = 1; -} -my @accountrows; # this is for the tmpl-loop - -my $toggle; -for (my $i=0;$i<$numaccts;$i++){ - next if ( $accts->[$i]{'accountlines_id'} ne $accountlines_id ); - if($i%2){ - $toggle = 0; - } else { - $toggle = 1; - } - $accts->[$i]{'toggle'} = $toggle; - $accts->[$i]{'amount'}+=0.00; - if($accts->[$i]{'amount'} <= 0){ - $accts->[$i]{'amountcredit'} = 1; - $accts->[$i]{'amount'}*=-1.00; - } - $accts->[$i]{'amountoutstanding'}+=0.00; - if($accts->[$i]{'amountoutstanding'} <= 0){ - $accts->[$i]{'amountoutstandingcredit'} = 1; - } - my %row = ( 'date' => format_date($accts->[$i]{'date'}), - 'amountcredit' => $accts->[$i]{'amountcredit'}, - 'amountoutstandingcredit' => $accts->[$i]{'amountoutstandingcredit'}, - 'toggle' => $accts->[$i]{'toggle'}, - 'description' => $accts->[$i]{'description'}, - 'itemnumber' => $accts->[$i]{'itemnumber'}, - 'biblionumber' => $accts->[$i]{'biblionumber'}, - 'amount' => sprintf("%.2f",$accts->[$i]{'amount'}), - 'amountoutstanding' => sprintf("%.2f",$accts->[$i]{'amountoutstanding'}), - 'accountno' => $accts->[$i]{'accountno'}, - 'payment' => ( $accts->[$i]{'accounttype'} =~ /^Pay/ ), - - ); - - if ($accts->[$i]{'accounttype'} ne 'F' && $accts->[$i]{'accounttype'} ne 'FU'){ - $row{'printtitle'}=1; - $row{'title'} = $accts->[$i]{'title'}; - } - - push(@accountrows, \%row); -} - -$template->param( adultborrower => 1 ) if ( $data->{'category_type'} eq 'A' ); - -my ($picture, $dberror) = GetPatronImage($data->{'borrowernumber'}); -$template->param( picture => 1 ) if $picture; - -$template->param( - finesview => 1, - firstname => $data->{'firstname'}, - surname => $data->{'surname'}, - borrowernumber => $borrowernumber, - cardnumber => $data->{'cardnumber'}, - categorycode => $data->{'categorycode'}, - category_type => $data->{'category_type'}, - # category_description => $data->{'description'}, - categoryname => $data->{'description'}, - address => $data->{'address'}, - address2 => $data->{'address2'}, - city => $data->{'city'}, - zipcode => $data->{'zipcode'}, - country => $data->{'country'}, - phone => $data->{'phone'}, - email => $data->{'email'}, - branchcode => $data->{'branchcode'}, - branchname => GetBranchName($data->{'branchcode'}), - total => sprintf("%.2f",$total), - totalcredit => $totalcredit, - is_child => ($data->{'category_type'} eq 'C'), - accounts => \@accountrows ); - -output_html_with_http_headers $input, $cookie, $template->output; diff --git a/members/printinvoice.pl b/members/printinvoice.pl deleted file mode 100755 index 58eb7b2..0000000 --- a/members/printinvoice.pl +++ /dev/null @@ -1,142 +0,0 @@ -#!/usr/bin/perl - -#writen 3rd May 2010 by kmkale@anantcorp.com adapted from boraccount.pl by chris@katipo.oc.nz -#script to print fee receipts - -# Copyright Koustubha Kale -# -# 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 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. - -use strict; -use warnings; - -use C4::Auth; -use C4::Output; -use C4::Dates qw/format_date/; -use CGI; -use C4::Members; -use C4::Branch; -use C4::Accounts; - -my $input = new CGI; - -my ( $template, $loggedinuser, $cookie ) = get_template_and_user( - { template_name => "members/printinvoice.tt", - query => $input, - type => "intranet", - authnotrequired => 0, - flagsrequired => { borrowers => 1, updatecharges => 'remaining_permissions' }, - debug => 1, - } -); - -my $borrowernumber = $input->param('borrowernumber'); -my $action = $input->param('action') || ''; -my $accountlines_id = $input->param('accountlines_id'); - -#get borrower details -my $data = GetMember( 'borrowernumber' => $borrowernumber ); - -if ( $data->{'category_type'} eq 'C' ) { - my ( $catcodes, $labels ) = GetborCatFromCatType( 'A', 'WHERE category_type = ?' ); - my $cnt = scalar(@$catcodes); - $template->param( 'CATCODE_MULTI' => 1 ) if $cnt > 1; - $template->param( 'catcode' => $catcodes->[0] ) if $cnt == 1; -} - -#get account details -my ( $total, $accts, $numaccts ) = GetMemberAccountRecords($borrowernumber); -my $totalcredit; -if ( $total <= 0 ) { - $totalcredit = 1; -} - -my @accountrows; # this is for the tmpl-loop - -my $toggle; -for ( my $i = 0 ; $i < $numaccts ; $i++ ) { - next if ( $accts->[$i]{'accountlines_id'} ne $accountlines_id ); - - if ( $i % 2 ) { - $toggle = 0; - } else { - $toggle = 1; - } - - $accts->[$i]{'toggle'} = $toggle; - $accts->[$i]{'amount'} += 0.00; - - if ( $accts->[$i]{'amount'} <= 0 ) { - $accts->[$i]{'amountcredit'} = 1; - } - - $accts->[$i]{'amountoutstanding'} += 0.00; - if ( $accts->[$i]{'amountoutstanding'} <= 0 ) { - $accts->[$i]{'amountoutstandingcredit'} = 1; - } - - my %row = ( - 'date' => format_date( $accts->[$i]{'date'} ), - 'amountcredit' => $accts->[$i]{'amountcredit'}, - 'amountoutstandingcredit' => $accts->[$i]{'amountoutstandingcredit'}, - 'toggle' => $accts->[$i]{'toggle'}, - 'description' => $accts->[$i]{'description'}, - 'itemnumber' => $accts->[$i]{'itemnumber'}, - 'biblionumber' => $accts->[$i]{'biblionumber'}, - 'amount' => sprintf( "%.2f", $accts->[$i]{'amount'} ), - 'amountoutstanding' => sprintf( "%.2f", $accts->[$i]{'amountoutstanding'} ), - 'accountno' => $accts->[$i]{'accountno'}, - 'payment' => ( $accts->[$i]{'accounttype'} =~ /^Pay/ ), - ); - - if ( $accts->[$i]{'accounttype'} ne 'F' && $accts->[$i]{'accounttype'} ne 'FU' ) { - $row{'printtitle'} = 1; - $row{'title'} = $accts->[$i]{'title'}; - } - - push( @accountrows, \%row ); -} - -$template->param( adultborrower => 1 ) if ( $data->{'category_type'} eq 'A' ); - -my ( $picture, $dberror ) = GetPatronImage( $data->{'borrowernumber'} ); -$template->param( picture => 1 ) if $picture; - -$template->param( - finesview => 1, - firstname => $data->{'firstname'}, - surname => $data->{'surname'}, - borrowernumber => $borrowernumber, - cardnumber => $data->{'cardnumber'}, - categorycode => $data->{'categorycode'}, - category_type => $data->{'category_type'}, - categoryname => $data->{'description'}, - address => $data->{'address'}, - address2 => $data->{'address2'}, - city => $data->{'city'}, - zipcode => $data->{'zipcode'}, - country => $data->{'country'}, - phone => $data->{'phone'}, - email => $data->{'email'}, - branchcode => $data->{'branchcode'}, - branchname => GetBranchName( $data->{'branchcode'} ), - total => sprintf( "%.2f", $total ), - totalcredit => $totalcredit, - is_child => ( $data->{'category_type'} eq 'C' ), - accounts => \@accountrows -); - -output_html_with_http_headers $input, $cookie, $template->output; diff --git a/misc/maintenance/fix_accountlines_date.pl b/misc/maintenance/fix_accountlines_date.pl deleted file mode 100755 index 2956f57..0000000 --- a/misc/maintenance/fix_accountlines_date.pl +++ /dev/null @@ -1,171 +0,0 @@ -#!/usr/bin/perl -# -# Copyright (C) 2008 LibLime -# -# 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 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. - -use strict; -use warnings; -BEGIN { - # find Koha's Perl modules - # test carefully before changing this - use FindBin; - eval { require "$FindBin::Bin/../kohalib.pl" }; -} - -use C4::Context; -use C4::Dates; -use Getopt::Long; -use Pod::Usage; - -=head1 NAME - -fix_accountlines_date.pl - Fix date code in the description of fines - -=head1 SYNOPSIS - -fix_accountlines_date.pl -m date_format [ -n fines_to_process ] [ -d ] [ --help or -h ] - - Options: - --help or -h Brief usage message - --man Full documentation - -n fines_to_process How many fines to process; if left off will - process all - -m date_format What format the dates are currently in; 'us' - or 'metric' (REQUIRED) - -d Run in debugging mode - -=head1 DESCRIPTION - -This script fixes the date code in the description of fines. Previously, the -format of this was determined by which script you were using to update fines (see the -m option) - -=over 8 - -=item B<--help> - -Prints a brief usage message and exits. - -=item B<--man> - -Prints a full manual page and exits. - -=item B<-n> - -Process only a certain amount of fines. If this option is left off, this script -will process everything. - -=item B<-m> - -This required option tells the script what format your dates are currently in. -If you were previously using the fines2.pl or fines-sanop.pl script to update -your fines, they will be in 'metric' format. If you were using the fines-ll.pl -script, they will be in 'us' format. After this script is finished, they will -be in whatever format your 'dateformat' system preference specifies. - -=item B<-d> - -Run in debugging mode; this prints out a lot of information and should be used -only if there is a problem and with the '-n' option. - -=back - -=cut - -my $mode = ''; -my $want_help = 0; -my $limit = -1; -my $done = 0; -my $DEBUG = 0; - -# Regexes for the two date formats -our $US_DATE = '((0\d|1[0-2])\/([0-2]\d|3[01])\/(\d{4}))'; -our $METRIC_DATE = '(([0-2]\d|3[01])\/(0\d|1[0-2])\/(\d{4}))'; - -sub print_usage { - print <<_USAGE_ -$0: Fix the date code in the description of fines - -Due to the multiple scripts used to update fines in earlier versions of Koha, -this script should be used to change the format of the date codes in the -accountlines table before you start using Koha 3.0. - -Parameters: - --mode or -m This should be 'us' or 'metric', and tells the script - what format your old dates are in. - --debug or -d Run this script in debug mode. - --limit or -n How many accountlines rows to fix; useful for testing. - --help or -h Print out this help message. -_USAGE_ -} - -my $result = GetOptions( - 'm=s' => \$mode, - 'd' => \$DEBUG, - 'n=i' => \$limit, - 'help|h' => \$want_help, -); - -if (not $result or $want_help or ($mode ne 'us' and $mode ne 'metric')) { - print_usage(); - exit 0; -} - -our $dbh = C4::Context->dbh; -$dbh->{AutoCommit} = 0; -my $sth = $dbh->prepare(" -SELECT borrowernumber, itemnumber, accountno, description - FROM accountlines - WHERE accounttype in ('FU', 'F', 'O', 'M') -;"); -$sth->execute(); - -my $update_sth = $dbh->prepare(' -UPDATE accountlines - SET description = ? - WHERE borrowernumber = ? AND itemnumber = ? AND accountno = ? -;'); - - -while (my $accountline = $sth->fetchrow_hashref) { - my $description = $accountline->{'description'}; - my $updated = 0; - - if ($mode eq 'us') { - if ($description =~ /$US_DATE/) { # mm/dd/yyyy - my $date = C4::Dates->new($1, 'us'); - print "Converting $1 (us) to " . $date->output() . "\n" if $DEBUG; - $description =~ s/$US_DATE/$date->output()/; - $updated = 1; - } - } elsif ($mode eq 'metric') { - if ($description =~ /$METRIC_DATE/) { # dd/mm/yyyy - my $date = C4::Dates->new($1, 'metric'); - print "Converting $1 (metric) to " . $date->output() . "\n" if $DEBUG; - $description =~ s/$METRIC_DATE/$date->output()/; - $updated = 2; - } - } - - print "Changing description from '" . $accountline->{'description'} . "' to '" . $description . "'\n" if $DEBUG; - $update_sth->execute($description, $accountline->{'borrowernumber'}, $accountline->{'itemnumber'}, $accountline->{'accountno'}); - - $done++; - - last if ($done == $limit); # $done can't be -1, so this works -} - -$dbh->commit(); diff --git a/reports/stats.print.pl b/reports/stats.print.pl deleted file mode 100755 index 066aafa..0000000 --- a/reports/stats.print.pl +++ /dev/null @@ -1,178 +0,0 @@ -#!/usr/bin/perl - -use strict; -#use warnings; FIXME - Bug 2505 -use CGI; -use C4::Output; - -use C4::Auth; -use C4::Context; -use Date::Manip; -use C4::Stats; -use Text::CSV_XS; -&Date_Init("DateFormat=non-US"); # set non-USA date, eg:19/08/2005 - -my $csv = Text::CSV_XS->new( - { - 'quote_char' => '"', - 'escape_char' => '"', - 'sep_char' => ',', - 'binary' => 1 - } -); - -my $input=new CGI; -my $time=$input->param('time'); -my $time2=$input->param('time2'); - -my @loop1; -my @loop2; -my $date; -my $date2; -if ($time eq 'yesterday'){ - $date=ParseDate('yesterday'); - $date2=ParseDate('today'); -} -if ($time eq 'today'){ - $date=ParseDate('today'); - $date2=ParseDate('tomorrow'); -} -if ($time eq 'daybefore'){ - $date=ParseDate('2 days ago'); - $date2=ParseDate('yesterday'); -} -if ($time eq 'month') { - $date = ParseDate('1 month ago'); - $date2 = ParseDate('today'); - -} -if ($time=~ /\//){ - $date=ParseDate($time); - $date2=ParseDateDelta('+ 1 day'); - $date2=DateCalc($date,$date2); -} - -if ($time eq ''){ - $date=ParseDate('today'); - $date2=ParseDate('tomorrow'); -} - -if ($time2 ne ''){ - $date=ParseDate($time); - $date2=ParseDate($time2); -} - -my $date=UnixDate($date,'%Y-%m-%d'); -my $date2=UnixDate($date2,'%Y-%m-%d'); - -#warn "MASON: DATE: $date, $date2"; - -#get a list of every payment -my @payments=TotalPaid($date,$date2); - -my $count=@payments; -# print "MASON: number of payments=$count\n"; - -my $i=0; -my $totalcharges=0; -my $totalcredits=0; -my $totalpaid=0; -my $totalwritten=0; - -# lets get a a list of all individual item charges paid for by that payment -while ($i<$count ){ - - my $count; - my @charges; - - if ($payments[$i]{'type'} ne 'writeoff'){ # lets ignore writeoff payments!. - @charges=getcharges($payments[$i]{'borrowernumber'}, $payments[$i]{'timestamp'}, $payments[$i]{'proccode'}); - $totalcharges++; - $count=@charges; - - # getting each of the charges and putting them into a array to be printed out - #this loops per charge per person - for (my $i2=0;$i2<$count;$i2++){ - - my $hour=substr($payments[$i]{'timestamp'},8,2); - my $min=substr($payments[$i]{'timestamp'},10,2); - my $sec=substr($payments[$i]{'timestamp'},12,2); - my $time="$hour:$min:$sec"; - my $time2="$payments[$i]{'date'}"; -# my $branch=Getpaidbranch($time2,$payments[$i]{'borrowernumber'}); - my $branch=$payments[$i]{'branch'}; - - my @rows1 = ($branch, # lets build up a row - $payments[$i]->{'datetime'}, - $payments[$i]->{'surname'}, - $payments[$i]->{'firstname'}, - $charges[$i2]->{'description'}, - $charges[$i2]->{'accounttype'}, - # rounding amounts to 2dp and adding dollar sign to make excel read it as currency format - "\$".sprintf("%.2f", $charges[$i2]->{'amount'}), - $payments[$i]->{'type'}, - "\$".$payments[$i]->{'value'}); - - push (@loop1, \@rows1); - $totalpaid = $totalpaid + $payments[$i]->{'value'}; - } - } else { - ++$totalwritten; - } - - $i++; #increment the while loop -} - -#get credits and append to the bottom of payments -my @credits=getcredits($date,$date2); - -my $count=@credits; -my $i=0; - -while ($i<$count ){ - - my @rows2 = ($credits[$i]->{'branchcode'}, - $credits[$i]->{'date'}, - $credits[$i]->{'surname'}, - $credits[$i]->{'firstname'}, - $credits[$i]->{'description'}, - $credits[$i]->{'accounttype'}, - "\$".$credits[$i]->{'amount'}); - - push (@loop2, \@rows2); - $totalcredits = $totalcredits + $credits[$i]->{'amount'}; - $i++; -} - -#takes off first char minus sign "-100.00" -$totalcredits = substr($totalcredits, 1); - -print $input->header( - -type => 'application/vnd.ms-excel', - -attachment => "stats.csv", -); -print "Branch, Datetime, Surname, Firstnames, Description, Type, Invoice amount, Payment type, Payment Amount\n"; - - -for my $row ( @loop1 ) { - - $csv->combine(@$row); - my $string = $csv->string; - print $string, "\n"; -} - -print ",,,,,,,\n"; - -for my $row ( @loop2 ) { - - $csv->combine(@$row); - my $string = $csv->string; - print $string, "\n"; -} - -print ",,,,,,,\n"; -print ",,,,,,,\n"; -print ",,Total Amount Paid, $totalpaid\n"; -print ",,Total Number Written, $totalwritten\n"; -print ",,Total Amount Credits, $totalcredits\n"; - diff --git a/reports/stats.screen.pl b/reports/stats.screen.pl deleted file mode 100755 index 0eef8d1..0000000 --- a/reports/stats.screen.pl +++ /dev/null @@ -1,265 +0,0 @@ -#!/usr/bin/perl - -# Copyright Katipo Communications 2006 -# -# 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 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. - - -use strict; -#use warnings; FIXME - Bug 2505 -use CGI; -use C4::Output; -use C4::Auth; -use C4::Context; -use C4::Stats; -use C4::Accounts; -use C4::Debug; -use Date::Manip; - -my $input = new CGI; -my $time = $input->param('time'); -my $time2 = $input->param('time2'); -my $op = $input->param('submit'); - -my ( $template, $loggedinuser, $cookie ) = get_template_and_user( - { - template_name => "reports/stats_screen.tt", - query => $input, - type => "intranet", - flagsrequired => { reports => '*' }, - } -); - -( $time = "today" ) if !$time; -( $time2 = "tomorrow" ) if !$time2; - -my $date = ParseDate($time); -my $date2 = ParseDate($time2); -$date = UnixDate( $date, '%Y-%m-%d' ); -$date2 = UnixDate( $date2, '%Y-%m-%d' ); -$debug and warn "MASON: TIME: $time, $time2"; -$debug and warn "MASON: DATE: $date, $date2"; - -# get a list of every payment -my @payments = TotalPaid( $date, $date2 ); - -my $count = @payments; - -$debug and warn "MASON: number of payments=$count\n"; - -my $i = 0; -my $totalcharges = 0; -my $totalcredits = 0; -my $totalpaid = 0; -my $totalwritten = 0; -my @loop1; -my @loop2; - -# lets get a a list of all individual item charges paid for by that payment - -foreach my $payment (@payments) { - - my @charges; - if ( $payment->{'type'} ne 'writeoff' ) { - - @charges = getcharges( - $payment->{'borrowernumber'}, - $payment->{'timestamp'}, - $payment->{'proccode'} - ); - $totalcharges++; - my $count = @charges; - - # getting each of the charges and putting them into a array to be printed out - #this loops per charge per person - for ( my $i2 = 0 ; $i2 < $count ; $i2++ ) { - my $hour = substr( $payment->{'timestamp'}, 8, 2 ); - my $min = substr( $payment->{'timestamp'}, 10, 2 ); - my $sec = substr( $payment->{'timestamp'}, 12, 2 ); - my $time = "$hour:$min:$sec"; - my $time2 = "$payment->{'date'}"; - - # my $branch=Getpaidbranch($time2,$payment->{'borrowernumber'}); - my $branch = $payment->{'branch'}; - - # lets build up a row - my %rows1 = ( - branch => $branch, - datetime => $payment->{'datetime'}, - surname => $payment->{'surname'}, - firstname => $payment->{'firstname'}, - description => $charges[$i2]->{'description'}, - accounttype => $charges[$i2]->{'accounttype'}, - amount => sprintf( "%.2f", $charges[$i2]->{'amount'} ) - , # rounding amounts to 2dp - type => $payment->{'type'}, - value => sprintf( "%.2f", $payment->{'value'} ) - ); # rounding amounts to 2dp - - push( @loop1, \%rows1 ); - - } - $totalpaid = $totalpaid + $payment->{'value'}; - $debug and warn "totalpaid = $totalpaid"; - } - else { - ++$totalwritten; - } - -} - -#get credits and append to the bottom of payments -my @credits = getcredits( $date, $date2 ); - -my $count = @credits; -my $i = 0; - -while ( $i < $count ) { - - my %rows2 = ( - creditbranch => $credits[$i]->{'branchcode'}, - creditdate => $credits[$i]->{'date'}, - creditsurname => $credits[$i]->{'surname'}, - creditfirstname => $credits[$i]->{'firstname'}, - creditdescription => $credits[$i]->{'description'}, - creditaccounttype => $credits[$i]->{'accounttype'}, - creditamount => sprintf( "%.2f", $credits[$i]->{'amount'} ) - ); - - push( @loop2, \%rows2 ); - $totalcredits = $totalcredits + $credits[$i]->{'amount'}; - $i++; #increment the while loop -} - -#takes off first char minus sign "-100.00" -$totalcredits = substr( $totalcredits, 1 ); - -my $totalrefunds = 0; -my @loop3; -my @refunds = getrefunds( $date, $date2 ); -$count = @refunds; -$i = 0; - -while ( $i < $count ) { - - my %rows3 = ( - refundbranch => $refunds[$i]->{'branchcode'}, - refunddate => $refunds[$i]->{'datetime'}, - refundsurname => $refunds[$i]->{'surname'}, - refundfirstname => $refunds[$i]->{'firstname'}, - refunddescription => $refunds[$i]->{'description'}, - refundaccounttype => $refunds[$i]->{'accounttype'}, - refundamount => sprintf( "%.2f", $refunds[$i]->{'amount'} ) - ); - - push( @loop3, \%rows3 ); - $totalrefunds = $totalrefunds + $refunds[$i]->{'amount'}; - $i++; #increment the while loop -} - -my $totalcash = $totalpaid - $totalrefunds; - -if ( $op eq 'To Excel' ) { - - my $csv = Text::CSV_XS->new( - { - 'quote_char' => '"', - 'escape_char' => '"', - 'sep_char' => ',', - 'binary' => 1 - } - ); - - print $input->header( - -type => 'application/vnd.ms-excel', - -attachment => "stats.csv", - ); - print -"Branch, Datetime, Surname, Firstnames, Description, Type, Invoice amount, Payment type, Payment Amount\n"; - - $DB::single = 1; - - for my $row (@loop1) { - my @array = ( - $row->{'branch'}, $row->{'datetime'}, - $row->{'surname'}, $row->{'firstname'}, - $row->{'description'}, $row->{'accounttype'}, - $row->{'amount'}, $row->{'type'}, - $row->{'value'} - ); - - $csv->combine(@array); - my $string = $csv->string(@array); - print $string, "\n"; - } - print ",,,,,,,\n"; - print -"Branch, Date/time, Surname, Firstname, Description, Charge Type, Invoice Amount\n"; - - for my $row (@loop2) { - - my @array = ( - $row->{'creditbranch'}, $row->{'creditdate'}, - $row->{'creditsurname'}, $row->{'creditfirstname'}, - $row->{'creditdescription'}, $row->{'creditaccounttype'}, - $row->{'creditamount'} - ); - - $csv->combine(@array); - my $string = $csv->string(@array); - print $string, "\n"; - } - print ",,,,,,,\n"; - print -"Branch, Date/time, Surname, Firstname, Description, Charge Type, Invoice Amount\n"; - - for my $row (@loop3) { - my @array = ( - $row->{'refundbranch'}, $row->{'refunddate'}, - $row->{'refundsurname'}, $row->{'refundfirstname'}, - $row->{'refunddescription'}, $row->{'refundaccounttype'}, - $row->{'refundamount'} - ); - - $csv->combine(@array); - my $string = $csv->string(@array); - print $string, "\n"; - - } - - print ",,,,,,,\n"; - print ",,,,,,,\n"; - print ",,Total Amount Paid, $totalpaid\n"; - print ",,Total Number Written, $totalwritten\n"; - print ",,Total Amount Credits, $totalcredits\n"; - print ",,Total Amount Refunds, $totalrefunds\n"; -} -else { - $template->param( - date => $time, - date2 => $time2, - loop1 => \@loop1, - loop2 => \@loop2, - loop3 => \@loop3, - totalpaid => $totalpaid, - totalcredits => $totalcredits, - totalwritten => $totalwritten, - totalrefund => $totalrefunds, - totalcash => $totalcash, - ); - output_html_with_http_headers $input, $cookie, $template->output; -} - -- 1.7.2.5