Bug 31095: Add type relation accessor to Koha::Patron::Restriction
authorMartin Renvoize <martin.renvoize@ptfs-europe.com>
Wed, 24 Aug 2022 15:01:27 +0000 (16:01 +0100)
committerTomas Cohen Arazi <tomascohen@theke.io>
Tue, 31 Jan 2023 13:19:24 +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/Restriction.pm

index 16e7c6f..645212a 100644 (file)
@@ -18,6 +18,7 @@ package Koha::Patron::Restriction;
 use Modern::Perl;
 
 use Koha::Database;
+use Koha::Patron::Restriction::Type;
 
 use base qw(Koha::Object);
 
@@ -29,6 +30,22 @@ Koha::Patron::Restriction - Koha Patron::Restriction Object class
 
 =head2 Class methods
 
+=head2 Relation accessors
+
+=head3 type
+
+  my $restriction_type = $restriction->type;
+
+Returns the restriction type
+
+=cut
+
+sub type {
+    my ($self) = @_;
+    my $type_rs = $self->_result->type;
+    return Koha::Patron::Restriction::Type->_new_from_dbic($type_rs);
+}
+
 =head2 Internal methods
 
 =head3 _type