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

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

Return to bug 6427