@@ -, +, @@ --- Koha/Account.pm | 4 ++- Koha/Account/Line.pm | 3 +-- installer/data/mysql/account_credit_types.sql | 1 + installer/data/mysql/account_offset_types.sql | 1 + .../data/mysql/atomicupdate/bug_25596.perl | 25 +++++++++++++++++++ .../prog/en/includes/accounts.inc | 1 + .../bootstrap/en/includes/account-table.inc | 1 + 7 files changed, 33 insertions(+), 3 deletions(-) create mode 100644 installer/data/mysql/atomicupdate/bug_25596.perl --- a/Koha/Account.pm +++ a/Koha/Account.pm @@ -358,9 +358,10 @@ my $credit_line = Koha::Account->new({ patron_id => $patron_id })->add_credit( $credit_type can be any of: - 'CREDIT' - - 'PAYMENT' - 'FORGIVEN' - 'LOST_FOUND' + - 'OVERPAYMENT' + - 'PAYMENT' - 'WRITEOFF' =cut @@ -776,6 +777,7 @@ our $offset_type = { 'CREDIT' => 'Manual Credit', 'FORGIVEN' => 'Writeoff', 'LOST_FOUND' => 'Lost Item Found', + 'OVERPAYMENT' => 'Overpayment Refund', 'PAYMENT' => 'Payment', 'WRITEOFF' => 'Writeoff', 'ACCOUNT' => 'Account Fee', --- a/Koha/Account/Line.pm +++ a/Koha/Account/Line.pm @@ -695,8 +695,7 @@ sub adjust { 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 ) : ()), } --- a/installer/data/mysql/account_credit_types.sql +++ a/installer/data/mysql/account_credit_types.sql @@ -1,4 +1,5 @@ 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), --- a/installer/data/mysql/account_offset_types.sql +++ a/installer/data/mysql/account_offset_types.sql @@ -14,6 +14,7 @@ INSERT INTO account_offset_types ( type ) VALUES ('Rental Fee'), ('Reserve Fee'), ('Hold Expired'), +('Overpayment Refund'), ('OVERDUE_INCREASE'), ('OVERDUE_DECREASE'), ('OVERDUE'), --- a/installer/data/mysql/atomicupdate/bug_25596.perl +++ a/installer/data/mysql/atomicupdate/bug_25596.perl @@ -0,0 +1,25 @@ +$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 Refund'); + } + ); + + $dbh->do( + qq{ + UPDATE accountlines SET credit_type = 'OVERPAYMENT' WHERE credit_type = 'CREDIT' AND description = 'Overpayment refund' + } + ); + + NewVersion( $DBversion, 25596, "Add OVERPAYMENT credit type" ); +} --- a/koha-tmpl/intranet-tmpl/prog/en/includes/accounts.inc +++ a/koha-tmpl/intranet-tmpl/prog/en/includes/accounts.inc @@ -7,6 +7,7 @@ [%- 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 -%] --- a/koha-tmpl/opac-tmpl/bootstrap/en/includes/account-table.inc +++ a/koha-tmpl/opac-tmpl/bootstrap/en/includes/account-table.inc @@ -179,6 +179,7 @@ [%- CASE 'FORGIVEN' -%]Forgiven [%- CASE 'CREDIT' -%]Credit [%- CASE 'LOST_FOUND' -%]Lost item fee refund + [%- CASE 'OVERPAYMENT' -%]Overpayment refund [%- CASE -%][% account.credit_type.description | html %] [%- END -%] [%- ELSIF account.debit_type_code -%] --