@@ -, +, @@ consistency - The POD is enhanced based on the proposal in bug 11983. - The introduced offset type value is made consistent with the rest of --- Koha/Account/Line.pm | 17 +++++++++++++++-- installer/data/mysql/account_offset_types.sql | 2 +- .../data/mysql/atomicupdate/bug_20997.perl | 2 +- t/db_dependent/Koha/Account/Lines.t | 2 +- 4 files changed, 18 insertions(+), 5 deletions(-) --- a/Koha/Account/Line.pm +++ a/Koha/Account/Line.pm @@ -129,7 +129,20 @@ sub void { =head3 apply my $debits = $account->outstanding_debits; - my $outstanding_amount = $credit->apply({ debits => $debits, [ offset_type => $offset_type ] }); + my $outstanding_amount = $credit->apply( { debits => $debits, [ offset_type => $offset_type ] } ); + +Applies the credit to a given debits set. + +=head4 arguments hashref + +=over 4 + +=item debits - Koha::Account::Lines object set of debits + +=item offset_type (optional) - a string indicating the offset type (valid values are those from +the 'account_offset_types' table) + +=back =cut @@ -137,7 +150,7 @@ sub apply { my ( $self, $params ) = @_; my $debits = $params->{debits}; - my $offset_type = $params->{offset_type} // 'credit_applied'; + my $offset_type = $params->{offset_type} // 'Credit Applied'; unless ( $self->is_credit ) { Koha::Exceptions::Account::IsNotCredit->throw( --- a/installer/data/mysql/account_offset_types.sql +++ a/installer/data/mysql/account_offset_types.sql @@ -12,4 +12,4 @@ INSERT INTO account_offset_types ( type ) VALUES ('Fine Update'), ('Fine'), ('Void Payment'), -('credit_applied'); +('Credit Applied'); --- a/installer/data/mysql/atomicupdate/bug_20997.perl +++ a/installer/data/mysql/atomicupdate/bug_20997.perl @@ -3,7 +3,7 @@ if( CheckVersion( $DBversion ) ) { # Add 'credit_applied' offset type $dbh->do(q{ - INSERT IGNORE INTO `account_offset_types` (`type`) VALUES ('credit_applied'); + INSERT IGNORE INTO `account_offset_types` (`type`) VALUES ('Credit Applied'); }); SetVersion( $DBversion ); --- a/t/db_dependent/Koha/Account/Lines.t +++ a/t/db_dependent/Koha/Account/Lines.t @@ -217,7 +217,7 @@ subtest 'apply() tests' => sub { is( $offsets->count, 1, 'Only one offset is generated' ); $THE_offset = $offsets->next; is( $THE_offset->amount * 1, 90, 'Amount was calculated correctly (less than the available credit)' ); - is( $THE_offset->type, 'credit_applied', 'Defaults to credit_applied offset type' ); + is( $THE_offset->type, 'Credit Applied', 'Defaults to \'Credit Applied\' offset type' ); $debits = Koha::Account::Lines->search({ accountlines_id => $debit_1->id }); throws_ok --