From eac997ceda54aa570b93a356d9c80ecc2f9833fd Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Fri, 16 Apr 2021 12:12:41 +0200 Subject: [PATCH] Bug 28156: Rename Koha::Account::Line->renewal with is_renewal MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit It's a boolean, it must be named is_* Test plan: Confirm that prove t/db_dependent/Koha/Account/Line.t is still returning green Signed-off-by: Owen Leonard Signed-off-by: Joonas Kylmälä Signed-off-by: Jonathan Druart (cherry picked from commit 491147896d5cced31861243b862e403f09d62d98) Signed-off-by: Fridolin Somers (cherry picked from commit 9d3ea2bd4930864bd1d6234aa2b6faf0be2a39b1) Signed-off-by: Andrew Fuerste-Henry --- Koha/Account.pm | 4 ++-- Koha/Account/Line.pm | 10 +++++----- t/db_dependent/Koha/Account/Line.t | 8 ++++---- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/Koha/Account.pm b/Koha/Account.pm index e41380c291..bc9d3e98e7 100644 --- a/Koha/Account.pm +++ b/Koha/Account.pm @@ -128,7 +128,7 @@ sub pay { # Attempt to renew the item associated with this debit if # appropriate - if ($fine->renewable) { + if ($fine->is_renewable) { # We're ignoring the definition of $interface above, by all # accounts we can't rely on C4::Context::interface, so here # we're only using what we've been explicitly passed @@ -203,7 +203,7 @@ sub pay { # If we need to make a note of the item associated with this line, # in order that we can potentially renew it, do so. my $amt = $old_amountoutstanding - $amount_to_pay; - if ( $fine->renewable ) { + if ( $fine->is_renewable ) { my $outcome = $fine->renew_item({ interface => $interface }); push @{$renew_outcomes}, $outcome if $outcome; } diff --git a/Koha/Account/Line.pm b/Koha/Account/Line.pm index d40e386001..c2c81aed67 100644 --- a/Koha/Account/Line.pm +++ b/Koha/Account/Line.pm @@ -500,7 +500,7 @@ sub apply { # Attempt to renew the item associated with this debit if # appropriate - if ( $self->credit_type_code ne 'FORGIVEN' && $debit->renewable ) { + if ( $self->credit_type_code ne 'FORGIVEN' && $debit->is_renewable ) { $debit->renew_item( { interface => $params->{interface} } ); } @@ -792,13 +792,13 @@ sub to_api_mapping { } -=head3 renewable +=head3 is_renewable - my $bool = $line->renewable; + my $bool = $line->is_renewable; =cut -sub renewable { +sub is_renewable { my ($self) = @_; return ( @@ -818,7 +818,7 @@ sub renewable { Conditionally attempt to renew an item and return the outcome. This is as a consequence of the fine on an item being fully paid off. -Caller must call renewable before. +Caller must call is_renewable before. =cut diff --git a/t/db_dependent/Koha/Account/Line.t b/t/db_dependent/Koha/Account/Line.t index 336f7d56a2..6ced985eb9 100644 --- a/t/db_dependent/Koha/Account/Line.t +++ b/t/db_dependent/Koha/Account/Line.t @@ -444,15 +444,15 @@ subtest 'Renewal related tests' => sub { interface => 'commandline', })->store; - is( $line->renewable, 1, "Item is returned as renewable when it meets the conditions" ); + is( $line->is_renewable, 1, "Item is returned as renewable when it meets the conditions" ); $line->amountoutstanding(5); - is( $line->renewable, 0, "Item is returned as unrenewable when it has outstanding fine" ); + is( $line->is_renewable, 0, "Item is returned as unrenewable when it has outstanding fine" ); $line->amountoutstanding(0); $line->debit_type_code("VOID"); - is( $line->renewable, 0, "Item is returned as unrenewable when it has the wrong account type" ); + is( $line->is_renewable, 0, "Item is returned as unrenewable when it has the wrong account type" ); $line->debit_type_code("OVERDUE"); $line->status("RETURNED"); - is( $line->renewable, 0, "Item is returned as unrenewable when it has the wrong account status" ); + is( $line->is_renewable, 0, "Item is returned as unrenewable when it has the wrong account status" ); t::lib::Mocks::mock_preference( 'RenewAccruingItemWhenPaid', 0 ); -- 2.39.5