Bug 4321: clean C4::Biblio::GetBiblio and uses

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Jared Camins-Esakov <jcamins@cpbibliography.com>
Signed-off-by: Paul Poulain <paul.poulain@biblibre.com>
This commit is contained in:
Jonathan Druart 2012-07-24 15:39:15 +02:00 committed by Paul Poulain
parent 1291734a0a
commit 82dc7b55a8
7 changed files with 15 additions and 17 deletions

View File

@ -999,7 +999,7 @@ sub GetISBDView {
=head2 GetBiblio
( $count, @results ) = &GetBiblio($biblionumber);
my $biblio = &GetBiblio($biblionumber);
=cut
@ -1010,12 +1010,10 @@ sub GetBiblio {
my $count = 0;
my @results;
$sth->execute($biblionumber);
while ( my $data = $sth->fetchrow_hashref ) {
$results[$count] = $data;
$count++;
} # while
$sth->finish;
return ( $count, @results );
if ( my $data = $sth->fetchrow_hashref ) {
return $data;
}
return;
} # sub GetBiblio
=head2 GetBiblioItemInfosOf

View File

@ -411,7 +411,7 @@ sub GetPatronInfo {
# Add additional fields
$reserve->{'item'} = $item;
$reserve->{'branchname'} = $branchname;
$reserve->{'title'} = ( GetBiblio( $reserve->{'biblionumber'} ) )[1]->{'title'};
$reserve->{'title'} = GetBiblio( $reserve->{'biblionumber'} )->{'title'};
}
$borrower->{'holds'}->{'hold'} = \@reserves;
}
@ -601,7 +601,7 @@ sub HoldTitle {
# Get the biblio record, or return an error code
my $biblionumber = $cgi->param('bib_id');
my ( $count, $biblio ) = GetBiblio( $biblionumber );
my $biblio = GetBiblio( $biblionumber );
return { code => 'RecordNotFound' } unless $$biblio{biblionumber};
my $title = $$biblio{title};
@ -666,7 +666,7 @@ sub HoldItem {
# Get the biblio or return an error code
my $biblionumber = $cgi->param('bib_id');
my ( $count, $biblio ) = GetBiblio($biblionumber);
my $biblio = GetBiblio($biblionumber);
return { code => 'RecordNotFound' } unless $$biblio{biblionumber};
my $title = $$biblio{title};

View File

@ -539,7 +539,7 @@ sub BatchCommitBibRecords {
} elsif ($bib_result eq 'replace') {
$num_updated++;
my $biblionumber = $bib_match;
my ($count, $oldbiblio) = GetBiblio($biblionumber);
my $oldbiblio = GetBiblio($biblionumber);
my $oldxml = GetXmlBiblio($biblionumber);
# remove item fields so that they don't get
@ -679,7 +679,7 @@ sub BatchRevertBibRecords {
$num_reverted++;
my $old_record = MARC::Record->new_from_xml(StripNonXmlChars($rowref->{'marcxml_old'}), 'UTF-8', $rowref->{'encoding'});
my $biblionumber = $rowref->{'matched_biblionumber'};
my ($count, $oldbiblio) = GetBiblio($biblionumber);
my $oldbiblio = GetBiblio($biblionumber);
$num_items_deleted += BatchRevertItems($rowref->{'import_record_id'}, $rowref->{'matched_biblionumber'});
ModBiblio($old_record, $biblionumber, $oldbiblio->{'frameworkcode'});
SetImportRecordStatus($rowref->{'import_record_id'}, 'reverted');

View File

@ -1303,7 +1303,7 @@ sub NewSubscription {
logaction( "SERIAL", "ADD", $subscriptionid, "" ) if C4::Context->preference("SubscriptionLog");
#set serial flag on biblio if not already set.
my ( $null, ($bib) ) = GetBiblio($biblionumber);
my $bib = GetBiblio($biblionumber);
if ( !$bib->{'serial'} ) {
my $record = GetMarcBiblio($biblionumber);
my ( $tag, $subf ) = GetMarcFromKohaField( 'biblio.serial', $bib->{'frameworkcode'} );

View File

@ -41,7 +41,7 @@ my ( $template, $borrowernumber, $cookie ) = get_template_and_user(
my $biblionumber = $query->param('biblionumber') || $query->param('bib');
my $imagenumber = $query->param('imagenumber');
my ( $count, $biblio ) = GetBiblio($biblionumber);
my $biblio = GetBiblio($biblionumber);
my $itemcount = GetItemsCount($biblionumber);
my @items = GetItemsInfo($biblionumber);

View File

@ -61,10 +61,10 @@ if ($itemnumber){
);
} else {
$issues = GetBiblioIssues($biblionumber);
my (undef,@biblio)=GetBiblio($biblionumber);
my $biblio = GetBiblio($biblionumber);
my $total = scalar @$issues;
$template->param(
%{$biblio[0]},
%{$biblio},
);
}
foreach (@{$issues}){

View File

@ -39,7 +39,7 @@ my ( $template, $borrowernumber, $cookie ) = get_template_and_user(
my $biblionumber = $query->param('biblionumber') || $query->param('bib');
my $imagenumber = $query->param('imagenumber');
my ( $count, $biblio ) = GetBiblio($biblionumber);
my $biblio = GetBiblio($biblionumber);
if ( C4::Context->preference("OPACLocalCoverImages") ) {
my @images = ListImagesForBiblio($biblionumber);