Bugzilla – Attachment 55196 Details for
Bug 16911
Koha::Patrons - Move ExtendMemberSubscriptionTo to ->renew_account
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 16911: ->get_expiry_date accepts strings
Bug-16911--getexpirydate-accepts-strings.patch (text/plain), 2.44 KB, created by
Tomás Cohen Arazi (tcohen)
on 2016-09-05 18:24:56 UTC
(
hide
)
Description:
Bug 16911: ->get_expiry_date accepts strings
Filename:
MIME Type:
Creator:
Tomás Cohen Arazi (tcohen)
Created:
2016-09-05 18:24:56 UTC
Size:
2.44 KB
patch
obsolete
>From 296514452ad46ff89a839c8f1de196353c6929cf Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Wed, 20 Jul 2016 19:03:53 +0100 >Subject: [PATCH] Bug 16911: ->get_expiry_date accepts strings > >To make sure nothing else will be broken, it's certainly better to >handle date strings in a first phase. > >Signed-off-by: Aleisha Amohia <aleishaamohia@hotmail.com> >Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> >--- > Koha/Patron/Category.pm | 1 + > t/db_dependent/Koha/Patron/Categories.t | 6 +++++- > 2 files changed, 6 insertions(+), 1 deletion(-) > >diff --git a/Koha/Patron/Category.pm b/Koha/Patron/Category.pm >index 399d329..331a1ce 100644 >--- a/Koha/Patron/Category.pm >+++ b/Koha/Patron/Category.pm >@@ -189,6 +189,7 @@ sub get_expiry_date { > my ($self, $date ) = @_; > if ( $self->enrolmentperiod ) { > $date ||= dt_from_string; >+ $date = dt_from_string( $date ) unless ref $date; > return $date->add( months => $self->enrolmentperiod ); > } else { > return $self->enrolmentperioddate; >diff --git a/t/db_dependent/Koha/Patron/Categories.t b/t/db_dependent/Koha/Patron/Categories.t >index 75f2747..585b940 100644 >--- a/t/db_dependent/Koha/Patron/Categories.t >+++ b/t/db_dependent/Koha/Patron/Categories.t >@@ -56,7 +56,7 @@ is( $retrieved_category_1->checkprevcheckout, 'inherit', 'Koha::Patron::Category > is( $retrieved_category_2->checkprevcheckout, 'inherit', 'Koha::Patron::Category->store should default checkprevcheckout to inherit' ); > > subtest 'get_expiry_date' => sub { >- plan tests => 4; >+ plan tests => 5; > my $next_month = dt_from_string->add( months => 1 ); > my $next_year = dt_from_string->add( months => 12 ); > my $yesterday = dt_from_string->add( days => -1 ); >@@ -73,6 +73,10 @@ subtest 'get_expiry_date' => sub { > $category->enrolmentperiod( 12 )->store; > is( $category->get_expiry_date, $next_year, 'With enrolmentperiod defined and no parameter, ->get_expiry_date should return today + enrolmentperiod' ); > is( $category->get_expiry_date( $yesterday ), $next_year->clone->add( days => -1 ), 'With enrolmentperiod defined and a date given in parameter, ->get_expiry_date should take this date + enrolmentperiod' ); >+ >+ my $hardcoded_date = '2000-01-31'; >+ is( $category->get_expiry_date( $hardcoded_date ), dt_from_string( $hardcoded_date )->add( months => 12 ), 'get_expiry_date accepts strings as well' ); >+ > $category->delete; > }; > >-- >2.7.4
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 16911
:
53338
|
53339
|
53340
|
53341
|
53346
|
53514
|
53515
|
53516
|
53517
|
53518
|
53533
|
54752
|
54753
|
54754
|
54755
|
54756
|
54757
|
54789
|
54790
|
54791
|
54792
|
54793
|
54794
|
55191
|
55192
|
55193
|
55194
|
55195
| 55196 |
55197
|
55424
|
55447