From ea510b04bb145613f0665d8cc752f2fd4f9d18f5 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 Signed-off-by: Chris Cormack --- C4/Biblio.pm | 42 +++++++++++++++--------------------------- C4/Items.pm | 2 +- C4/Search.pm | 2 -- 3 files changed, 16 insertions(+), 30 deletions(-) diff --git a/C4/Biblio.pm b/C4/Biblio.pm index 550e34eb68..8fa138919b 100755 --- a/C4/Biblio.pm +++ b/C4/Biblio.pm @@ -820,23 +820,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 ); @@ -850,13 +844,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); @@ -875,7 +868,7 @@ sub GetMarcStructure { while ( ( $tag, $subfield, $liblibrarian, - , $libopac, $tab, + $libopac, $tab, $mandatory, $repeatable, $authorised_value, $authtypecode, $value_builder, $kohafield, $seealso, $hidden, $isurl, @@ -907,7 +900,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); @@ -921,7 +914,6 @@ sub GetMarcStructure { sub GetUsedMarcStructure($){ my $frameworkcode = shift || ''; - my $dbh = C4::Context->dbh; my $query = qq/ SELECT * FROM marc_subfield_structure @@ -929,13 +921,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 @@ -1319,7 +1307,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"; @@ -3409,7 +3397,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 b843ca5844..4a019017ec 100644 --- a/C4/Items.pm +++ b/C4/Items.pm @@ -1518,7 +1518,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 172b12cfb8..a883289e76 100644 --- a/C4/Search.pm +++ b/C4/Search.pm @@ -1205,8 +1205,6 @@ sub searchResults { $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}); - - # edition information, if any $oldbiblio->{edition} = $oldbiblio->{editionstatement}; $oldbiblio->{description} = $itemtypes{ $oldbiblio->{itemtype} }->{description}; # Build summary if there is one (the summary is defined in the itemtypes table) -- 2.39.5