From 80a9a243a45fedc143bef2b533e76886e5327c55 Mon Sep 17 00:00:00 2001 From: Tomas Cohen Arazi Date: Wed, 22 Dec 2021 16:49:43 -0300 Subject: [PATCH] Bug 29757: (QA follow-up) POD fixes This patch adds POD, fixes the existing one in the file, and also renames reversable => reversible as required by the QA scripts. If this name change is problematic, I can revert it and resubmit my follow-up. Signed-off-by: Tomas Cohen Arazi Signed-off-by: Kyle M Hall Signed-off-by: Martin Renvoize Signed-off-by: Fridolin Somers --- Koha/Account/Offsets.pm | 20 ++++++++++++++------ t/db_dependent/Koha/Account/Offsets.t | 22 +++++++++++----------- 2 files changed, 25 insertions(+), 17 deletions(-) diff --git a/Koha/Account/Offsets.pm b/Koha/Account/Offsets.pm index 725d4550d8..660ae5a26e 100644 --- a/Koha/Account/Offsets.pm +++ b/Koha/Account/Offsets.pm @@ -34,14 +34,14 @@ Account offsets track the changes made to the balance of account lines =head2 Class methods +=head3 total + my $offsets = Koha::Account::Offsets->search({ ... }); my $total = $offsets->total; Returns the sum of the amounts of the account offsets resultset. If the resultset is empty it returns 0. -=head3 total - =cut sub total { @@ -60,11 +60,15 @@ sub total { : 0; } -=head3 filter_by_non_reversable +=head3 filter_by_non_reversible + + my $non_reversible = $debit->->search(..)->filter_by_non_reversible; + +Filter offsets so only non-reversible ones are left in the resultset. =cut -sub filter_by_non_reversable { +sub filter_by_non_reversible { my ($self) = @_; my $me = $self->_resultset()->current_source_alias; @@ -82,11 +86,15 @@ sub filter_by_non_reversable { return $self->search( $where, $attr ); } -=head3 filter_by_reversable +=head3 filter_by_reversible + + my $reversible = Koha::Account::Offsets->search(..)->filter_by_reversible; + +Filter offsets so only non ones are left in the resultset. =cut -sub filter_by_reversable { +sub filter_by_reversible { my ($self) = @_; my $me = $self->_resultset()->current_source_alias; diff --git a/t/db_dependent/Koha/Account/Offsets.t b/t/db_dependent/Koha/Account/Offsets.t index 9aea5df7ad..54365f92b0 100755 --- a/t/db_dependent/Koha/Account/Offsets.t +++ b/t/db_dependent/Koha/Account/Offsets.t @@ -73,7 +73,7 @@ subtest 'total() tests' => sub { $schema->storage->txn_rollback; }; -subtest 'filter_by_non_reversable() and filter_by_reversable() tests' => sub { +subtest 'filter_by_non_reversible() and filter_by_reversible() tests' => sub { plan tests => 4; @@ -90,16 +90,16 @@ subtest 'filter_by_non_reversable() and filter_by_reversable() tests' => sub { $account->pay( { amount => 4, type => 'PAYMENT' } ); $account->pay( { amount => 5, type => 'CREDIT' } ); - # non-reversable offsets - is( $manual_fee->debit_offsets->filter_by_non_reversable->count, - 3, '3 non-reversable offsets' ); - is( $manual_fee->debit_offsets->filter_by_non_reversable->total, - -6, '-6 the total amount of the non-reversable offsets' ); - # reversable offsets - is( $manual_fee->debit_offsets->filter_by_reversable->count, - 2, 'The right reversable offsets count' ); - is( $manual_fee->debit_offsets->filter_by_reversable->total, - -5, 'The right total amount of the reversable offsets' ); + # non-reversible offsets + is( $manual_fee->debit_offsets->filter_by_non_reversible->count, + 3, '3 non-reversible offsets' ); + is( $manual_fee->debit_offsets->filter_by_non_reversible->total, + -6, '-6 the total amount of the non-reversible offsets' ); + # reversible offsets + is( $manual_fee->debit_offsets->filter_by_reversible->count, + 2, 'The right reversible offsets count' ); + is( $manual_fee->debit_offsets->filter_by_reversible->total, + -5, 'The right total amount of the reversible offsets' ); $schema->storage->txn_rollback; }; -- 2.39.5