Bug 22694: Add Koha::Patron::Category->override_hidden_items
[koha-equinox.git] / Koha / Patron / Category.pm
index 261b232..f102c6e 100644 (file)
@@ -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