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

(-)a/Koha/Account.pm (-33 / +3 lines)
Lines 62-68 Koha::Account->new( { patron_id => $borrowernumber } )->pay( Link Here
62
        library_id  => $branchcode,
62
        library_id  => $branchcode,
63
        lines       => $lines, # Arrayref of Koha::Account::Line objects to pay
63
        lines       => $lines, # Arrayref of Koha::Account::Line objects to pay
64
        credit_type => $type,  # credit_type_code code
64
        credit_type => $type,  # credit_type_code code
65
        offset_type => $offset_type,    # offset type code
66
        item_id     => $itemnumber,     # pass the itemnumber if this is a credit pertianing to a specific item (i.e LOST_FOUND)
65
        item_id     => $itemnumber,     # pass the itemnumber if this is a credit pertianing to a specific item (i.e LOST_FOUND)
67
    }
66
    }
68
);
67
);
Lines 242-249 sub add_credit { Link Here
242
                my $account_offset = Koha::Account::Offset->new(
241
                my $account_offset = Koha::Account::Offset->new(
243
                    {
242
                    {
244
                        credit_id => $line->id,
243
                        credit_id => $line->id,
245
                        type   => $Koha::Account::offset_type->{$credit_type} // $Koha::Account::offset_type->{CREDIT},
244
                        type      => 'CREATE',
246
                        amount => $amount
245
                        amount    => $amount
247
                    }
246
                    }
248
                )->store();
247
                )->store();
249
248
Lines 459-465 sub add_debit { Link Here
459
    my $transaction_type = $params->{transaction_type};
458
    my $transaction_type = $params->{transaction_type};
460
    my $item_id          = $params->{item_id};
459
    my $item_id          = $params->{item_id};
461
    my $issue_id         = $params->{issue_id};
460
    my $issue_id         = $params->{issue_id};
462
    my $offset_type      = $Koha::Account::offset_type->{$debit_type} // 'Manual Debit';
463
461
464
    my $line;
462
    my $line;
465
    my $schema = Koha::Database->new->schema;
463
    my $schema = Koha::Database->new->schema;
Lines 496-502 sub add_debit { Link Here
496
                my $account_offset = Koha::Account::Offset->new(
494
                my $account_offset = Koha::Account::Offset->new(
497
                    {
495
                    {
498
                        debit_id => $line->id,
496
                        debit_id => $line->id,
499
                        type     => $offset_type,
497
                        type     => 'CREATE',
500
                        amount   => $amount
498
                        amount   => $amount
501
                    }
499
                    }
502
                )->store();
500
                )->store();
Lines 774-806 sub reconcile_balance { Link Here
774
772
775
1;
773
1;
776
774
777
=head2 Name mappings
778
779
=head3 $offset_type
780
781
=cut
782
783
our $offset_type = {
784
    'CREDIT'           => 'Manual Credit',
785
    'FORGIVEN'         => 'Writeoff',
786
    'LOST_FOUND'       => 'Lost Item Found',
787
    'OVERPAYMENT'      => 'Overpayment',
788
    'PAYMENT'          => 'Payment',
789
    'WRITEOFF'         => 'Writeoff',
790
    'ACCOUNT'          => 'Account Fee',
791
    'ACCOUNT_RENEW'    => 'Account Fee',
792
    'RESERVE'          => 'Reserve Fee',
793
    'PROCESSING'       => 'Processing Fee',
794
    'LOST'             => 'Lost Item',
795
    'RENT'             => 'Rental Fee',
796
    'RENT_DAILY'       => 'Rental Fee',
797
    'RENT_RENEW'       => 'Rental Fee',
798
    'RENT_DAILY_RENEW' => 'Rental Fee',
799
    'OVERDUE'          => 'OVERDUE',
800
    'RESERVE_EXPIRED'  => 'Hold Expired',
801
    'PAYOUT'           => 'PAYOUT',
802
};
803
804
=head1 AUTHORS
775
=head1 AUTHORS
805
776
806
=encoding utf8
777
=encoding utf8
807
- 

Return to bug 22435