require Exporter;
@ISA = qw(Exporter);
@EXPORT = qw(
- &getnextacctno
&chargelostitem
&purge_zero_balance_fees
);
=head1 FUNCTIONS
-=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 chargelostitem
In a default install of Koha the following lost values are set
$manager_id = C4::Context->userenv->{'number'} if C4::Context->userenv;
my $dbh = C4::Context->dbh;
my $insert;
- my $accountno = getnextacctno($borrowernumber);
my $amountleft = $amount;
my $branchcode = C4::Context->userenv ? C4::Context->userenv->{'branch'} : undef;
my $accountline = Koha::Account::Line->new(
{
borrowernumber => $borrowernumber,
- accountno => $accountno,
date => \'NOW()',
amount => $amount,
description => $desc,
logaction("FINES", 'CREATE',$borrowernumber,Dumper({
action => 'create_fee',
borrowernumber => $borrowernumber,
- accountno => $accountno,
amount => $amount,
description => $desc,
accounttype => $type,