View | Details | Raw Unified | Return to bug 6427
Collapse All | Expand All

(-)a/C4/Members.pm (-17 / +15 lines)
Lines 2335-2356 Add enrolment fee for a patron if needed. Link Here
2335
2335
2336
sub AddEnrolmentFeeIfNeeded {
2336
sub AddEnrolmentFeeIfNeeded {
2337
    my ( $categorycode, $borrowernumber ) = @_;
2337
    my ( $categorycode, $borrowernumber ) = @_;
2338
    # check for enrollment fee & add it if needed
2338
2339
    my $dbh = C4::Context->dbh;
2339
    my $schema = Koha::Database->new()->schema();
2340
    my $sth = $dbh->prepare(q{
2340
2341
        SELECT enrolmentfee
2341
    my $category = $schema->resultset('Category')->find($categorycode);
2342
        FROM categories
2342
    my $fee      = $category->enrolmentfee();
2343
        WHERE categorycode=?
2343
2344
    });
2344
    if ( $fee && $fee > 0 ) {
2345
    $sth->execute( $categorycode );
2345
        AddDebit(
2346
    if ( $sth->err ) {
2346
            {
2347
        warn sprintf('Database returned the following error: %s', $sth->errstr);
2347
                borrower =>
2348
        return;
2348
                  $schema->resultset('Borrower')->find($borrowernumber),
2349
    }
2349
                type   => Koha::Accounts::DebitTypes::AccountManagementFee(),
2350
    my ($enrolmentfee) = $sth->fetchrow;
2350
                amount => $fee,
2351
    if ($enrolmentfee && $enrolmentfee > 0) {
2351
            }
2352
        # insert fee in patron debts
2352
        );
2353
        C4::Accounts::manualinvoice( $borrowernumber, '', '', 'A', $enrolmentfee );
2354
    }
2353
    }
2355
}
2354
}
2356
2355
2357
- 

Return to bug 6427