From 5f371710c2fdd2a943ad63ca5308ae4099f50d23 Mon Sep 17 00:00:00 2001 From: Henri-Damien LAURENT Date: Fri, 16 Nov 2007 18:49:22 -0600 Subject: [PATCH] libs for Authorised_values for items were not displayed Using GetAuthorisedValues exported by Biblio.pm Adding GetAuthorisedValue for itemdisplay in MARCdetail.pl Signed-off-by: Chris Cormack Signed-off-by: Joshua Ferraro --- catalogue/ISBDdetail.pl | 36 ++-------------------------- catalogue/MARCdetail.pl | 52 +++++++---------------------------------- 2 files changed, 11 insertions(+), 77 deletions(-) diff --git a/catalogue/ISBDdetail.pl b/catalogue/ISBDdetail.pl index 068408d476..04c9e38f8f 100755 --- a/catalogue/ISBDdetail.pl +++ b/catalogue/ISBDdetail.pl @@ -48,38 +48,6 @@ use C4::Serials; # CountSubscriptionFromBiblionumber #---- Internal function -sub get_authorised_value_desc ($$$$$$$) { - my ( $itemtype, $tagslib, $tag, $subfield, $value, $framework, $dbh ) = @_; - - #---- branch - if ( $tagslib->{$tag}->{$subfield}->{'authorised_value'} eq "branches" ) { - return GetBranchDetail($value)->{branchname}; - } - - #---- itemtypes - if ( $tagslib->{$tag}->{$subfield}->{'authorised_value'} eq "itemtypes" ) { - my $itemtypedef = getitemtypeinfo($value); - return $itemtypedef->{description}; - } - - #---- "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 = ?" - ); - $sth->execute( $category, $value ); - my $data = $sth->fetchrow_hashref; - return $data->{'lib'}; - } - else { - return $value; # if nothing is found return the original value - } -} -# ------ - my $query = new CGI; my $dbh = C4::Context->dbh; @@ -143,8 +111,8 @@ foreach my $isbdfield ( split /#/, $bloc ) { for my $i ( 0 .. $#subf ) { my $subfieldcode = $subf[$i][0]; my $subfieldvalue = - get_authorised_value_desc( $itemtype,$tagslib, $tag, $subf[$i][0], - $subf[$i][1], '', $dbh ); + GetAuthorisedValueDesc( $tag, $subf[$i][0], + $subf[$i][1], $itemtype,$tagslib); my $tagsubf = $tag . $subfieldcode; $calculated =~s/\{(.?.?.?)$tagsubf(.*?)\}/$1$subfieldvalue$2\{$1$tagsubf$2\}/g; } diff --git a/catalogue/MARCdetail.pl b/catalogue/MARCdetail.pl index 8f671eca7b..9271a52f98 100755 --- a/catalogue/MARCdetail.pl +++ b/catalogue/MARCdetail.pl @@ -55,42 +55,6 @@ use C4::Biblio; use C4::Acquisition; use C4::Serials; #uses getsubscriptionsfrombiblionumber GetSubscriptionsFromBiblionumber -#---- Internal function --- -sub get_authorised_value_desc ($$$$$$) { - my ( $tagslib, $tag, $subfield, $value, $framework, $dbh ) = @_; - - #---- branch - if ( $tagslib->{$tag}->{$subfield}->{'authorised_value'} eq "branches" ) { - -# return GetBranchDetail($value)->{branchname}; - return $value; - } - - #---- itemtypes - if ( $tagslib->{$tag}->{$subfield}->{'authorised_value'} eq "itemtypes" ) { - - my $itemtypedef = getitemtypeinfo($value); - return $itemtypedef->{description}; - } - - #---- "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 = ?" - ); - $sth->execute( $category, $value ); - my $data = $sth->fetchrow_hashref; - return $data->{'lib'}; - } - else { - return $value; # if nothing is found return the original value - } -} - -#--------- my $query = new CGI; my $dbh = C4::Context->dbh; @@ -235,8 +199,9 @@ for ( my $tabloop = 0 ; $tabloop <= 10 ; $tabloop++ ) { $subfield_data{authority} = $fields[$x_i]->subfield(9); } $subfield_data{marc_value} = - get_authorised_value_desc( $tagslib, $fields[$x_i]->tag(), - $subf[$i][0], $subf[$i][1], '', $dbh ); + GetAuthorisedValueDesc( $fields[$x_i]->tag(), + $subf[$i][0], $subf[$i][1], '', $tagslib); + } $subfield_data{marc_subfield} = $subf[$i][0]; $subfield_data{marc_tag} = $fields[$x_i]->tag(); @@ -290,8 +255,9 @@ foreach my $field (@fields) { next if ( $tagslib->{ $field->tag() }->{ $subf[$i][0] }->{tab} ne 10 ); next if ( $tagslib->{ $field->tag() }->{ $subf[$i][0] }->{hidden} ); $witness{ $subf[$i][0] } = - $tagslib->{ $field->tag() }->{ $subf[$i][0] }->{lib}; - $this_row{ $subf[$i][0] } = $subf[$i][1]; + $tagslib->{ $field->tag() }->{ $subf[$i][0] }->{lib}; + $this_row{ $subf[$i][0] } = GetAuthorisedValueDesc( $field->tag(), + $subf[$i][0], $subf[$i][1], '', $tagslib); } if (%this_row) { push( @big_array, \%this_row ); @@ -326,14 +292,14 @@ foreach my $subfield_code ( keys(%witness) ) { push( @header_value_loop, \%header_value ); } -my $subscriptionsnumber = CountSubscriptionFromBiblionumber($biblionumber); +my $subscriptionscount = CountSubscriptionFromBiblionumber($biblionumber); -if ($subscriptionsnumber) { +if ($subscriptionscount) { my $subscriptions = GetSubscriptionsFromBiblionumber($biblionumber); my $subscriptiontitle = $subscriptions->[0]{'bibliotitle'}; $template->param( subscriptiontitle => $subscriptiontitle, - subscriptionsnumber => $subscriptionsnumber, + subscriptionsnumber => $subscriptionscount, ); } -- 2.39.5