[Koha] A question about fines and account lines

George Adams g_adams27 at hotmail.com
Thu Mar 27 09:03:51 NZDT 2008


Short version: In the "accountlines" table, there is a field called
"accounttype" that can have values like L, F, FU, FM, O, etc.  What do
those values mean?

Long version: I'm using the script <KOHA>/bin/cronjobs/fines2.pl to
calculate fines on a nightly basis.  It works pretty well, but I
noticed that it has this line:

  UpdateFine($data->[$i]->{'itemnumber'},
  $data->[$i]->{'borrowernumber'},$amount,$type,$due);

This calls the UpdateFine subroutine in C4/Overdues.pm, which runs this
command:

    my $sth2 = $dbh->prepare(
      "INSERT INTO accountlines
      (borrowernumber,itemnumber,date,amount,
      description,accounttype,amountoutstanding,accountno) VALUES
      (?,?,now(),?,?,'FU',?,?)"
    );

Note how "FU" is hardcoded as the "accounttype" in this section.  But
when a patron is viewing his/her summary screen in the OPAC (i.e. 
http://www.example.net/cgi-bin/koha/opac-user.pl) and has an overdue
item, the line under "Fines" always says "No".

Why?  Because opac-user.pl has this bit of code:

    my $charges = 0;
    foreach my $ac (@$accts) {
        if ( $ac->{'itemnumber'} == $issue->{'itemnumber'} ) {
            $charges += $ac->{'amountoutstanding'}
              if $ac->{'accounttype'} eq 'F';
            $charges += $ac->{'amountoutstanding'}
              if $ac->{'accounttype'} eq 'L';
        }
    }
    $issue->{'charges'} = $charges;

So, $charges is only going to be passed to the template if the
accounttype is "F" or "L".  But since C4/Overdues.pm is always setting
it to "FU", that will never happen, and the Summary screen will always
tell the patron they have no fines.

So, can anyone tell me what the different accounttypes are?  I could
fix this, I guess, by changing the code for the UpdateFine subroutine
or opac-user.pl fine calculation, but I don't want to go fiddling with
the code lest it have some unforseen side effect.

Thanks.



More information about the Koha mailing list