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

(-)a/C4/Members.pm (-17 / +15 lines)
Lines 2348-2369 Add enrolment fee for a patron if needed. Link Here
2348
2348
2349
sub AddEnrolmentFeeIfNeeded {
2349
sub AddEnrolmentFeeIfNeeded {
2350
    my ( $categorycode, $borrowernumber ) = @_;
2350
    my ( $categorycode, $borrowernumber ) = @_;
2351
    # check for enrollment fee & add it if needed
2351
2352
    my $dbh = C4::Context->dbh;
2352
    my $schema = Koha::Database->new()->schema();
2353
    my $sth = $dbh->prepare(q{
2353
2354
        SELECT enrolmentfee
2354
    my $category = $schema->resultset('Category')->find($categorycode);
2355
        FROM categories
2355
    my $fee      = $category->enrolmentfee();
2356
        WHERE categorycode=?
2356
2357
    });
2357
    if ( $fee && $fee > 0 ) {
2358
    $sth->execute( $categorycode );
2358
        AddDebit(
2359
    if ( $sth->err ) {
2359
            {
2360
        warn sprintf('Database returned the following error: %s', $sth->errstr);
2360
                borrower =>
2361
        return;
2361
                  $schema->resultset('Borrower')->find($borrowernumber),
2362
    }
2362
                type   => Koha::Accounts::DebitTypes::AccountManagementFee(),
2363
    my ($enrolmentfee) = $sth->fetchrow;
2363
                amount => $fee,
2364
    if ($enrolmentfee && $enrolmentfee > 0) {
2364
            }
2365
        # insert fee in patron debts
2365
        );
2366
        C4::Accounts::manualinvoice( $borrowernumber, '', '', 'A', $enrolmentfee );
2367
    }
2366
    }
2368
}
2367
}
2369
2368
2370
- 

Return to bug 6427