From 0d7b552dec8fe611c70045db841317382b67e674 Mon Sep 17 00:00:00 2001 From: kados Date: Fri, 9 Mar 2007 23:30:17 +0000 Subject: [PATCH] move Accounts2.pm to Accounts.pm --- C4/{Accounts2.pm => Accounts.pm} | 73 ++++++++++++++++---------------- C4/Amazon.pm | 1 + C4/Circulation/Circ2.pm | 2 +- C4/Circulation/Fines.pm | 2 +- C4/Circulation/Returns.pm | 2 +- C4/Date.pm | 18 ++++++-- members/mancredit.pl | 2 +- members/maninvoice.pl | 2 +- members/pay.pl | 2 +- misc/tidyaccounts.pl | 2 +- 10 files changed, 59 insertions(+), 47 deletions(-) rename C4/{Accounts2.pm => Accounts.pm} (93%) diff --git a/C4/Accounts2.pm b/C4/Accounts.pm similarity index 93% rename from C4/Accounts2.pm rename to C4/Accounts.pm index 94255cae2e..6930e5ac6c 100755 --- a/C4/Accounts2.pm +++ b/C4/Accounts.pm @@ -1,5 +1,4 @@ -package C4::Accounts2; #assumes C4/Accounts2 - +package C4::Accounts; # Copyright 2000-2002 Katipo Communications # @@ -38,7 +37,7 @@ C4::Accounts - Functions for dealing with Koha accounts =head1 SYNOPSIS - use C4::Accounts2; +use C4::Accounts; =head1 DESCRIPTION @@ -72,31 +71,31 @@ C<$env> is ignored. sub checkaccount { #take borrower number #check accounts and list amounts owing - my ($env,$borrowernumber,$dbh,$date)=@_; - my $select="SELECT SUM(amountoutstanding) AS total - FROM accountlines - WHERE borrowernumber = ? - AND amountoutstanding<>0"; - my @bind = ($borrowernumber); - if ($date && $date ne ''){ - $select.=" AND date < ?"; - push(@bind,$date); - } - # print $select; - my $sth=$dbh->prepare($select); - $sth->execute(@bind); - my $data=$sth->fetchrow_hashref; - my $total = $data->{'total'} || 0; - $sth->finish; - # output(1,2,"borrower owes $total"); - #if ($total > 0){ - # # output(1,2,"borrower owes $total"); - # if ($total > 5){ - # reconcileaccount($env,$dbh,$borrowernumber,$total); - # } - #} - # pause(); - return($total); + my ($env,$borrowernumber,$dbh,$date)=@_; + my $select="SELECT SUM(amountoutstanding) AS total + FROM accountlines + WHERE borrowernumber = ? + AND amountoutstanding<>0"; + my @bind = ($borrowernumber); + if ($date && $date ne ''){ + $select.=" AND date < ?"; + push(@bind,$date); + } + # print $select; + my $sth=$dbh->prepare($select); + $sth->execute(@bind); + my $data=$sth->fetchrow_hashref; + my $total = $data->{'total'} || 0; + $sth->finish; + # output(1,2,"borrower owes $total"); + #if ($total > 0){ + # # output(1,2,"borrower owes $total"); + # if ($total > 5){ + # reconcileaccount($env,$dbh,$borrowernumber,$total); + # } + #} + # pause(); + return($total); } =head2 recordpayment @@ -350,20 +349,20 @@ sub manualinvoice{ } if ($type eq 'M'){ $desc.="Sundry"; - } - + } + if ($type eq 'L' && $desc eq ''){ $desc="Lost Item"; } if ($type eq 'REF'){ - $desc.="Cash Refund"; - $amountleft=refund('',$borrowernumber,$amount); + $desc.="Cash Refund"; + $amountleft=refund('',$borrowernumber,$amount); } if(($type eq 'L') or ($type eq 'F') or ($type eq 'A') or ($type eq 'N') or ($type eq 'M') ){ - $notifyid=1; + $notifyid=1; } - + if ($itemnum ne ''){ $desc.=" ".$itemnum; my $sth=$dbh->prepare("INSERT INTO accountlines @@ -372,9 +371,9 @@ sub manualinvoice{ # $sth->execute($borrowernumber, $accountno, $amount, $desc, $type, $amountleft, $data->{'itemnumber'}); $sth->execute($borrowernumber, $accountno, $amount, $desc, $type, $amountleft, $itemnum,$notifyid); } else { - my $sth=$dbh->prepare("INSERT INTO accountlines - (borrowernumber, accountno, date, amount, description, accounttype, amountoutstanding,notify_id) - VALUES (?, ?, now(), ?, ?, ?, ?,?)"); + my $sth=$dbh->prepare("INSERT INTO accountlines + (borrowernumber, accountno, date, amount, description, accounttype, amountoutstanding,notify_id) + VALUES (?, ?, now(), ?, ?, ?, ?,?)"); $sth->execute($borrowernumber, $accountno, $amount, $desc, $type, $amountleft,$notifyid); } } diff --git a/C4/Amazon.pm b/C4/Amazon.pm index 02d3b461ac..ae7573fe9e 100755 --- a/C4/Amazon.pm +++ b/C4/Amazon.pm @@ -106,3 +106,4 @@ sub check_search_inside { Joshua Ferraro =cut +1; diff --git a/C4/Circulation/Circ2.pm b/C4/Circulation/Circ2.pm index d4fea35053..f310881c77 100755 --- a/C4/Circulation/Circ2.pm +++ b/C4/Circulation/Circ2.pm @@ -26,7 +26,7 @@ use C4::Stats; use C4::Reserves2; use C4::Koha; use C4::Biblio; -use C4::Accounts2; +use C4::Accounts; use Date::Calc qw( Today Today_and_Now diff --git a/C4/Circulation/Fines.pm b/C4/Circulation/Fines.pm index bf52295550..373686ea9a 100644 --- a/C4/Circulation/Fines.pm +++ b/C4/Circulation/Fines.pm @@ -24,7 +24,7 @@ require Exporter; use C4::Context; use Date::Calc qw/Today/; use vars qw($VERSION @ISA @EXPORT); -use C4::Accounts2; +use C4::Accounts; use Date::Manip qw/UnixDate/; use C4::Log; # logaction diff --git a/C4/Circulation/Returns.pm b/C4/Circulation/Returns.pm index 0373e671b4..3a9fcb5e7d 100755 --- a/C4/Circulation/Returns.pm +++ b/C4/Circulation/Returns.pm @@ -31,7 +31,7 @@ use strict; require Exporter; use DBI; use C4::Context; -use C4::Accounts2; +use C4::Accounts; use C4::InterfaceCDK; use C4::Circulation::Main; # FIXME - C4::Circulation::Main and C4::Circulation::Returns diff --git a/C4/Date.pm b/C4/Date.pm index 77242ab478..67bc81c731 100644 --- a/C4/Date.pm +++ b/C4/Date.pm @@ -1,6 +1,18 @@ -#!/usr/bin/perl -w - -package C4::Date; +package C4::Date +# 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., 59 Temple Place, +# Suite 330, Boston, MA 02111-1307 USA use strict; use C4::Context; diff --git a/members/mancredit.pl b/members/mancredit.pl index e1769c07fc..9739cee8bf 100755 --- a/members/mancredit.pl +++ b/members/mancredit.pl @@ -28,7 +28,7 @@ use C4::Interface::CGI::Output; use CGI; use C4::Members; -use C4::Accounts2; +use C4::Accounts; my $input=new CGI; diff --git a/members/maninvoice.pl b/members/maninvoice.pl index 484207595d..fbc142f859 100755 --- a/members/maninvoice.pl +++ b/members/maninvoice.pl @@ -27,7 +27,7 @@ use C4::Output; use C4::Interface::CGI::Output; use CGI; use C4::Members; -use C4::Accounts2; +use C4::Accounts; my $input=new CGI; diff --git a/members/pay.pl b/members/pay.pl index 4b89730ea9..30f97aa3b7 100755 --- a/members/pay.pl +++ b/members/pay.pl @@ -32,7 +32,7 @@ use C4::Auth; use C4::Output; use CGI; use C4::Members; -use C4::Accounts2; +use C4::Accounts; use C4::Stats; use C4::Koha; use C4::Circulation::Fines; diff --git a/misc/tidyaccounts.pl b/misc/tidyaccounts.pl index 0ac2a79690..0edbd6c93d 100755 --- a/misc/tidyaccounts.pl +++ b/misc/tidyaccounts.pl @@ -23,7 +23,7 @@ use strict; use CGI; -use C4::Accounts2; +use C4::Accounts; my $input=new CGI; -- 2.20.1