}
if ( C4::Context->preference("CataloguingLog") ) {
- my $newrecord = GetMarcBiblio($biblionumber);
+ my $newrecord = GetMarcBiblio({ biblionumber => $biblionumber });
logaction( "CATALOGUING", "MODIFY", $biblionumber, "biblio BEFORE=>" . $newrecord->as_formatted );
}
=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<undef> 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>
=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';
$marcflavour ||="MARC21";
require C4::Items;
- my $hostrecord = GetMarcBiblio($hostbiblionumber);
+ my $hostrecord = GetMarcBiblio({ biblionumber => $hostbiblionumber });
my $item = C4::Items::GetItem($hostitemnumber);
my $hostmarcfield;
);
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] );
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;
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;