Browse Source

Commented out fixaccounts (not used anywhere). Also improved getnextacctno.

You can test getnextacctno like:
	perl -e 'use C4::Accounts; print getnextacctno(33), "\n";'
where 33 is a borrowernumber out of the accountlines table.  Get that number like:
	mysql> select borrowernumber,accountno from accountlines LIMIT 100;

Signed-off-by: Joshua Ferraro <jmf@liblime.com>
3.0.x
Joe Atzberger 15 years ago
committed by Joshua Ferraro
parent
commit
f36b8fd59a
  1. 34
      C4/Accounts.pm
  2. 3
      t/lib/KohaTest/Accounts.pm

34
C4/Accounts.pm

@ -29,14 +29,14 @@ use vars qw($VERSION @ISA @EXPORT);
BEGIN {
# set the version for version checking
$VERSION = 3.02;
$VERSION = 3.03;
require Exporter;
@ISA = qw(Exporter);
@EXPORT = qw(
&recordpayment &fixaccounts &makepayment &manualinvoice
&recordpayment &makepayment &manualinvoice
&getnextacctno &reconcileaccount &getcharges &getcredits
&getrefunds
);
); # removed &fixaccounts
}
=head1 NAME
@ -217,29 +217,22 @@ borrower number.
#'
# FIXME - Okay, so what does the above actually _mean_?
sub getnextacctno {
my ($borrowernumber) = @_;
my $nextaccntno = 1;
my $dbh = C4::Context->dbh;
my $sth = $dbh->prepare(
"SELECT * FROM accountlines
WHERE (borrowernumber = ?)
ORDER BY accountno DESC"
sub getnextacctno ($) {
my ($borrowernumber) = shift or return undef;
my $sth = C4::Context->dbh->prepare(
"SELECT accountno+1 FROM accountlines
WHERE (borrowernumber = ?)
ORDER BY accountno DESC
LIMIT 1"
);
$sth->execute($borrowernumber);
if ( my $accdata = $sth->fetchrow_hashref ) {
$nextaccntno = $accdata->{'accountno'} + 1;
}
$sth->finish;
return ($nextaccntno);
return ($sth->fetchrow || 1);
}
=head2 fixaccounts
=head2 fixaccounts (removed)
&fixaccounts($borrowernumber, $accountnumber, $amount);
=cut
#'
# FIXME - I don't understand what this function does.
sub fixaccounts {
@ -264,8 +257,11 @@ sub fixaccounts {
WHERE borrowernumber = $borrowernumber
AND accountno = $accountno
EOT
# FIXME: exceedingly bad form. Use prepare with placholders ("?") in query and execute args.
}
=cut
sub returnlost {
my ( $borrowernumber, $itemnum ) = @_;
C4::Circulation::MarkIssueReturned( $borrowernumber, $itemnum );

3
t/lib/KohaTest/Accounts.pm

@ -15,7 +15,6 @@ sub methods : Test( 1 ) {
my @methods = qw( recordpayment
makepayment
getnextacctno
fixaccounts
returnlost
manualinvoice
fixcredit
@ -23,7 +22,7 @@ sub methods : Test( 1 ) {
getcharges
getcredits
getrefunds
);
); # removed fixaccounts (unused by codebase)
can_ok( $self->testing_class, @methods );
}

Loading…
Cancel
Save