# Copyright 2000-2002 Katipo Communications
# Parts Copyright 2010 Nelsonville Public Library
+# Parts copyright 2010 BibLibre
#
# This file is part of Koha.
#
&GetKohaAuthorisedValues
&GetKohaAuthorisedValuesFromField
&GetKohaAuthorisedValueLib
- &GetAuthorisedValueByCode
- &GetKohaImageurlFromAuthorisedValues
+ &GetAuthorisedValueByCode
+ &GetKohaImageurlFromAuthorisedValues
&GetAuthValCode
&GetNormalizedUPC
&GetNormalizedISBN
my $dbh = C4::Context->dbh;
my $sth = $dbh->prepare("SELECT imageurl FROM authorised_values WHERE category=? AND lib =?");
$sth->execute( $category, $lib );
- while ( my $data = $sth->fetchrow_hashref ) {
- return $data->{'imageurl'};
- }
+ while ( my $data = $sth->fetchrow_hashref ) {
+ return $data->{'imageurl'};
+ }
}
=head2 GetAuthValCode
my $sth = $dbh->prepare("SELECT DISTINCT category FROM authorised_values ORDER BY category");
$sth->execute;
my @results;
- while (my $category = $sth->fetchrow_array) {
+ while (defined (my $category = $sth->fetchrow_array) ) {
push @results, $category;
}
return \@results;
$authhorised_value = GetAuthorisedValueByCode( $category, $authvalcode );
-Return an hashref of the authorised value represented by $authvalcode.
+Return the lib attribute from authorised_values from the row identified
+by the passed category and code
=cut
sub GetAuthorisedValueByCode {
- my ( $category, $authvalcode ) = @_;
-
+ my ( $category, $authvalcode ) = @_;
+
my $dbh = C4::Context->dbh;
my $sth = $dbh->prepare("SELECT lib FROM authorised_values WHERE category=? AND authorised_value =?");
$sth->execute( $category, $authvalcode );
- while ( my $data = $sth->fetchrow_hashref ) {
- return $data->{'lib'};
- }
+ while ( my $data = $sth->fetchrow_hashref ) {
+ return $data->{'lib'};
+ }
}
=head2 GetKohaAuthorisedValues