Bug 16911: Rename extend_subscription with renew_account
Signed-off-by: Aleisha Amohia <aleishaamohia@hotmail.com> Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
This commit is contained in:
parent
e4e90ea0da
commit
f48409bb8d
|
|
@ -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 =
|
||||
|
|
|
|||
|
|
@ -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 );
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
};
|
||||
|
|
|
|||
Loading…
Reference in New Issue