From e18de9d60553a9bc5531332de1342c4bbe148037 Mon Sep 17 00:00:00 2001 From: Joe Atzberger Date: Fri, 7 Aug 2009 13:54:10 -0500 Subject: [PATCH] Cleanup docs, typos, style etc. Unused variable removed. Weirdness with empty position in assignment list also removed. Signed-off-by: Galen Charlton --- C4/Biblio.pm | 42 +++++++++++++++--------------------------- C4/Items.pm | 2 +- C4/Search.pm | 4 ++-- 3 files changed, 18 insertions(+), 30 deletions(-) diff --git a/C4/Biblio.pm b/C4/Biblio.pm index 40ff797b2f..a7c66f94a6 100644 --- a/C4/Biblio.pm +++ b/C4/Biblio.pm @@ -833,23 +833,17 @@ sub GetMarcStructure { return $marc_structure_cache->{$forlibrarian}->{$frameworkcode}; } - my $sth; - my $libfield = ( $forlibrarian eq 1 ) ? 'liblibrarian' : 'libopac'; - - # check that framework exists - $sth = - $dbh->prepare( + my $sth = $dbh->prepare( "SELECT COUNT(*) FROM marc_tag_structure WHERE frameworkcode=?"); $sth->execute($frameworkcode); my ($total) = $sth->fetchrow; $frameworkcode = "" unless ( $total > 0 ); - $sth = - $dbh->prepare( + $sth = $dbh->prepare( "SELECT tagfield,liblibrarian,libopac,mandatory,repeatable FROM marc_tag_structure WHERE frameworkcode=? ORDER BY tagfield" - ); + ); $sth->execute($frameworkcode); my ( $liblibrarian, $libopac, $tag, $res, $tab, $mandatory, $repeatable ); @@ -863,13 +857,12 @@ sub GetMarcStructure { $res->{$tag}->{repeatable} = $repeatable; } - $sth = - $dbh->prepare( - "SELECT tagfield,tagsubfield,liblibrarian,libopac,tab,mandatory,repeatable,authorised_value,authtypecode,value_builder,kohafield,seealso,hidden,isurl,link,defaultvalue - FROM marc_subfield_structure - WHERE frameworkcode=? - ORDER BY tagfield,tagsubfield - " + $sth = $dbh->prepare( + "SELECT tagfield,tagsubfield,liblibrarian,libopac,tab,mandatory,repeatable,authorised_value,authtypecode,value_builder,kohafield,seealso,hidden,isurl,link,defaultvalue + FROM marc_subfield_structure + WHERE frameworkcode=? + ORDER BY tagfield,tagsubfield + " ); $sth->execute($frameworkcode); @@ -888,7 +881,7 @@ sub GetMarcStructure { while ( ( $tag, $subfield, $liblibrarian, - , $libopac, $tab, + $libopac, $tab, $mandatory, $repeatable, $authorised_value, $authtypecode, $value_builder, $kohafield, $seealso, $hidden, $isurl, @@ -920,7 +913,7 @@ sub GetMarcStructure { =head2 GetUsedMarcStructure - the same function as GetMarcStructure expcet it just take field + the same function as GetMarcStructure except it just takes field in tab 0-9. (used field) my $results = GetUsedMarcStructure($frameworkcode); @@ -934,7 +927,6 @@ sub GetMarcStructure { sub GetUsedMarcStructure($){ my $frameworkcode = shift || ''; - my $dbh = C4::Context->dbh; my $query = qq/ SELECT * FROM marc_subfield_structure @@ -942,13 +934,9 @@ sub GetUsedMarcStructure($){ AND frameworkcode = ? ORDER BY tagfield, tagsubfield /; - my @results; - my $sth = $dbh->prepare($query); + my $sth = C4::Context->dbh->prepare($query); $sth->execute($frameworkcode); - while (my $row = $sth->fetchrow_hashref){ - push @results,$row; - } - return \@results; + return $sth->fetchall_arrayref({}); } =head2 GetMarcFromKohaField @@ -1329,7 +1317,7 @@ sub GetMarcAuthors { my ( $record, $marcflavour ) = @_; my ( $mintag, $maxtag ); # tagslib useful for UNIMARC author reponsabilities - my $tagslib = &GetMarcStructure( 1, '' ); # FIXME : we don't have the framework available, we take the default framework. May be bugguy on some setups, will be usually correct. + my $tagslib = &GetMarcStructure( 1, '' ); # FIXME : we don't have the framework available, we take the default framework. May be buggy on some setups, will be usually correct. if ( $marcflavour eq "MARC21" ) { $mintag = "700"; $maxtag = "720"; @@ -3420,7 +3408,7 @@ sub set_service_options { biblionumber MARC::Record of the bib - returns: a hashref malling the authorised value to the value set for this biblionumber + returns: a hashref mapping the authorised value to the value set for this biblionumber $authorised_values = { 'Scent' => 'flowery', diff --git a/C4/Items.pm b/C4/Items.pm index 6c58365ef0..91337566e1 100644 --- a/C4/Items.pm +++ b/C4/Items.pm @@ -1474,7 +1474,7 @@ sub get_item_authorised_values { authorised values for a biblio. parameters: listref of authorised values, such as comes from - get_item_ahtorised_values or + get_item_authorised_values or from C4::Biblio::get_biblio_authorised_values returns: listref of hashrefs for each image. Each hashref looks like diff --git a/C4/Search.pm b/C4/Search.pm index bae6aff491..8bf75ac0aa 100644 --- a/C4/Search.pm +++ b/C4/Search.pm @@ -1201,8 +1201,8 @@ sub searchResults { $oldbiblio->{imageurl} = getitemtypeimagelocation( 'opac', $itemtypes{ $oldbiblio->{itemtype} }->{imageurl} ); $oldbiblio->{'authorised_value_images'} = C4::Items::get_authorised_value_images( C4::Biblio::get_biblio_authorised_values( $oldbiblio->{'biblionumber'}, $marcrecord ) ); - $oldbiblio->{normalized_upc} = GetNormalizedUPC($marcrecord,$marcflavour); - $oldbiblio->{normalized_ean} = GetNormalizedEAN($marcrecord,$marcflavour); + $oldbiblio->{normalized_upc} = GetNormalizedUPC( $marcrecord,$marcflavour); + $oldbiblio->{normalized_ean} = GetNormalizedEAN( $marcrecord,$marcflavour); $oldbiblio->{normalized_oclc} = GetNormalizedOCLCNumber($marcrecord,$marcflavour); $oldbiblio->{normalized_isbn} = GetNormalizedISBN(undef,$marcrecord,$marcflavour); $oldbiblio->{content_identifier_exists} = 1 if ($oldbiblio->{normalized_isbn} or $oldbiblio->{normalized_oclc} or $oldbiblio->{normalized_ean} or $oldbiblio->{normalized_upc}); -- 2.39.5