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

(-)a/C4/Members.pm (-17 / +15 lines)
Lines 2382-2403 Add enrolment fee for a patron if needed. Link Here
2382
2382
2383
sub AddEnrolmentFeeIfNeeded {
2383
sub AddEnrolmentFeeIfNeeded {
2384
    my ( $categorycode, $borrowernumber ) = @_;
2384
    my ( $categorycode, $borrowernumber ) = @_;
2385
    # check for enrollment fee & add it if needed
2385
2386
    my $dbh = C4::Context->dbh;
2386
    my $schema = Koha::Database->new()->schema();
2387
    my $sth = $dbh->prepare(q{
2387
2388
        SELECT enrolmentfee
2388
    my $category = $schema->resultset('Category')->find($categorycode);
2389
        FROM categories
2389
    my $fee      = $category->enrolmentfee();
2390
        WHERE categorycode=?
2390
2391
    });
2391
    if ( $fee && $fee > 0 ) {
2392
    $sth->execute( $categorycode );
2392
        AddDebit(
2393
    if ( $sth->err ) {
2393
            {
2394
        warn sprintf('Database returned the following error: %s', $sth->errstr);
2394
                borrower =>
2395
        return;
2395
                  $schema->resultset('Borrower')->find($borrowernumber),
2396
    }
2396
                type   => Koha::Accounts::DebitTypes::AccountManagementFee(),
2397
    my ($enrolmentfee) = $sth->fetchrow;
2397
                amount => $fee,
2398
    if ($enrolmentfee && $enrolmentfee > 0) {
2398
            }
2399
        # insert fee in patron debts
2399
        );
2400
        C4::Accounts::manualinvoice( $borrowernumber, '', '', 'A', $enrolmentfee );
2401
    }
2400
    }
2402
}
2401
}
2403
2402
2404
- 

Return to bug 6427