From e71834dd0cd0c55c58d840f1eea87b3be2039fce Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Tue, 12 Jul 2016 20:29:15 +0100 Subject: [PATCH] Bug 16911: Rename extend_subscription with renew_account --- Koha/Patron.pm | 6 +++--- members/setstatus.pl | 2 +- t/db_dependent/Koha/Patrons.t | 10 +++++----- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/Koha/Patron.pm b/Koha/Patron.pm index aaff883..89a0a26 100644 --- a/Koha/Patron.pm +++ b/Koha/Patron.pm @@ -170,15 +170,15 @@ sub do_check_for_previous_checkout { return $old_issues->count; # 0 || N } -=head3 extend_subscription +=head3 renew_account -my $new_expiry_date = $patron->extend_subscription +my $new_expiry_date = $patron->renew_account Extending the subscription to the expiry date. =cut -sub extend_subscription { +sub renew_account { my ($self) = @_; my $date = diff --git a/members/setstatus.pl b/members/setstatus.pl index e607e50..f00bcba 100755 --- a/members/setstatus.pl +++ b/members/setstatus.pl @@ -47,7 +47,7 @@ my $dateexpiry; if ( $reregistration eq 'y' ) { # re-reregistration function to automatic calcul of date expiry - $dateexpiry = Koha::Patrons->find( $borrowernumber )->extend_subscription; + $dateexpiry = Koha::Patrons->find( $borrowernumber )->renew_account; } else { my $sth = $dbh->prepare("UPDATE borrowers SET debarred = ?, debarredcomment = '' WHERE borrowernumber = ?"); $sth->execute( $status, $borrowernumber ); diff --git a/t/db_dependent/Koha/Patrons.t b/t/db_dependent/Koha/Patrons.t index 644f22e..436925b 100644 --- a/t/db_dependent/Koha/Patrons.t +++ b/t/db_dependent/Koha/Patrons.t @@ -103,7 +103,7 @@ subtest 'siblings' => sub { $retrieved_guarantee_1->delete; }; -subtest 'extend_subscription' => sub { +subtest 'renew_account' => sub { plan tests => 6; my $a_month_ago = dt_from_string->add( months => -1 )->truncate( to => 'day' ); my $a_year_later = dt_from_string->add( months => 12 )->truncate( to => 'day' ); @@ -128,21 +128,21 @@ subtest 'extend_subscription' => sub { t::lib::Mocks::mock_preference( 'BorrowerRenewalPeriodBase', 'dateexpiry' ); t::lib::Mocks::mock_preference( 'BorrowersLog', 1 ); - my $expiry_date = $retrieved_patron->extend_subscription; + my $expiry_date = $retrieved_patron->renew_account; is( $expiry_date, $a_year_later_minus_a_month, ); my $retrieved_expiry_date = Koha::Patrons->find( $patron->{borrowernumber} )->dateexpiry; is( dt_from_string($retrieved_expiry_date), $a_year_later_minus_a_month ); my $number_of_logs = $schema->resultset('ActionLog')->search( { module => 'MEMBERS', action => 'RENEW', object => $retrieved_patron->borrowernumber } )->count; - is( $number_of_logs, 1, 'With BorrowerLogs, Koha::Patron->extend_subscription should have logged' ); + is( $number_of_logs, 1, 'With BorrowerLogs, Koha::Patron->renew_account should have logged' ); t::lib::Mocks::mock_preference( 'BorrowerRenewalPeriodBase', 'now' ); t::lib::Mocks::mock_preference( 'BorrowersLog', 0 ); - $expiry_date = $retrieved_patron->extend_subscription; + $expiry_date = $retrieved_patron->renew_account; is( $expiry_date, $a_year_later, ); $retrieved_expiry_date = Koha::Patrons->find( $patron->{borrowernumber} )->dateexpiry; is( dt_from_string($retrieved_expiry_date), $a_year_later ); $number_of_logs = $schema->resultset('ActionLog')->search( { module => 'MEMBERS', action => 'RENEW', object => $retrieved_patron->borrowernumber } )->count; - is( $number_of_logs, 1, 'Without BorrowerLogs, Koha::Patron->extend_subscription should not have logged' ); + is( $number_of_logs, 1, 'Without BorrowerLogs, Koha::Patron->renew_account should not have logged' ); $retrieved_patron->delete; }; -- 2.8.1