From c88b344cac9f8adfaadba56a3f78b43e3feb5b7b Mon Sep 17 00:00:00 2001 From: Marcel de Rooy Date: Fri, 29 Nov 2019 10:57:18 +0000 Subject: [PATCH] Bug 18355: (QA follow-up) Rearrange comments, improve code Content-Type: text/plain; charset=utf-8 Comments were hard to read (for me) but tastes differ.. Code should reflect that permanent_location is a code and that location may be already an authval. See detail.pl: $item->{'location'} = $shelflocations->{$shelfcode} if ( defined( $shelfcode ) && defined($shelflocations) && exists( $shelflocations->{$shelfcode} ) ); Obviously, this kind of logic divided over two places should be reduced. Signed-off-by: Marcel de Rooy --- .../prog/en/modules/catalogue/detail.tt | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt index c221982dd9..9a0495b12d 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt @@ -267,19 +267,18 @@ [% Branches.GetName(item.homebranch) | html %] - [%# 1 - If permanent location is defined %] - [%# a - display the description if available, display the code if not %] - [%# b - display the current location in parens %] - [%# 2 - If permanent location is not defined, but location is defined %] - [%# a - display the current location description if available, display the code if not %] - [%# 3 - If neither are defined, show nothing %] + [% IF item.permanent_location %] - [% AuthorisedValues.GetDescriptionByKohaField( kohafield => 'items.location', authorised_value => item.permanent_location ) | html %] - [% IF item.location AND item.location != item.permanent_location %] - ([% AuthorisedValues.GetDescriptionByKohaField( kohafield => 'items.location', authorised_value => item.location ) | html %]) + [% SET permloc_authval = AuthorisedValues.GetDescriptionByKohaField( kohafield => 'items.location', authorised_value => item.permanent_location ) %] + [% permloc_authval | html %] + [% IF item.location AND item.location != permloc_authval AND item.location != item.permanent_location %] + ([% item.location | html %]) [% END %] - [% ELSIF item.location %] - [% AuthorisedValues.GetDescriptionByKohaField( kohafield => 'items.location', authorised_value => item.permanent_location ) | html %] + [% ELSE %] + [% item.location | html %] [% END %] -- 2.11.0