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

(-)a/Koha/Account.pm (-1 / +3 lines)
Lines 358-366 my $credit_line = Koha::Account->new({ patron_id => $patron_id })->add_credit( Link Here
358
358
359
$credit_type can be any of:
359
$credit_type can be any of:
360
  - 'CREDIT'
360
  - 'CREDIT'
361
  - 'PAYMENT'
362
  - 'FORGIVEN'
361
  - 'FORGIVEN'
363
  - 'LOST_FOUND'
362
  - 'LOST_FOUND'
363
  - 'OVERPAYMENT'
364
  - 'PAYMENT'
364
  - 'WRITEOFF'
365
  - 'WRITEOFF'
365
366
366
=cut
367
=cut
Lines 776-781 our $offset_type = { Link Here
776
    'CREDIT'           => 'Manual Credit',
777
    'CREDIT'           => 'Manual Credit',
777
    'FORGIVEN'         => 'Writeoff',
778
    'FORGIVEN'         => 'Writeoff',
778
    'LOST_FOUND'       => 'Lost Item Found',
779
    'LOST_FOUND'       => 'Lost Item Found',
780
    'OVERPAYMENT'      => 'Overpayment',
779
    'PAYMENT'          => 'Payment',
781
    'PAYMENT'          => 'Payment',
780
    'WRITEOFF'         => 'Writeoff',
782
    'WRITEOFF'         => 'Writeoff',
781
    'ACCOUNT'          => 'Account Fee',
783
    'ACCOUNT'          => 'Account Fee',
(-)a/Koha/Account/Line.pm (-2 / +1 lines)
Lines 695-702 sub adjust { Link Here
695
                my $credit = $account->add_credit(
695
                my $credit = $account->add_credit(
696
                    {
696
                    {
697
                        amount      => $new_outstanding * -1,
697
                        amount      => $new_outstanding * -1,
698
                        description => 'Overpayment refund',
698
                        type        => 'OVERPAYMENT',
699
                        type        => 'CREDIT',
700
                        interface   => $interface,
699
                        interface   => $interface,
701
                        ( $update_type eq 'overdue_update' ? ( item_id => $self->itemnumber ) : ()),
700
                        ( $update_type eq 'overdue_update' ? ( item_id => $self->itemnumber ) : ()),
702
                    }
701
                    }
(-)a/installer/data/mysql/account_credit_types.sql (+1 lines)
Lines 1-4 Link Here
1
INSERT INTO account_credit_types ( code, description, can_be_added_manually, is_system ) VALUES
1
INSERT INTO account_credit_types ( code, description, can_be_added_manually, is_system ) VALUES
2
('OVERPAYMENT', 'Overpayment refund', 0, 1),
2
('PAYMENT', 'Payment', 0, 1),
3
('PAYMENT', 'Payment', 0, 1),
3
('WRITEOFF', 'Writeoff', 0, 1),
4
('WRITEOFF', 'Writeoff', 0, 1),
4
('FORGIVEN', 'Forgiven', 1, 1),
5
('FORGIVEN', 'Forgiven', 1, 1),
(-)a/installer/data/mysql/account_offset_types.sql (+1 lines)
Lines 14-19 INSERT INTO account_offset_types ( type ) VALUES Link Here
14
('Rental Fee'),
14
('Rental Fee'),
15
('Reserve Fee'),
15
('Reserve Fee'),
16
('Hold Expired'),
16
('Hold Expired'),
17
('Overpayment'),
17
('OVERDUE_INCREASE'),
18
('OVERDUE_INCREASE'),
18
('OVERDUE_DECREASE'),
19
('OVERDUE_DECREASE'),
19
('OVERDUE'),
20
('OVERDUE'),
(-)a/installer/data/mysql/atomicupdate/bug_25596.perl (+25 lines)
Line 0 Link Here
1
$DBversion = 'XXX';    # will be replaced by the RM
2
if ( CheckVersion($DBversion) ) {
3
4
    $dbh->do(
5
        qq{
6
            INSERT IGNORE INTO account_credit_types (code, description, can_be_added_manually, is_system)
7
            VALUES
8
              ('OVERPAYMENT', 'Overpayment refund', 0, 1)
9
        }
10
    );
11
12
    $dbh->do(
13
        qq{
14
            INSERT IGNORE INTO account_offset_types ( type ) VALUES ('Overpayment');
15
        }
16
    );
17
18
    $dbh->do(
19
        qq{
20
            UPDATE accountlines SET credit_type = 'OVERPAYMENT' WHERE credit_type = 'CREDIT' AND description = 'Overpayment refund'
21
        }
22
    );
23
24
    NewVersion( $DBversion, 25596, "Add OVERPAYMENT credit type" );
25
}
(-)a/koha-tmpl/intranet-tmpl/prog/en/includes/accounts.inc (+1 lines)
Lines 7-12 Link Here
7
            [%- CASE 'FORGIVEN'         -%]Forgiven
7
            [%- CASE 'FORGIVEN'         -%]Forgiven
8
            [%- CASE 'CREDIT'           -%]Credit
8
            [%- CASE 'CREDIT'           -%]Credit
9
            [%- CASE 'LOST_FOUND'       -%]Lost item fee refund
9
            [%- CASE 'LOST_FOUND'       -%]Lost item fee refund
10
            [%- CASE 'OVERPAYMENT'      -%]Overpayment refund
10
            [%- CASE 'Refund'           -%]Refund
11
            [%- CASE 'Refund'           -%]Refund
11
            [%- CASE                    -%][% account.credit_type.description | html %]
12
            [%- CASE                    -%][% account.credit_type.description | html %]
12
        [%- END -%]
13
        [%- END -%]
(-)a/koha-tmpl/opac-tmpl/bootstrap/en/includes/account-table.inc (+1 lines)
Lines 179-184 Link Here
179
                [%- CASE 'FORGIVEN'         -%]Forgiven
179
                [%- CASE 'FORGIVEN'         -%]Forgiven
180
                [%- CASE 'CREDIT'           -%]Credit
180
                [%- CASE 'CREDIT'           -%]Credit
181
                [%- CASE 'LOST_FOUND'       -%]Lost item fee refund
181
                [%- CASE 'LOST_FOUND'       -%]Lost item fee refund
182
                [%- CASE 'OVERPAYMENT'      -%]Overpayment refund
182
                [%- CASE                    -%][% account.credit_type.description | html %]
183
                [%- CASE                    -%][% account.credit_type.description | html %]
183
            [%- END -%]
184
            [%- END -%]
184
        [%- ELSIF account.debit_type_code -%]
185
        [%- ELSIF account.debit_type_code -%]
(-)a/t/db_dependent/Koha/Account/Line.t (-2 / +1 lines)
Lines 570-576 subtest 'adjust() tests' => sub { Link Here
570
570
571
    my $overpayment_refund = $account->lines->last;
571
    my $overpayment_refund = $account->lines->last;
572
    is( $overpayment_refund->amount * 1, -10, 'A new credit has been added' );
572
    is( $overpayment_refund->amount * 1, -10, 'A new credit has been added' );
573
    is( $overpayment_refund->description, 'Overpayment refund', 'Credit generated with the expected description' );
573
    is( $overpayment_refund->credit_type_code, 'OVERPAYMENT', 'Credit generated with the expected credit_type_code' );
574
574
575
    $schema->storage->txn_rollback;
575
    $schema->storage->txn_rollback;
576
};
576
};
577
- 

Return to bug 25596