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

(-)a/Koha/Account.pm (-34 / +3 lines)
Lines 64-70 Koha::Account->new( { patron_id => $borrowernumber } )->pay( Link Here
64
        library_id  => $branchcode,
64
        library_id  => $branchcode,
65
        lines       => $lines, # Arrayref of Koha::Account::Line objects to pay
65
        lines       => $lines, # Arrayref of Koha::Account::Line objects to pay
66
        credit_type => $type,  # credit_type_code code
66
        credit_type => $type,  # credit_type_code code
67
        offset_type => $offset_type,    # offset type code
68
        item_id     => $itemnumber,     # pass the itemnumber if this is a credit pertianing to a specific item (i.e LOST_FOUND)
67
        item_id     => $itemnumber,     # pass the itemnumber if this is a credit pertianing to a specific item (i.e LOST_FOUND)
69
    }
68
    }
70
);
69
);
Lines 81-87 sub pay { Link Here
81
    my $lines         = $params->{lines};
80
    my $lines         = $params->{lines};
82
    my $type          = $params->{type} || 'PAYMENT';
81
    my $type          = $params->{type} || 'PAYMENT';
83
    my $payment_type  = $params->{payment_type} || undef;
82
    my $payment_type  = $params->{payment_type} || undef;
84
    my $offset_type   = $params->{offset_type} || $type eq 'WRITEOFF' ? 'Writeoff' : 'Payment';
85
    my $cash_register = $params->{cash_register};
83
    my $cash_register = $params->{cash_register};
86
    my $item_id       = $params->{item_id};
84
    my $item_id       = $params->{item_id};
87
85
Lines 238-245 sub add_credit { Link Here
238
                my $account_offset = Koha::Account::Offset->new(
236
                my $account_offset = Koha::Account::Offset->new(
239
                    {
237
                    {
240
                        credit_id => $line->id,
238
                        credit_id => $line->id,
241
                        type   => $Koha::Account::offset_type->{$credit_type} // $Koha::Account::offset_type->{CREDIT},
239
                        type      => 'CREATE',
242
                        amount => $amount
240
                        amount    => $amount
243
                    }
241
                    }
244
                )->store();
242
                )->store();
245
243
Lines 455-461 sub add_debit { Link Here
455
    my $transaction_type = $params->{transaction_type};
453
    my $transaction_type = $params->{transaction_type};
456
    my $item_id          = $params->{item_id};
454
    my $item_id          = $params->{item_id};
457
    my $issue_id         = $params->{issue_id};
455
    my $issue_id         = $params->{issue_id};
458
    my $offset_type      = $Koha::Account::offset_type->{$debit_type} // 'Manual Debit';
459
456
460
    my $line;
457
    my $line;
461
    my $schema = Koha::Database->new->schema;
458
    my $schema = Koha::Database->new->schema;
Lines 492-498 sub add_debit { Link Here
492
                my $account_offset = Koha::Account::Offset->new(
489
                my $account_offset = Koha::Account::Offset->new(
493
                    {
490
                    {
494
                        debit_id => $line->id,
491
                        debit_id => $line->id,
495
                        type     => $offset_type,
492
                        type     => 'CREATE',
496
                        amount   => $amount
493
                        amount   => $amount
497
                    }
494
                    }
498
                )->store();
495
                )->store();
Lines 770-802 sub reconcile_balance { Link Here
770
767
771
1;
768
1;
772
769
773
=head2 Name mappings
774
775
=head3 $offset_type
776
777
=cut
778
779
our $offset_type = {
780
    'CREDIT'           => 'Manual Credit',
781
    'FORGIVEN'         => 'Writeoff',
782
    'LOST_FOUND'       => 'Lost Item Found',
783
    'OVERPAYMENT'      => 'Overpayment',
784
    'PAYMENT'          => 'Payment',
785
    'WRITEOFF'         => 'Writeoff',
786
    'ACCOUNT'          => 'Account Fee',
787
    'ACCOUNT_RENEW'    => 'Account Fee',
788
    'RESERVE'          => 'Reserve Fee',
789
    'PROCESSING'       => 'Processing Fee',
790
    'LOST'             => 'Lost Item',
791
    'RENT'             => 'Rental Fee',
792
    'RENT_DAILY'       => 'Rental Fee',
793
    'RENT_RENEW'       => 'Rental Fee',
794
    'RENT_DAILY_RENEW' => 'Rental Fee',
795
    'OVERDUE'          => 'OVERDUE',
796
    'RESERVE_EXPIRED'  => 'Hold Expired',
797
    'PAYOUT'           => 'PAYOUT',
798
};
799
800
=head1 AUTHORS
770
=head1 AUTHORS
801
771
802
=encoding utf8
772
=encoding utf8
803
- 

Return to bug 22435