<<

NAME

C4::Accounts - Functions for dealing with Koha accounts

SYNOPSIS

use C4::Accounts;

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.

FUNCTIONS

getnextacctno

  $nextacct = &getnextacctno($borrowernumber);

Returns the next unused account number for the patron with the given borrower number.

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(<<EOT);
        UPDATE  accountlines
        SET     amount = '$amount',
                amountoutstanding = '$outstanding'
        WHERE   accountlines_id = $accountlines_id
EOT
        # FIXME: exceedingly bad form.  Use prepare with placholders ("?") in query and execute args.
}

chargelostitem

In a default install of Koha the following lost values are set 1 = Lost 2 = Long overdue 3 = Lost and paid for

FIXME: itemlost should be set to 3 after payment is made, should be a warning to the interface that a charge has been added FIXME : if no replacement price, borrower just doesn't get charged?

manualinvoice

  &manualinvoice($borrowernumber, $itemnumber, $description, $type,
                 $amount, $note);

$borrowernumber is the patron's borrower number. $description is a description of the transaction. $type may be one of CS, CB, CW, CF, CL, N, L, or REF. $itemnumber is the item involved, if pertinent; otherwise, it should be the empty string.

purge_zero_balance_fees

  purge_zero_balance_fees( $days );

Delete accountlines entries where amountoutstanding is 0 or NULL which are more than a given number of days old.

$days -- Zero balance fees older than $days days old will be deleted.

Warning: Because fines and payments are not linked in accountlines, it is possible for a fine to be deleted without the accompanying payment, or vise versa. This won't affect the account balance, but might be confusing to staff.

SEE ALSO

DBI(3)

<<