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

(-)a/Koha/Account.pm (-33 / +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 244-251 sub add_credit { Link Here
244
                my $account_offset = Koha::Account::Offset->new(
243
                my $account_offset = Koha::Account::Offset->new(
245
                    {
244
                    {
246
                        credit_id => $line->id,
245
                        credit_id => $line->id,
247
                        type   => $Koha::Account::offset_type->{$credit_type} // $Koha::Account::offset_type->{CREDIT},
246
                        type      => 'CREATE',
248
                        amount => $amount
247
                        amount    => $amount
249
                    }
248
                    }
250
                )->store();
249
                )->store();
251
250
Lines 461-467 sub add_debit { Link Here
461
    my $transaction_type = $params->{transaction_type};
460
    my $transaction_type = $params->{transaction_type};
462
    my $item_id          = $params->{item_id};
461
    my $item_id          = $params->{item_id};
463
    my $issue_id         = $params->{issue_id};
462
    my $issue_id         = $params->{issue_id};
464
    my $offset_type      = $Koha::Account::offset_type->{$debit_type} // 'Manual Debit';
465
463
466
    my $line;
464
    my $line;
467
    my $schema = Koha::Database->new->schema;
465
    my $schema = Koha::Database->new->schema;
Lines 498-504 sub add_debit { Link Here
498
                my $account_offset = Koha::Account::Offset->new(
496
                my $account_offset = Koha::Account::Offset->new(
499
                    {
497
                    {
500
                        debit_id => $line->id,
498
                        debit_id => $line->id,
501
                        type     => $offset_type,
499
                        type     => 'CREATE',
502
                        amount   => $amount
500
                        amount   => $amount
503
                    }
501
                    }
504
                )->store();
502
                )->store();
Lines 776-808 sub reconcile_balance { Link Here
776
774
777
1;
775
1;
778
776
779
=head2 Name mappings
780
781
=head3 $offset_type
782
783
=cut
784
785
our $offset_type = {
786
    'CREDIT'           => 'Manual Credit',
787
    'FORGIVEN'         => 'Writeoff',
788
    'LOST_FOUND'       => 'Lost Item Found',
789
    'OVERPAYMENT'      => 'Overpayment',
790
    'PAYMENT'          => 'Payment',
791
    'WRITEOFF'         => 'Writeoff',
792
    'ACCOUNT'          => 'Account Fee',
793
    'ACCOUNT_RENEW'    => 'Account Fee',
794
    'RESERVE'          => 'Reserve Fee',
795
    'PROCESSING'       => 'Processing Fee',
796
    'LOST'             => 'Lost Item',
797
    'RENT'             => 'Rental Fee',
798
    'RENT_DAILY'       => 'Rental Fee',
799
    'RENT_RENEW'       => 'Rental Fee',
800
    'RENT_DAILY_RENEW' => 'Rental Fee',
801
    'OVERDUE'          => 'OVERDUE',
802
    'RESERVE_EXPIRED'  => 'Hold Expired',
803
    'PAYOUT'           => 'PAYOUT',
804
};
805
806
=head1 AUTHORS
777
=head1 AUTHORS
807
778
808
=encoding utf8
779
=encoding utf8
809
- 

Return to bug 22435