From f78d1567a2d31ebc812506754e12cb26427bbb28 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 --- Koha/Patron/Restriction.pm | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/Koha/Patron/Restriction.pm b/Koha/Patron/Restriction.pm index e1f54315e4..6106669d98 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.20.1