|
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 82-88
sub pay {
Link Here
|
| 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 $credit_type = $params->{credit_type}; |
83 |
my $credit_type = $params->{credit_type}; |
| 85 |
my $offset_type = $params->{offset_type} || $type eq 'WRITEOFF' ? 'Writeoff' : 'Payment'; |
|
|
| 86 |
my $cash_register = $params->{cash_register}; |
84 |
my $cash_register = $params->{cash_register}; |
| 87 |
my $item_id = $params->{item_id}; |
85 |
my $item_id = $params->{item_id}; |
| 88 |
|
86 |
|
|
Lines 152-158
sub pay {
Link Here
|
| 152 |
my $account_offset = Koha::Account::Offset->new( |
150 |
my $account_offset = Koha::Account::Offset->new( |
| 153 |
{ |
151 |
{ |
| 154 |
debit_id => $fine->id, |
152 |
debit_id => $fine->id, |
| 155 |
type => $offset_type, |
153 |
type => 'CREATE', |
| 156 |
amount => $amount_to_pay * -1, |
154 |
amount => $amount_to_pay * -1, |
| 157 |
} |
155 |
} |
| 158 |
); |
156 |
); |
|
Lines 223-229
sub pay {
Link Here
|
| 223 |
my $account_offset = Koha::Account::Offset->new( |
221 |
my $account_offset = Koha::Account::Offset->new( |
| 224 |
{ |
222 |
{ |
| 225 |
debit_id => $fine->id, |
223 |
debit_id => $fine->id, |
| 226 |
type => $offset_type, |
224 |
type => 'CREATE', |
| 227 |
amount => $amount_to_pay * -1, |
225 |
amount => $amount_to_pay * -1, |
| 228 |
} |
226 |
} |
| 229 |
); |
227 |
); |
|
Lines 432-439
sub add_credit {
Link Here
|
| 432 |
my $account_offset = Koha::Account::Offset->new( |
430 |
my $account_offset = Koha::Account::Offset->new( |
| 433 |
{ |
431 |
{ |
| 434 |
credit_id => $line->id, |
432 |
credit_id => $line->id, |
| 435 |
type => $Koha::Account::offset_type->{$credit_type} // $Koha::Account::offset_type->{CREDIT}, |
433 |
type => 'CREATE', |
| 436 |
amount => $amount |
434 |
amount => $amount |
| 437 |
} |
435 |
} |
| 438 |
)->store(); |
436 |
)->store(); |
| 439 |
|
437 |
|
|
Lines 640-646
sub add_debit {
Link Here
|
| 640 |
my $debit_type = $params->{type}; |
638 |
my $debit_type = $params->{type}; |
| 641 |
my $item_id = $params->{item_id}; |
639 |
my $item_id = $params->{item_id}; |
| 642 |
my $issue_id = $params->{issue_id}; |
640 |
my $issue_id = $params->{issue_id}; |
| 643 |
my $offset_type = $Koha::Account::offset_type->{$debit_type} // 'Manual Debit'; |
|
|
| 644 |
|
641 |
|
| 645 |
my $line; |
642 |
my $line; |
| 646 |
my $schema = Koha::Database->new->schema; |
643 |
my $schema = Koha::Database->new->schema; |
|
Lines 676-682
sub add_debit {
Link Here
|
| 676 |
my $account_offset = Koha::Account::Offset->new( |
673 |
my $account_offset = Koha::Account::Offset->new( |
| 677 |
{ |
674 |
{ |
| 678 |
debit_id => $line->id, |
675 |
debit_id => $line->id, |
| 679 |
type => $offset_type, |
676 |
type => 'CREATE', |
| 680 |
amount => $amount |
677 |
amount => $amount |
| 681 |
} |
678 |
} |
| 682 |
)->store(); |
679 |
)->store(); |
|
Lines 955-986
sub reconcile_balance {
Link Here
|
| 955 |
|
952 |
|
| 956 |
1; |
953 |
1; |
| 957 |
|
954 |
|
| 958 |
=head2 Name mappings |
|
|
| 959 |
|
| 960 |
=head3 $offset_type |
| 961 |
|
| 962 |
=cut |
| 963 |
|
| 964 |
our $offset_type = { |
| 965 |
'CREDIT' => 'Manual Credit', |
| 966 |
'FORGIVEN' => 'Writeoff', |
| 967 |
'LOST_FOUND' => 'Lost Item Found', |
| 968 |
'OVERPAYMENT' => 'Overpayment', |
| 969 |
'PAYMENT' => 'Payment', |
| 970 |
'WRITEOFF' => 'Writeoff', |
| 971 |
'ACCOUNT' => 'Account Fee', |
| 972 |
'ACCOUNT_RENEW' => 'Account Fee', |
| 973 |
'RESERVE' => 'Reserve Fee', |
| 974 |
'PROCESSING' => 'Processing Fee', |
| 975 |
'LOST' => 'Lost Item', |
| 976 |
'RENT' => 'Rental Fee', |
| 977 |
'RENT_DAILY' => 'Rental Fee', |
| 978 |
'RENT_RENEW' => 'Rental Fee', |
| 979 |
'RENT_DAILY_RENEW' => 'Rental Fee', |
| 980 |
'OVERDUE' => 'OVERDUE', |
| 981 |
'RESERVE_EXPIRED' => 'Hold Expired' |
| 982 |
}; |
| 983 |
|
| 984 |
=head1 AUTHORS |
955 |
=head1 AUTHORS |
| 985 |
|
956 |
|
| 986 |
=encoding utf8 |
957 |
=encoding utf8 |
| 987 |
- |
|
|