X-Git-Url: http://git.rot13.org/?a=blobdiff_plain;f=C4%2FBiblio.pm;h=54a67312b56327b78e39fcff76ea27da5775eea8;hb=30048f4aabeec27fdf0a4f195f82c822eddab501;hp=0ee689d70a9f25eb95cd72c8211c947e665fbf1b;hpb=bd3b1c1a33e4bb14bbcd10a0fcf871b39362430d;p=koha.git diff --git a/C4/Biblio.pm b/C4/Biblio.pm index 0ee689d70a..54a67312b5 100644 --- a/C4/Biblio.pm +++ b/C4/Biblio.pm @@ -293,7 +293,7 @@ sub ModBiblio { } if ( C4::Context->preference("CataloguingLog") ) { - my $newrecord = GetMarcBiblio($biblionumber); + my $newrecord = GetMarcBiblio({ biblionumber => $biblionumber }); logaction( "CATALOGUING", "MODIFY", $biblionumber, "biblio BEFORE=>" . $newrecord->as_formatted ); } @@ -1136,11 +1136,18 @@ sub GetMarcSubfieldStructureFromKohaField { =head2 GetMarcBiblio - my $record = GetMarcBiblio($biblionumber, [$embeditems], [$opac]); + my $record = GetMarcBiblio({ + biblionumber => $biblionumber, + embed_items => $embeditems, + opac => $opac }); Returns MARC::Record representing a biblio record, or C if the biblionumber doesn't exist. +Both embed_items and opac are optional. +If embed_items is passed and is 1, items are embedded. +If opac is passed and is 1, the record is filtered as needed. + =over 4 =item C<$biblionumber> @@ -1161,9 +1168,16 @@ OpacHiddenItems to be applied. =cut sub GetMarcBiblio { - my $biblionumber = shift; - my $embeditems = shift || 0; - my $opac = shift || 0; + my ($params) = @_; + + if (not defined $params) { + carp 'GetMarcBiblio called without parameters'; + return; + } + + my $biblionumber = $params->{biblionumber}; + my $embeditems = $params->{embed_items} || 0; + my $opac = $params->{opac} || 0; if (not defined $biblionumber) { carp 'GetMarcBiblio called with undefined biblionumber'; @@ -2181,7 +2195,7 @@ sub PrepHostMarcField { $marcflavour ||="MARC21"; require C4::Items; - my $hostrecord = GetMarcBiblio($hostbiblionumber); + my $hostrecord = GetMarcBiblio({ biblionumber => $hostbiblionumber }); my $item = C4::Items::GetItem($hostitemnumber); my $hostmarcfield; @@ -2830,7 +2844,9 @@ sub ModZebra { ); if ( $op eq 'specialUpdate' ) { unless ($record) { - $record = GetMarcBiblio($biblionumber, 1); + $record = GetMarcBiblio({ + biblionumber => $biblionumber, + embed_items => 1 }); } my $records = [$record]; $indexer->update_index_background( [$biblionumber], [$record] ); @@ -3443,7 +3459,7 @@ Generate the host item entry for an analytic child entry sub prepare_host_field { my ( $hostbiblio, $marcflavour ) = @_; $marcflavour ||= C4::Context->preference('marcflavour'); - my $host = GetMarcBiblio($hostbiblio); + my $host = GetMarcBiblio({ biblionumber => $hostbiblio }); # unfortunately as_string does not 'do the right thing' # if field returns undef my %sfd; @@ -3581,7 +3597,7 @@ sub UpdateTotalIssues { my ($biblionumber, $increase, $value) = @_; my $totalissues; - my $record = GetMarcBiblio($biblionumber); + my $record = GetMarcBiblio({ biblionumber => $biblionumber }); unless ($record) { carp "UpdateTotalIssues could not get biblio record"; return;