From e7c05a9c3cc31626e6d72d993b00b84b80115ab1 Mon Sep 17 00:00:00 2001 From: Mason James Date: Fri, 14 Dec 2007 12:40:08 +1300 Subject: [PATCH] mod to GetAuthorisedValueDesc() to simply take $category and $value args, and get a desc. back. Signed-off-by: Joshua Ferraro --- C4/Biblio.pm | 37 ++++++++++++++++++++++--------------- 1 file changed, 22 insertions(+), 15 deletions(-) mode change 100644 => 100755 C4/Biblio.pm diff --git a/C4/Biblio.pm b/C4/Biblio.pm old mode 100644 new mode 100755 index a96344f7b3..db371362bd --- a/C4/Biblio.pm +++ b/C4/Biblio.pm @@ -1680,34 +1680,41 @@ sub GetXmlBiblio { =over 4 my $subfieldvalue =get_authorised_value_desc( - $tag, $subf[$i][0],$subf[$i][1], '', $taglib); + $tag, $subf[$i][0],$subf[$i][1], '', $taglib, $category); Retrieve the complete description for a given authorised value. +Now takes $category and $value pair too. +my $auth_value_desc =GetAuthorisedValueDesc( + '','', 'DVD' ,'','','CCODE'); + =back =cut sub GetAuthorisedValueDesc { - my ( $tag, $subfield, $value, $framework, $tagslib ) = @_; + my ( $tag, $subfield, $value, $framework, $tagslib, $category ) = @_; my $dbh = C4::Context->dbh; - - #---- branch - if ( $tagslib->{$tag}->{$subfield}->{'authorised_value'} eq "branches" ) { - return C4::Branch::GetBranchName($value); - } - #---- itemtypes - if ( $tagslib->{$tag}->{$subfield}->{'authorised_value'} eq "itemtypes" ) { - return getitemtypeinfo($value)->{description}; + if (!$category) { +#---- branch + if ( $tagslib->{$tag}->{$subfield}->{'authorised_value'} eq "branches" ) { + return C4::Branch::GetBranchName($value); + } + +#---- itemtypes + if ( $tagslib->{$tag}->{$subfield}->{'authorised_value'} eq "itemtypes" ) { + return getitemtypeinfo($value)->{description}; + } + +#---- "true" authorized value + $category = $tagslib->{$tag}->{$subfield}->{'authorised_value'} } - #---- "true" authorized value - my $category = $tagslib->{$tag}->{$subfield}->{'authorised_value'}; if ( $category ne "" ) { my $sth = - $dbh->prepare( - "SELECT lib FROM authorised_values WHERE category = ? AND authorised_value = ?" - ); + $dbh->prepare( + "SELECT lib FROM authorised_values WHERE category = ? AND authorised_value = ?" + ); $sth->execute( $category, $value ); my $data = $sth->fetchrow_hashref; return $data->{'lib'}; -- 2.39.5