From a67fdf3bd498bf1c5a90c2847570ea8eff9c52da Mon Sep 17 00:00:00 2001 From: Kyle M Hall Date: Fri, 9 Mar 2018 06:43:18 -0500 Subject: [PATCH] Bug 20341: Use AuthorisedValues plugin on the staff side Signed-off-by: Kyle M Hall Signed-off-by: Jonathan Druart --- catalogue/detail.pl | 15 +---------- .../prog/en/modules/catalogue/detail.tt | 27 +++++++------------ 2 files changed, 10 insertions(+), 32 deletions(-) diff --git a/catalogue/detail.pl b/catalogue/detail.pl index 704c595ac0..b29d858a75 100755 --- a/catalogue/detail.pl +++ b/catalogue/detail.pl @@ -203,20 +203,7 @@ my $copynumbers = my (@itemloop, @otheritemloop, %itemfields); my $norequests = 1; -my $mss = Koha::MarcSubfieldStructures->search({ frameworkcode => $fw, kohafield => 'items.itemlost', authorised_value => { not => undef } }); -if ( $mss->count ) { - $template->param( itemlostloop => GetAuthorisedValues( $mss->next->authorised_value ) ); -} -$mss = Koha::MarcSubfieldStructures->search({ frameworkcode => $fw, kohafield => 'items.damaged', authorised_value => { not => undef } }); -if ( $mss->count ) { - $template->param( itemdamagedloop => GetAuthorisedValues( $mss->next->authorised_value ) ); -} -$mss = Koha::MarcSubfieldStructures->search({ frameworkcode => $fw, kohafield => 'items.withdrawn', authorised_value => { not => undef } }); -if ( $mss->count ) { - $template->param( itemwithdrawnloop => GetAuthorisedValues( $mss->next->authorised_value) ); -} - -$mss = Koha::MarcSubfieldStructures->search({ frameworkcode => $fw, kohafield => 'items.materials', authorised_value => { not => undef } }); +my $mss = Koha::MarcSubfieldStructures->search({ frameworkcode => $fw, kohafield => 'items.materials', authorised_value => { not => undef } }); my %materials_map; if ($mss->count) { my $materials_authvals = GetAuthorisedValues($mss->next->authorised_value); 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 d3b12b455f..635781b25b 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt @@ -393,37 +393,28 @@ In transit from [% Branches.GetName( item.transfertfrom ) %] to [% Branches.GetName( item.transfertto ) %] since [% item.transfertwhen | $KohaDates %] [% END %] + [% itemlost_desc = AuthorisedValues.GetByCode( 'LOST', item.itemlost ) %] [% IF ( item.itemlost ) %] - [% IF itemlostloop %] - [% FOREACH itemlostloo IN itemlostloop %] - [% IF itemlostloo.authorised_value == item.itemlost %] - [% itemlostloo.lib %] - [% END %] - [% END %] + [% IF itemlost_desc %] + [% itemlost_desc %] [% ELSE %] Unavailable (lost or missing) [% END %] [% END %] + [% withdrawn_desc = AuthorisedValues.GetByCode( 'WITHDRAWN', item.withdrawn ) %] [% IF ( item.withdrawn ) %] - [% IF itemwithdrawnloop %] - [% FOREACH itemwithdrawnloo IN itemwithdrawnloop %] - [% IF itemwithdrawnloo.authorised_value == item.withdrawn %] - [% itemwithdrawnloo.lib %] - [% END %] - [% END %] + [% IF withdrawn_desc %] + [% withdrawn_desc %] [% ELSE %] Withdrawn [% END %] [% END %] + [% damaged_desc = AuthorisedValues.GetByCode( 'DAMAGED', item.damaged ) %] [% IF ( item.damaged ) %] - [% IF itemdamagedloop %] - [% FOREACH itemdamagedloo IN itemdamagedloop %] - [% IF itemdamagedloo.authorised_value == item.damaged %] - [% itemdamagedloo.lib %] - [% END %] - [% END %] + [% IF damaged_desc %] + [% damaged_desc %] [% ELSE %] Damaged [% END %] -- 2.39.5