From cf1ca2b0d45f0cafff65c5b2141334ad2faf9f61 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 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 --- 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 3916fa76be..6093fe7229 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 87532de479..dbba892790 100644 --- a/Koha/Account/Line.pm +++ b/Koha/Account/Line.pm @@ -596,7 +596,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} } ); } @@ -887,13 +887,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 ( @@ -913,7 +913,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 da40474a9b..dcc08aaae0 100755 --- a/t/db_dependent/Koha/Account/Line.t +++ b/t/db_dependent/Koha/Account/Line.t @@ -441,15 +441,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.20.1