From b1bff0869103777d33cfb682746f16ff9e34e5f1 Mon Sep 17 00:00:00 2001 From: Martin Renvoize Date: Wed, 24 Aug 2022 16:01:27 +0100 Subject: [PATCH] Bug 31095: Add type relation accessor to Koha::Patron::Restriction Signed-off-by: Nick Clemens Signed-off-by: Jonathan Druart Signed-off-by: Tomas Cohen Arazi (cherry picked from commit 55d5e0a40d1d688ddaa734db6ff6a68a977d594f) Signed-off-by: Matt Blenkinsop --- Koha/Patron/Restriction.pm | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/Koha/Patron/Restriction.pm b/Koha/Patron/Restriction.pm index 16e7c6f709..645212a2a8 100644 --- a/Koha/Patron/Restriction.pm +++ b/Koha/Patron/Restriction.pm @@ -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 -- 2.39.5