From 0a22e3127d90c9d76734b223523e0635b18cb32d Mon Sep 17 00:00:00 2001 From: Martin Renvoize Date: Tue, 23 Apr 2019 15:49:28 +0100 Subject: [PATCH] Bug 22694: Add Koha::Patron::Category->override_hidden_items This patch introduces a method to determine for a given category if patrons belonging to it override OpacHiddenItems policies. To test: - Apply the patches - Run: $ kshell k$ prove t/db_dependent/Koha/Patron/Category.t => SUCCESS: Tests pass! - Sign off :-D Signed-off-by: Bin Wen Signed-off-by: Martin Renvoize Signed-off-by: Nick Clemens --- Koha/Patron/Category.pm | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/Koha/Patron/Category.pm b/Koha/Patron/Category.pm index 261b232d33..f102c6ee80 100644 --- a/Koha/Patron/Category.pm +++ b/Koha/Patron/Category.pm @@ -18,6 +18,7 @@ package Koha::Patron::Category; use Modern::Perl; use Carp; +use List::MoreUtils qw(any); use C4::Members::Messaging; @@ -254,6 +255,24 @@ sub effective_change_password { : C4::Context->preference('OpacPasswordChange'); } +=head3 override_hidden_items + + if ( $patron->category->override_hidden_items ) { + ... + } + +Returns a boolean that if patrons of this category are exempt from the OPACHiddenItems policies + +TODO: Remove on bug 22547 + +=cut + +sub override_hidden_items { + my ($self) = @_; + return any { $_ eq $self->categorycode } + split( /\|/, C4::Context->preference('OpacHiddenItemsExceptions') ); +} + =head2 Internal methods =head3 type -- 2.39.5