Bug 31095: Add restrictions accessor to Koha::Patron
authorMartin Renvoize <martin.renvoize@ptfs-europe.com>
Wed, 24 Aug 2022 15:00:52 +0000 (16:00 +0100)
committerTomas Cohen Arazi <tomascohen@theke.io>
Tue, 31 Jan 2023 13:19:23 +0000 (10:19 -0300)
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Koha/Patron.pm

index 96a72a3..26aa414 100644 (file)
@@ -51,6 +51,7 @@ use Koha::Patron::Images;
 use Koha::Patron::Messages;
 use Koha::Patron::Modifications;
 use Koha::Patron::Relationships;
+use Koha::Patron::Restrictions;
 use Koha::Patrons;
 use Koha::Plugins;
 use Koha::Recalls;
@@ -1256,6 +1257,21 @@ sub overdues {
     );
 }
 
+
+=head3 restrictions
+
+  my $restrictions = $patron->restrictions;
+
+Returns the patron restrictions.
+
+=cut
+
+sub restrictions {
+    my ($self) = @_;
+    my $restrictions_rs = $self->_result->borrower_debarments;
+    return Koha::Patron::Restrictions->_new_from_dbic($restrictions_rs);
+}
+
 =head3 get_routing_lists
 
 my $routinglists = $patron->get_routing_lists