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

(-)a/Koha/Account.pm (-6 / +6 lines)
Lines 444-451 my $debit_line = Koha::Account->new({ patron_id => $patron_id })->add_debit( Link Here
444
);
444
);
445
445
446
$debit_type can be any of:
446
$debit_type can be any of:
447
  - account
447
  - ACCOUNT
448
  - account_renew
448
  - ACCOUNT_RENEW
449
  - hold_expired
449
  - hold_expired
450
  - lost_item
450
  - lost_item
451
  - sundry
451
  - sundry
Lines 709-716 our $offset_type = { Link Here
709
    'lost_item_return' => 'Lost Item',
709
    'lost_item_return' => 'Lost Item',
710
    'payment'          => 'Payment',
710
    'payment'          => 'Payment',
711
    'writeoff'         => 'Writeoff',
711
    'writeoff'         => 'Writeoff',
712
    'account'          => 'Account Fee',
712
    'ACCOUNT'          => 'Account Fee',
713
    'account_renew'    => 'Account Fee',
713
    'ACCOUNT_RENEW'    => 'Account Fee',
714
    'RESERVE'          => 'Reserve Fee',
714
    'RESERVE'          => 'Reserve Fee',
715
    'PROCESSING'       => 'Processing Fee',
715
    'PROCESSING'       => 'Processing Fee',
716
    'lost_item'        => 'Lost Item',
716
    'lost_item'        => 'Lost Item',
Lines 740-747 our $account_type_credit = { Link Here
740
=cut
740
=cut
741
741
742
our $account_type_debit = {
742
our $account_type_debit = {
743
    'account'          => 'ACCOUNT',
743
    'ACCOUNT'          => 'ACCOUNT',
744
    'account_renew'    => 'ACCOUNT_RENEW',
744
    'ACCOUNT_RENEW'    => 'ACCOUNT_RENEW',
745
    'hold_expired'     => 'HE',
745
    'hold_expired'     => 'HE',
746
    'lost_item'        => 'LOST',
746
    'lost_item'        => 'LOST',
747
    'sundry'           => 'M',
747
    'sundry'           => 'M',
(-)a/Koha/Patron.pm (-1 / +1 lines)
Lines 887-893 sub add_enrolment_fee_if_needed { Link Here
887
    my ($self, $renewal) = @_;
887
    my ($self, $renewal) = @_;
888
    my $enrolment_fee = $self->category->enrolmentfee;
888
    my $enrolment_fee = $self->category->enrolmentfee;
889
    if ( $enrolment_fee && $enrolment_fee > 0 ) {
889
    if ( $enrolment_fee && $enrolment_fee > 0 ) {
890
        my $type = $renewal ? 'account_renew' : 'account';
890
        my $type = $renewal ? 'ACCOUNT_RENEW' : 'ACCOUNT';
891
        $self->account->add_debit(
891
        $self->account->add_debit(
892
            {
892
            {
893
                amount     => $enrolment_fee,
893
                amount     => $enrolment_fee,
(-)a/t/db_dependent/Accounts.t (-8 / +8 lines)
Lines 183-190 subtest "Koha::Account::pay tests" => sub { Link Here
183
183
184
    my $account = Koha::Account->new({ patron_id => $borrower->id });
184
    my $account = Koha::Account->new({ patron_id => $borrower->id });
185
185
186
    my $line1 = $account->add_debit({ type => 'account', amount => 100, interface => 'commandline' });
186
    my $line1 = $account->add_debit({ type => 'ACCOUNT', amount => 100, interface => 'commandline' });
187
    my $line2 = $account->add_debit({ type => 'account', amount => 200, interface => 'commandline' });
187
    my $line2 = $account->add_debit({ type => 'ACCOUNT', amount => 200, interface => 'commandline' });
188
188
189
    $sth = $dbh->prepare("SELECT count(*) FROM accountlines");
189
    $sth = $dbh->prepare("SELECT count(*) FROM accountlines");
190
    $sth->execute;
190
    $sth->execute;
Lines 283-289 subtest "Koha::Account::pay tests" => sub { Link Here
283
    $note = $sth->fetchrow_array;
283
    $note = $sth->fetchrow_array;
284
    is($note,'$200.00 payment note', '$200.00 payment note is registered');
284
    is($note,'$200.00 payment note', '$200.00 payment note is registered');
285
285
286
    my $line3 = $account->add_debit({ type => 'account', amount => 42, interface => 'commandline' });
286
    my $line3 = $account->add_debit({ type => 'ACCOUNT', amount => 42, interface => 'commandline' });
287
    my $payment_id = $account->pay( { lines => [$line3], amount => 42 } );
287
    my $payment_id = $account->pay( { lines => [$line3], amount => 42 } );
288
    my $payment = Koha::Account::Lines->find( $payment_id );
288
    my $payment = Koha::Account::Lines->find( $payment_id );
289
    is( $payment->amount(), '-42.000000', "Payment paid the specified fine" );
289
    is( $payment->amount(), '-42.000000', "Payment paid the specified fine" );
Lines 311-320 subtest "Koha::Account::pay particular line tests" => sub { Link Here
311
311
312
    my $account = Koha::Account->new({ patron_id => $borrower->id });
312
    my $account = Koha::Account->new({ patron_id => $borrower->id });
313
313
314
    my $line1 = $account->add_debit({ type => 'account', amount => 1, interface => 'commandline' });
314
    my $line1 = $account->add_debit({ type => 'ACCOUNT', amount => 1, interface => 'commandline' });
315
    my $line2 = $account->add_debit({ type => 'account', amount => 2, interface => 'commandline' });
315
    my $line2 = $account->add_debit({ type => 'ACCOUNT', amount => 2, interface => 'commandline' });
316
    my $line3 = $account->add_debit({ type => 'account', amount => 3, interface => 'commandline' });
316
    my $line3 = $account->add_debit({ type => 'ACCOUNT', amount => 3, interface => 'commandline' });
317
    my $line4 = $account->add_debit({ type => 'account', amount => 4, interface => 'commandline' });
317
    my $line4 = $account->add_debit({ type => 'ACCOUNT', amount => 4, interface => 'commandline' });
318
318
319
    is( $account->balance(), 10, "Account balance is 10" );
319
    is( $account->balance(), 10, "Account balance is 10" );
320
320
Lines 356-362 subtest "Koha::Account::pay writeoff tests" => sub { Link Here
356
356
357
    my $account = Koha::Account->new({ patron_id => $borrower->id });
357
    my $account = Koha::Account->new({ patron_id => $borrower->id });
358
358
359
    my $line = $account->add_debit({ type => 'account', amount => 42, interface => 'commandline' });
359
    my $line = $account->add_debit({ type => 'ACCOUNT', amount => 42, interface => 'commandline' });
360
360
361
    is( $account->balance(), 42, "Account balance is 42" );
361
    is( $account->balance(), 42, "Account balance is 42" );
362
362
(-)a/t/db_dependent/SIP/Transaction.t (-3 / +2 lines)
Lines 106-114 subtest "FeePayment->pay tests" => sub { Link Here
106
    my $account =
106
    my $account =
107
      Koha::Account->new( { patron_id => $patron->{borrowernumber} } );
107
      Koha::Account->new( { patron_id => $patron->{borrowernumber} } );
108
    my $debt1 = $account->add_debit(
108
    my $debt1 = $account->add_debit(
109
        { type => 'account', amount => 100, interface => 'commandline' } );
109
        { type => 'ACCOUNT', amount => 100, interface => 'commandline' } );
110
    my $debt2 = $account->add_debit(
110
    my $debt2 = $account->add_debit(
111
        { type => 'account', amount => 200, interface => 'commandline' } );
111
        { type => 'ACCOUNT', amount => 200, interface => 'commandline' } );
112
112
113
    # Instantiate a new FeePayment transaction object
113
    # Instantiate a new FeePayment transaction object
114
    my $trans = C4::SIP::ILS::Transaction::FeePayment->new();
114
    my $trans = C4::SIP::ILS::Transaction::FeePayment->new();
115
- 

Return to bug 23049