From 8bc9fe81900e92389a48ddf83c001d1ff11b44c1 Mon Sep 17 00:00:00 2001 From: Pedro Amorim Date: Tue, 1 Apr 2025 12:14:28 +0000 Subject: [PATCH] Bug 38339: Preparation: Access value of attribute by its key, not by display label This ensures the value of the intended attribute is displayed, regardless of its translatable description --- Koha/ILL/Request.pm | 15 +++++++++++++++ .../bootstrap/en/modules/opac-illrequests.tt | 4 ++-- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/Koha/ILL/Request.pm b/Koha/ILL/Request.pm index c57400cb03f..5ab32868378 100644 --- a/Koha/ILL/Request.pm +++ b/Koha/ILL/Request.pm @@ -1235,6 +1235,21 @@ sub getPrefix { return $brn_prefixes->{ $params->{branch} } || ""; # "the empty prefix" } +=head3 get_extended_attribute_value + + my $type = $request->get_extended_attribute_value('title'); + +Return the Koha::ILL::Request::Attribute->value for the requested attribute type + +=cut + +sub get_extended_attribute_value { + my ( $self, $type ) = @_; + my $attr = $self->extended_attributes->find( { type => $type } ); + return if !$attr; + return $attr->value; +} + =head3 get_type my $type = $abstract->get_type(); diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-illrequests.tt b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-illrequests.tt index b3a5bfad6c1..1fae11c5823 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-illrequests.tt +++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-illrequests.tt @@ -151,8 +151,8 @@ [% type = request.get_type %] [% request.id | html %] - [% IF request.metadata.Author %][% request.metadata.Author | html %][% ELSE %]N/A[% END %] - [% IF request.metadata.Title %][% request.metadata.Title | html %][% ELSE %]N/A[% END %] + [% IF request.get_extended_attribute_value('author') %][% request.get_extended_attribute_value('author') | html %][% ELSE %]N/A[% END %] + [% IF request.get_extended_attribute_value('title') %][% request.get_extended_attribute_value('title') | html %][% ELSE %]N/A[% END %] [% request.backend | html %] [% IF type %][% type | html %][% ELSE %]N/A[% END %] [% request.status_alias ? request.statusalias.lib_opac : request.capabilities.$status.name | html %] -- 2.39.5