From bdf4dd13afc6c709ca682f41618c99d4d4b1ec23 Mon Sep 17 00:00:00 2001 From: Owen Leonard Date: Fri, 10 Dec 2010 14:33:36 +0000 Subject: [PATCH] Fix for Bug 4173 - Statuses not appearing in the OPAC This adds display of "Use restrictions" authorized values to the OPAC and the staff client for available and not-for-loan items. Signed-off-by: Colin Campbell Signed-off-by: Chris Cormack --- C4/Items.pm | 25 +++++++++++++++++++ .../prog/en/modules/catalogue/detail.tmpl | 2 ++ .../prog/en/includes/item-status.inc | 8 +++--- 3 files changed, 31 insertions(+), 4 deletions(-) diff --git a/C4/Items.pm b/C4/Items.pm index 264fa5b331..5eda6dd16b 100644 --- a/C4/Items.pm +++ b/C4/Items.pm @@ -1270,6 +1270,31 @@ sub GetItemsInfo { $data->{notforloanvalue} = $lib; } + # get restricted status and description if applicable + my $restrictedstatus = $dbh->prepare( + 'SELECT authorised_value + FROM marc_subfield_structure + WHERE kohafield="items.restricted" + ' + ); + + $restrictedstatus->execute; + my ($authorised_valuecode) = $restrictedstatus->fetchrow; + if ($authorised_valuecode) { + $restrictedstatus = $dbh->prepare( + "SELECT lib,lib_opac FROM authorised_values + WHERE category=? + AND authorised_value=?" + ); + $restrictedstatus->execute( $authorised_valuecode, + $data->{restricted} ); + + if ( my $rstdata = $restrictedstatus->fetchrow_hashref ) { + $data->{restricted} = $rstdata->{'lib'}; + $data->{restrictedopac} = $rstdata->{'lib_opac'}; + } + } + # my stack procedures my $stackstatus = $dbh->prepare( 'SELECT authorised_value diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tmpl b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tmpl index e3391acecf..8dde1b52b8 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tmpl +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tmpl @@ -326,6 +326,8 @@ function verify_images() { Available + + () diff --git a/koha-tmpl/opac-tmpl/prog/en/includes/item-status.inc b/koha-tmpl/opac-tmpl/prog/en/includes/item-status.inc index 5e881fe8d0..6369bbacdd 100644 --- a/koha-tmpl/opac-tmpl/prog/en/includes/item-status.inc +++ b/koha-tmpl/opac-tmpl/prog/en/includes/item-status.inc @@ -19,14 +19,14 @@ - + () - Not for loan + Not for loan () - Not for loan + Not for loan () Item damaged - Available + Available () -- 2.39.5