Bugzilla – Attachment 57497 Details for
Bug 17604
Add the Koha::Patron::Category->effective_BlockExpiredPatronOpacActions method
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 17604: GetMemberDetails - Add Koha::Patron::Category->effective_BlockExpiredPatronOpacActions
Bug-17604-GetMemberDetails---Add-KohaPatronCategor.patch (text/plain), 2.90 KB, created by
Kyle M Hall (khall)
on 2016-11-15 15:22:11 UTC
(
hide
)
Description:
Bug 17604: GetMemberDetails - Add Koha::Patron::Category->effective_BlockExpiredPatronOpacActions
Filename:
MIME Type:
Creator:
Kyle M Hall (khall)
Created:
2016-11-15 15:22:11 UTC
Size:
2.90 KB
patch
obsolete
>From 81ea88fff6bfffd958cc0a85871e1487b05a445a Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Mon, 7 Nov 2016 15:47:43 +0000 >Subject: [PATCH] Bug 17604: GetMemberDetails - Add > Koha::Patron::Category->effective_BlockExpiredPatronOpacActions > >This patch simply adds a new method to retrieve the correct value of >BlockExpiredPatronOpacActions. > >Test plan: > prove t/db_dependent/Koha/Patron/Categories.t >should return green > >Signed-off-by: Josef Moravec <josef.moravec@gmail.com> > >Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> >--- > Koha/Patron/Category.pm | 14 ++++++++++++++ > t/db_dependent/Koha/Patron/Categories.t | 19 ++++++++++++++++++- > 2 files changed, 32 insertions(+), 1 deletion(-) > >diff --git a/Koha/Patron/Category.pm b/Koha/Patron/Category.pm >index 7b8c07e..b1244d5 100644 >--- a/Koha/Patron/Category.pm >+++ b/Koha/Patron/Category.pm >@@ -36,6 +36,20 @@ Koha::Patron;;Category - Koha Patron;;Category Object class > > =cut > >+=head3 effective_BlockExpiredPatronOpacActions >+ >+my $BlockExpiredPatronOpacActions = $category->effective_BlockExpiredPatronOpacActions >+ >+Return the effective BlockExpiredPatronOpacActions value. >+ >+=cut >+ >+sub effective_BlockExpiredPatronOpacActions { >+ my( $self) = @_; >+ return C4::Context->preference('BlockExpiredPatronOpacActions') if $self->BlockExpiredPatronOpacActions == -1; >+ return $self->BlockExpiredPatronOpacActions >+} >+ > =head3 default_messaging > > my $messaging = $category->default_messaging(); >diff --git a/t/db_dependent/Koha/Patron/Categories.t b/t/db_dependent/Koha/Patron/Categories.t >index b47bcff..58670f7 100644 >--- a/t/db_dependent/Koha/Patron/Categories.t >+++ b/t/db_dependent/Koha/Patron/Categories.t >@@ -19,7 +19,7 @@ > > use Modern::Perl; > >-use Test::More tests => 8; >+use Test::More tests => 9; > > use C4::Context; > use Koha::Database; >@@ -27,6 +27,7 @@ use Koha::DateUtils; > use Koha::Patron::Category; > use Koha::Patron::Categories; > use t::lib::TestBuilder; >+use t::lib::Mocks; > > my $schema = Koha::Database->new->schema; > $schema->storage->txn_begin; >@@ -83,6 +84,22 @@ subtest 'get_expiry_date' => sub { > $category->delete; > }; > >+subtest 'BlockExpiredPatronOpacActions' => sub { >+ plan tests => 2; >+ t::lib::Mocks::mock_preference('BlockExpiredPatronOpacActions', 42); >+ my $category = Koha::Patron::Category->new({ >+ categorycode => 'ya_cat', >+ category_type => 'A', >+ description => 'yacatdesc', >+ enrolmentperiod => undef, >+ BlockExpiredPatronOpacActions => -1, >+ })->store; >+ is( $category->effective_BlockExpiredPatronOpacActions, 42 ); >+ $category->BlockExpiredPatronOpacActions(24)->store; >+ is( $category->effective_BlockExpiredPatronOpacActions, 24 ); >+ $category->delete; >+}; >+ > $retrieved_category_1->delete; > is( Koha::Patron::Categories->search->count, $nb_of_categories + 1, 'Delete should have deleted the patron category' ); > >-- >2.1.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 17604
:
57413
|
57477
| 57497