- 'PAYMENT'
- 'FORGIVEN'
- 'LOST_FOUND'
+ - 'OVERPAYMENT'
+ - 'PAYMENT'
- 'WRITEOFF'
=cut
'CREDIT' => 'Manual Credit',
'FORGIVEN' => 'Writeoff',
'LOST_FOUND' => 'Lost Item Found',
+ 'OVERPAYMENT' => 'Overpayment',
'PAYMENT' => 'Payment',
'WRITEOFF' => 'Writeoff',
'ACCOUNT' => 'Account Fee',
my $credit = $account->add_credit(
{
amount => $new_outstanding * -1,
- description => 'Overpayment refund',
- type => 'CREDIT',
+ type => 'OVERPAYMENT',
interface => $interface,
( $update_type eq 'overdue_update' ? ( item_id => $self->itemnumber ) : ()),
}
--- /dev/null
+$DBversion = 'XXX'; # will be replaced by the RM
+if ( CheckVersion($DBversion) ) {
+
+ $dbh->do(
+ qq{
+ INSERT IGNORE INTO account_credit_types (code, description, can_be_added_manually, is_system)
+ VALUES
+ ('OVERPAYMENT', 'Overpayment refund', 0, 1)
+ }
+ );
+
+ $dbh->do(
+ qq{
+ INSERT IGNORE INTO account_offset_types ( type ) VALUES ('Overpayment');
+ }
+ );
+
+ $dbh->do(
+ qq{
+ UPDATE accountlines SET credit_type_code = 'OVERPAYMENT' WHERE credit_type_code = 'CREDIT' AND description = 'Overpayment refund'
+ }
+ );
+
+ NewVersion( $DBversion, 25596, "Add OVERPAYMENT credit type" );
+}
INSERT INTO account_credit_types ( code, description, can_be_added_manually, is_system ) VALUES
+('OVERPAYMENT', 'Overpayment refund', 0, 1),
('PAYMENT', 'Payment', 0, 1),
('WRITEOFF', 'Writeoff', 0, 1),
('FORGIVEN', 'Forgiven', 1, 1),
('Rental Fee'),
('Reserve Fee'),
('Hold Expired'),
+('Overpayment'),
('OVERDUE_INCREASE'),
('OVERDUE_DECREASE'),
('OVERDUE'),
[%- CASE 'FORGIVEN' -%]Forgiven
[%- CASE 'CREDIT' -%]Credit
[%- CASE 'LOST_FOUND' -%]Lost item fee refund
+ [%- CASE 'OVERPAYMENT' -%]Overpayment refund
[%- CASE 'REFUND' -%]Refund
[%- CASE -%][% account.credit_type.description | html %]
[%- END -%]
[%- CASE 'FORGIVEN' -%]Forgiven
[%- CASE 'CREDIT' -%]Credit
[%- CASE 'LOST_FOUND' -%]Lost item fee refund
+ [%- CASE 'OVERPAYMENT' -%]Overpayment refund
[%- CASE 'REFUND' -%]Refund
[%- CASE -%][% account.credit_type.description | html %]
[%- END -%]
my $overpayment_refund = $account->lines->last;
is( $overpayment_refund->amount * 1, -10, 'A new credit has been added' );
- is( $overpayment_refund->description, 'Overpayment refund', 'Credit generated with the expected description' );
+ is( $overpayment_refund->credit_type_code, 'OVERPAYMENT', 'Credit generated with the expected credit_type_code' );
$schema->storage->txn_rollback;
};