Bugzilla – Attachment 10798 Details for
Bug 4173
Statuses not appearing in the OPAC
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 4173 - Statuses not appearing in the OPAC
Bug-4173---Statuses-not-appearing-in-the-OPAC.patch (text/plain), 4.47 KB, created by
Kyle M Hall (khall)
on 2012-07-12 14:49:35 UTC
(
hide
)
Description:
Bug 4173 - Statuses not appearing in the OPAC
Filename:
MIME Type:
Creator:
Kyle M Hall (khall)
Created:
2012-07-12 14:49:35 UTC
Size:
4.47 KB
patch
obsolete
>From cefc412bcee41299b8aabd25653d55a69c266aaa Mon Sep 17 00:00:00 2001 >From: Kyle M Hall <kyle@bywatersolutions.com> >Date: Thu, 12 Jul 2012 10:48:12 -0400 >Subject: [PATCH] Bug 4173 - Statuses not appearing in the OPAC > >For the authorised values LOST and DAMAGED, if an OPAC description >is defined for the given value, display that description in the OPAC >rather than the generic description. >--- > C4/Koha.pm | 7 ++-- > Koha/Template/Plugin/KohaAuthorisedValues.pm | 32 ++++++++++++++++++++ > .../opac-tmpl/prog/en/includes/item-status.inc | 18 ++++++++-- > 3 files changed, 50 insertions(+), 7 deletions(-) > create mode 100644 Koha/Template/Plugin/KohaAuthorisedValues.pm > >diff --git a/C4/Koha.pm b/C4/Koha.pm >index 4f386e4..faa9cf5 100644 >--- a/C4/Koha.pm >+++ b/C4/Koha.pm >@@ -1073,13 +1073,14 @@ by the passed category and code > =cut > > sub GetAuthorisedValueByCode { >- my ( $category, $authvalcode ) = @_; >+ my ( $category, $authvalcode, $opac ) = @_; > >+ my $field = $opac ? 'lib_opac' : 'lib'; > my $dbh = C4::Context->dbh; >- my $sth = $dbh->prepare("SELECT lib FROM authorised_values WHERE category=? AND authorised_value =?"); >+ my $sth = $dbh->prepare("SELECT $field FROM authorised_values WHERE category=? AND authorised_value =?"); > $sth->execute( $category, $authvalcode ); > while ( my $data = $sth->fetchrow_hashref ) { >- return $data->{'lib'}; >+ return $data->{ $field }; > } > } > >diff --git a/Koha/Template/Plugin/KohaAuthorisedValues.pm b/Koha/Template/Plugin/KohaAuthorisedValues.pm >new file mode 100644 >index 0000000..58297c0 >--- /dev/null >+++ b/Koha/Template/Plugin/KohaAuthorisedValues.pm >@@ -0,0 +1,32 @@ >+package Koha::Template::Plugin::KohaAuthorisedValues; >+ >+# Copyright ByWater Solutions 2012 >+ >+# This file is part of Koha. >+# >+# Koha is free software; you can redistribute it and/or modify it under the >+# terms of the GNU General Public License as published by the Free Software >+# Foundation; either version 2 of the License, or (at your option) any later >+# version. >+# >+# Koha is distributed in the hope that it will be useful, but WITHOUT ANY >+# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR >+# A PARTICULAR PURPOSE. See the GNU General Public License for more details. >+# >+# You should have received a copy of the GNU General Public License along >+# with Koha; if not, write to the Free Software Foundation, Inc., >+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. >+ >+use Modern::Perl; >+ >+use Template::Plugin; >+use base qw( Template::Plugin ); >+ >+use C4::Koha; >+ >+sub GetByCode { >+ my ( $self, $category, $code, $opac ) = @_; >+ return GetAuthorisedValueByCode( $category, $code, $opac ); >+} >+ >+1; >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 d05583f..c456675 100644 >--- a/koha-tmpl/opac-tmpl/prog/en/includes/item-status.inc >+++ b/koha-tmpl/opac-tmpl/prog/en/includes/item-status.inc >@@ -1,3 +1,5 @@ >+[% USE KohaAuthorisedValues %] >+ > [% IF ( item.datedue ) %] > [% IF ( OPACShowCheckoutName ) %] > Checked out to [% item.cardnumber %] [% item.firstname %] [% item.surname %] >@@ -12,10 +14,14 @@ > [% ELSIF ( item.wthdrawn ) %] > Item withdrawn > [% ELSIF ( item.itemlost ) %] >- [% IF ( item.lostimageurl ) %] >- <img src="[% item.lostimageurl %]" alt="[% item.lostimagelabel %]" title="[% item.lostimagelabel %]"> >+ [% IF KohaAuthorisedValues.GetByCode( 'LOST', item.itemlost, 1 ) %] >+ [% KohaAuthorisedValues.GetByCode( 'LOST', item.itemlost, 1 ) %] > [% ELSE %] >- Item lost >+ [% IF ( item.lostimageurl ) %] >+ <img src="[% item.lostimageurl %]" alt="[% item.lostimagelabel %]" title="[% item.lostimagelabel %]"> >+ [% ELSE %] >+ Item lost >+ [% END %] > [% END %] > [% ELSIF ( item.itemnotforloan ) %] > [% IF ( item.notforloanvalue ) %] >@@ -26,7 +32,11 @@ > [% ELSIF ( item.notforloan_per_itemtype ) %] > Not for loan [% IF ( item.restrictedopac ) %]<span class="restricted">([% item.restrictedopac %])</span>[% END %] > [% ELSIF ( item.damaged ) %] >- Item damaged >+ [% IF KohaAuthorisedValues.GetByCode( 'DAMAGED', item.damaged, 1 ) %] >+ [% KohaAuthorisedValues.GetByCode( 'DAMAGED', item.damaged, 1 ) %] >+ [% ELSE %] >+ Item damaged >+ [% END %] > [% ELSE %] > Available [% IF ( item.restrictedopac ) %]<span class="restricted">([% item.restrictedopac %])</span>[% END %] > [% END %] >-- >1.7.2.5
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 4173
:
1884
|
1885
|
1886
|
1887
|
2810
|
2863
|
2864
|
10798
|
11132
|
11133
|
11135
|
12009
|
12010
|
18158
|
18161
|
18162