From d5bc01be27643e65e96f038969b3b7897819c1d0 Mon Sep 17 00:00:00 2001 From: Kyle M Hall Date: Tue, 14 Feb 2012 13:11:21 -0500 Subject: [PATCH] Bug 7515 - authorized value code showing in opac for public note This alters C4::Items::GetItemsInfo() to look up the authorised value for the itemnotes value if the field has been assigned an authorised value rather than being a free text field. --- C4/Items.pm | 22 ++++++++++++++++++++++ 1 files changed, 22 insertions(+), 0 deletions(-) diff --git a/C4/Items.pm b/C4/Items.pm index 04cb417..11fe4b4 100644 --- a/C4/Items.pm +++ b/C4/Items.pm @@ -1269,6 +1269,28 @@ sub GetItemsInfo { $data->{notforloanvalue} = $lib; } + # get itemnotes authorised value if applicable + my $sql_itemnotes = " + SELECT authorised_value + FROM marc_subfield_structure + WHERE kohafield = 'items.itemnotes' + AND frameworkcode = ? + "; + my $sth_itemnotes = $dbh->prepare( $sql_itemnotes ); + $sth_itemnotes->execute( $data->{'frameworkcode'} ); + + my ($authorised_valuecode) = $sth_itemnotes->fetchrow; + if ($authorised_valuecode) { + $sth_itemnotes = $dbh->prepare( + "SELECT lib FROM authorised_values + WHERE category=? + AND authorised_value=?" + ); + $sth_itemnotes->execute( $authorised_valuecode, $data->{'itemnotes'} ); + my ($lib) = $sth_itemnotes->fetchrow; + $data->{'itemnotes'} = $lib; + } + # get restricted status and description if applicable my $restrictedstatus = $dbh->prepare( 'SELECT authorised_value -- 1.7.2.5