From 540a114d6570adc89cc121c9169cb67f099d8096 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 ff508a3..fc5496f 100644 --- a/Koha/Patron.pm +++ b/Koha/Patron.pm @@ -209,15 +209,15 @@ sub update_password { return 1; } -=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 117ecb4..0f71655 100644 --- a/t/db_dependent/Koha/Patrons.t +++ b/t/db_dependent/Koha/Patrons.t @@ -129,7 +129,7 @@ subtest 'update_password' => sub { is( $number_of_logs, 1, 'With BorrowerLogs, Koha::Patron->update_password should not have logged' ); }; -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' ); @@ -154,21 +154,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