From 6267cd39cc69029de09061888b68583e4a539b77 Mon Sep 17 00:00:00 2001 From: Martin Renvoize Date: Tue, 7 May 2024 19:40:27 +0100 Subject: [PATCH] Bug 33260: (QA follow-up) Add template relation This patch add the 'template' relation to the Koha::Notice::Message object to fetch the Koha::Notice::Template object that may have been used to generate the notice. Signed-off-by: Martin Renvoize --- Koha/Notice/Message.pm | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/Koha/Notice/Message.pm b/Koha/Notice/Message.pm index 0dd602df2c1..367d0c41b8f 100644 --- a/Koha/Notice/Message.pm +++ b/Koha/Notice/Message.pm @@ -90,9 +90,9 @@ EOS =head3 patron - my $patron = $checkout->patron + my $patron = $message->patron -Return the patron by whom the checkout was done +Return the patron by whom this message is for =cut @@ -103,6 +103,21 @@ sub patron { return Koha::Patron->_new_from_dbic($patron_rs); } +=head3 template + + my $template = $message->template + +Return the template from which this message may have been generated + +=cut + +sub template { + my ($self) = @_; + my $template_rs = $self->_result->letter; + return unless $template_rs; + return Koha::Notice::Template->_new_from_dbic($template_rs); +} + =head3 type =cut -- 2.45.0