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

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

Return to bug 6427