From 6c2e5bd51ba4c4fa803b90715c69ea9e0d95aa91 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Thu, 6 Mar 2014 17:07:08 +0100 Subject: [PATCH] [SIGNED-OFF] Bug 766: Create a plugin routine to build dropdown list On this way, dropdown list could be generated from the templates. Signed-off-by: Bernardo Gonzalez Kriegel --- Koha/Template/Plugin/AuthorisedValues.pm | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/Koha/Template/Plugin/AuthorisedValues.pm b/Koha/Template/Plugin/AuthorisedValues.pm index 0a19be2..3cfdd55 100644 --- a/Koha/Template/Plugin/AuthorisedValues.pm +++ b/Koha/Template/Plugin/AuthorisedValues.pm @@ -25,6 +25,7 @@ use base qw( Template::Plugin ); use Encode qw{encode decode}; use C4::Koha; +use C4::Charset; =pod @@ -43,4 +44,28 @@ sub GetByCode { return encode( 'UTF-8', GetAuthorisedValueByCode( $category, $code, $opac ) ); } +sub BuildDropbox { + my ( $self, $name, $category, $default, $params ) = @_; + my $class = $params->{class}; + my $avs = C4::Koha::GetAuthvalueDropbox($category, $default); + my $size = $params->{size} || 20; + my $html; + if ( @$avs ) { + $html = qq||; + } else { + $html .= qq||; + + } + + return encode( 'UTF-8', $html ); +} + 1; -- 1.7.9.5