my $is_writeoff = shift;
my $disallow_overpayment = shift;
- my $type = $is_writeoff ? 'writeoff' : 'PAYMENT';
+ my $type = $is_writeoff ? 'WRITEOFF' : 'PAYMENT';
warn("RECORD:$borrowernumber::$amt");
my $type = $params->{type} || 'PAYMENT';
my $payment_type = $params->{payment_type} || undef;
my $credit_type = $params->{credit_type};
- my $offset_type = $params->{offset_type} || $type eq 'writeoff' ? 'Writeoff' : 'Payment';
+ my $offset_type = $params->{offset_type} || $type eq 'WRITEOFF' ? 'Writeoff' : 'Payment';
my $cash_register = $params->{cash_register};
my $userenv = C4::Context->userenv;
}
$credit_type ||=
- $type eq 'writeoff'
- ? 'W'
+ $type eq 'WRITEOFF'
+ ? 'WRITEOFF'
: 'PAYMENT';
- $description ||= $type eq 'writeoff' ? 'Writeoff' : q{};
+ $description ||= $type eq 'WRITEOFF' ? 'Writeoff' : q{};
my $payment = Koha::Account::Line->new(
{
- 'PAYMENT'
- 'FORGIVEN'
- 'LOST_RETURN'
- - 'writeoff'
+ - 'WRITEOFF'
=cut
amount => $amount,
borrowernumber => $self->{patron_id},
}
- ) if grep { $type eq $_ } ('PAYMENT', 'writeoff') ;
+ ) if grep { $type eq $_ } ('PAYMENT', 'WRITEOFF') ;
if ( C4::Context->preference("FinesLog") ) {
logaction(
'FORGIVEN' => 'Writeoff',
'LOST_RETURN' => 'Lost Item',
'PAYMENT' => 'Payment',
- 'writeoff' => 'Writeoff',
+ 'WRITEOFF' => 'Writeoff',
'ACCOUNT' => 'Account Fee',
'ACCOUNT_RENEW' => 'Account Fee',
'RESERVE' => 'Reserve Fee',
'FORGIVEN' => 'FORGIVEN',
'LOST_RETURN' => 'LOST_RETURN',
'PAYMENT' => 'PAYMENT',
- 'writeoff' => 'W'
+ 'WRITEOFF' => 'WRITEOFF'
};
=head1 AUTHORS
"properties": {
"credit_type": {
"type": "string",
- "description": "Type of credit ('CREDIT', 'FORGIVEN', 'LOST_RETURN', 'PAYMENT', 'writeoff' )"
+ "description": "Type of credit ('CREDIT', 'FORGIVEN', 'LOST_RETURN', 'PAYMENT', 'WRITEOFF' )"
},
"amount": {
"type": "number",
INSERT INTO account_debit_types ( code, description, can_be_added_manually, is_system ) VALUES
('PAYMENT', 'Payment', 0, 1),
-('W', 'Writeoff', 0, 1),
-('WO', 'Writeoff', 0, 1),
+('WRITEOFF', 'Writeoff', 0, 1),
('FORGIVEN', 'Forgiven', 1, 1),
('CREDIT', 'Credit', 1, 1),
('LOST_RETURN', 'Lost item fee refund', 0, 1);
)
VALUES
('PAYMENT', 'Payment', 0, 1),
- ('W', 'Writeoff', 0, 1),
- ('WO', 'Writeoff', 0, 1),
+ ('WRITEOFF', 'Writeoff', 0, 1),
('FORGIVEN', 'Forgiven', 1, 1),
('CREDIT', 'Credit', 1, 1),
('LOST_RETURN', 'Lost item fee refund', 0, 1)
}
);
+ # Update accountype 'W' to 'WRITEOFF'
+ $dbh->do(
+ qq{
+ UPDATE accountlines SET accounttype = 'WRITEOFF' WHERE accounttype = 'W' OR accounttype = 'WO'
+ }
+ );
+
# Populating credit_type_code
$dbh->do(
qq{
[%- IF account.credit_type_code -%]
[%- SWITCH account.credit_type_code -%]
[%- CASE 'PAYMENT' -%]Payment
- [%- CASE 'W' -%]Writeoff
+ [%- CASE 'WRITEOFF' -%]Writeoff
[%- CASE 'FORGIVEN' -%]Forgiven
- [%- CASE 'WO' -%]Writeoff
[%- CASE 'CREDIT' -%]Credit
[%- CASE 'LOST_RETURN' -%]Lost item fee refund
[%- CASE -%][% account.credit_type.description | html %]
[%- IF account.credit_type_code -%]
[%- SWITCH account.credit_type_code -%]
[%- CASE 'PAYMENT' -%]Payment
- [%- CASE 'W' -%]Writeoff
+ [%- CASE 'WRITEOFF' -%]Writeoff
[%- CASE 'FORGIVEN' -%]Forgiven
- [%- CASE 'WO' -%]Writeoff
[%- CASE 'CREDIT' -%]Credit
[%- CASE 'LOST_RETURN' -%]Lost item fee refund
[%- CASE -%][% account.credit_type.description | html %]
payselected({ params => \@names });
}
elsif ( $input->param('writeoff_selected') ) {
- payselected({ params => \@names, type => 'writeoff' });
+ payselected({ params => \@names, type => 'WRITEOFF' });
}
elsif ( $input->param('woall') ) {
writeoff_all(@names);
{
amount => $amount,
lines => [ scalar Koha::Account::Lines->find($accountlines_id) ],
- type => 'writeoff',
+ type => 'WRITEOFF',
note => $payment_note,
interface => C4::Context->interface,
library_id => $branch,
{
amount => $amount,
lines => [ scalar Koha::Account::Lines->find($accountlines_id) ],
- type => 'writeoff',
+ type => 'WRITEOFF',
note => $payment_note,
interface => C4::Context->interface,
library_id => $branch,
} elsif ($transaction_type eq 'ACT') { #Active
$whereTType = q{ AND credit_type_code IN ('PAYMENT','CREDIT') };
} elsif ($transaction_type eq 'FORW') {
- $whereTType = q{ AND credit_type_code IN ('FORGIVEN','W') };
+ $whereTType = q{ AND credit_type_code IN ('FORGIVEN','WRITEOFF') };
} else {
if ( any { $transaction_type eq $_->code } @debit_types ) {
$whereTType = q{ AND debit_type_code = ? };
if($row->{credit_type_code} =~ /^CREDIT$/){
$grantotal -= abs($row->{amount});
$row->{amount} = '-' . $row->{amount};
- }elsif($row->{credit_type_code} eq 'FORGIVEN' || $row->{credit_type_code} eq 'W'){
+ }elsif($row->{credit_type_code} eq 'FORGIVEN' || $row->{credit_type_code} eq 'WRITEOFF'){
}else{
$grantotal += abs($row->{amount});
}
{
lines => [$line],
amount => 42,
- type => 'writeoff',
+ type => 'WRITEOFF',
}
);
my $writeoff = Koha::Account::Lines->find( $id );
- is( $writeoff->credit_type_code, 'W', 'Type is correct for writeoff' );
+ is( $writeoff->credit_type_code, 'WRITEOFF', 'Type is correct for WRITEOFF' );
is( $writeoff->description, 'Writeoff', 'Description is correct' );
is( $writeoff->amount, '-42.000000', 'Amount is correct' );
};
my $id = $account->pay( { amount => 1 } );
is( Koha::Notice::Messages->search()->count(), 0, 'Notice for payment not sent if UseEmailReceipts is disabled' );
- $id = $account->pay( { amount => 1, type => 'writeoff' } );
+ $id = $account->pay( { amount => 1, type => 'WRITEOFF' } );
is( Koha::Notice::Messages->search()->count(), 0, 'Notice for writeoff not sent if UseEmailReceipts is disabled' );
t::lib::Mocks::mock_preference('UseEmailReceipts', '1');
$letter->content('[%- USE Price -%]A writeoff of [% credit.amount * -1 | $Price %] has been applied to your account.');
$letter->store();
- $id = $account->pay( { amount => 13, type => 'writeoff' } );
+ $id = $account->pay( { amount => 13, type => 'WRITEOFF' } );
$notice = Koha::Notice::Messages->search()->next();
is( $notice->subject, 'Account writeoff', 'Notice subject is correct for payment' );
is( $notice->letter_code, 'ACCOUNT_WRITEOFF', 'Notice letter code is correct for writeoff' );
# Write off the debt
my $credit = $account->add_credit(
{ amount => $account->balance,
- type => 'writeoff',
+ type => 'WRITEOFF',
interface => 'test',
}
);
my $write_off_amount = 25;
my $write_off = $account->add_credit(
{ amount => $write_off_amount,
- type => 'writeoff',
+ type => 'WRITEOFF',
interface => 'test',
}
);