From c23fafc7ab744de98053d6dad91ff8d1959af821 Mon Sep 17 00:00:00 2001 From: Mark Tompsett Date: Fri, 4 Aug 2017 13:42:56 -0400 Subject: [PATCH] Bug 19040: Refactor GetMarcBiblio parameters Content-Type: text/plain; charset=utf-8 Change parameters to a hashref. Signed-off-by: Josef Moravec Signed-off-by: Marcel de Rooy Looks good to me. Two calls in migration_tools/22_to_30 still in old style. --- C4/AuthoritiesMarc.pm | 2 +- C4/Biblio.pm | 34 ++++++++++++++++------ C4/HoldsQueue.pm | 2 +- C4/ILSDI/Services.pm | 4 ++- C4/Items.pm | 2 +- C4/Labels/Label.pm | 4 +-- C4/Record.pm | 2 +- C4/Search.pm | 4 ++- C4/Serials.pm | 2 +- C4/ShelfBrowser.pm | 2 +- Koha/Biblio.pm | 6 +++- Koha/BiblioUtils.pm | 8 +++-- Koha/Exporter/Record.pm | 2 +- Koha/OAI/Server/Repository.pm | 5 +++- basket/basket.pl | 2 +- basket/downloadcart.pl | 4 ++- basket/sendbasket.pl | 4 ++- catalogue/ISBDdetail.pl | 4 ++- catalogue/MARCdetail.pl | 4 ++- catalogue/detail.pl | 2 +- catalogue/export.pl | 4 ++- catalogue/labeledMARCdetail.pl | 2 +- catalogue/moredetail.pl | 2 +- catalogue/showmarc.pl | 2 +- cataloguing/addbiblio.pl | 2 +- cataloguing/additem.pl | 8 +++-- cataloguing/linkitem.pl | 2 +- cataloguing/merge.pl | 6 ++-- .../value_builder/marc21_linking_section.pl | 2 +- cataloguing/value_builder/unimarc_field_4XX.pl | 2 +- circ/branchoverdues.pl | 2 +- circ/reserveratios.pl | 2 +- circ/transferstoreceive.pl | 2 +- circ/waitingreserves.pl | 5 +++- misc/batchRebuildBiblioTables.pl | 2 +- misc/batchRebuildItemsTables.pl | 4 ++- misc/batchRepairMissingBiblionumbers.pl | 2 +- misc/cronjobs/build_browser_and_cloud.pl | 2 +- misc/cronjobs/check-url-quick.pl | 2 +- misc/cronjobs/check-url.pl | 2 +- misc/link_bibs_to_authorities.pl | 2 +- .../UNIMARC_sync_date_created_with_marc_biblio.pl | 2 +- misc/maintenance/process_record_through_filter.pl | 2 +- misc/maintenance/remove_items_from_biblioitems.pl | 2 +- misc/maintenance/sanitize_records.pl | 2 +- misc/maintenance/touch_all_biblios.pl | 2 +- misc/migration_tools/buildEDITORS.pl | 10 +++---- misc/migration_tools/create_analytical_rel.pl | 2 +- misc/migration_tools/import_lexile.pl | 2 +- misc/migration_tools/rebuild_zebra.pl | 2 +- misc/migration_tools/switch_marc21_series_info.pl | 2 +- misc/migration_tools/upgradeitems.pl | 2 +- opac/opac-ISBDdetail.pl | 4 ++- opac/opac-MARCdetail.pl | 4 ++- opac/opac-basket.pl | 2 +- opac/opac-detail.pl | 2 +- opac/opac-downloadcart.pl | 4 ++- opac/opac-downloadshelf.pl | 4 ++- opac/opac-export.pl | 7 +++-- opac/opac-reserve.pl | 4 +-- opac/opac-search.pl | 2 +- opac/opac-sendbasket.pl | 4 ++- opac/opac-sendshelf.pl | 4 ++- opac/opac-shelves.pl | 2 +- opac/opac-showmarc.pl | 2 +- opac/opac-showreviews.pl | 2 +- opac/opac-tags.pl | 2 +- opac/opac-user.pl | 2 +- serials/subscription-add.pl | 4 ++- svc/bib | 11 ++++--- svc/checkouts | 6 ++-- svc/holds | 3 +- svc/new_bib | 7 +++-- svc/records/preview | 2 +- t/Biblio.t | 6 +++- t/db_dependent/Authorities/Merge.t | 24 +++++++-------- t/db_dependent/Biblio.t | 8 +++-- t/db_dependent/Items.t | 2 +- .../Koha/Filter/EmbedItemsAvailability.t | 4 +-- t/db_dependent/OAI/Server.t | 2 +- t/db_dependent/OAI/Sets.t | 4 +-- t/db_dependent/Reserves.t | 2 +- tags/list.pl | 2 +- tools/batch_delete_records.pl | 2 +- tools/batch_record_modification.pl | 2 +- tools/showdiffmarc.pl | 4 ++- virtualshelves/downloadshelf.pl | 4 ++- virtualshelves/sendshelf.pl | 4 ++- virtualshelves/shelves.pl | 2 +- 89 files changed, 214 insertions(+), 130 deletions(-) diff --git a/C4/AuthoritiesMarc.pm b/C4/AuthoritiesMarc.pm index 9f1f284..8b9c6c1 100644 --- a/C4/AuthoritiesMarc.pm +++ b/C4/AuthoritiesMarc.pm @@ -1475,7 +1475,7 @@ sub merge { my $counteditedbiblio = 0; foreach my $biblionumber ( @biblionumbers ) { - my $marcrecord = GetMarcBiblio( $biblionumber ); + my $marcrecord = GetMarcBiblio({ biblionumber => $biblionumber }); next if !$marcrecord; my $update = 0; foreach my $tagfield (@$tags_using_authtype) { diff --git a/C4/Biblio.pm b/C4/Biblio.pm index 0ee689d..54a6731 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; diff --git a/C4/HoldsQueue.pm b/C4/HoldsQueue.pm index cf86aa81..ce525ba 100755 --- a/C4/HoldsQueue.pm +++ b/C4/HoldsQueue.pm @@ -146,7 +146,7 @@ sub GetHoldsQueueItems { $sth->execute(@bind_params); my $items = []; while ( my $row = $sth->fetchrow_hashref ){ - my $record = GetMarcBiblio($row->{biblionumber}); + my $record = GetMarcBiblio({ biblionumber => $row->{biblionumber} }); if ($record){ $row->{subtitle} = [ map { $_->{subfield} } @{ GetRecordValue( 'subtitle', $record, '' ) } ]; $row->{parts} = GetRecordValue('parts',$record,'')->[0]->{subfield}; diff --git a/C4/ILSDI/Services.pm b/C4/ILSDI/Services.pm index 5d35b2b..816f1ed 100644 --- a/C4/ILSDI/Services.pm +++ b/C4/ILSDI/Services.pm @@ -214,7 +214,9 @@ sub GetRecords { } my $embed_items = 1; - my $record = GetMarcBiblio($biblionumber, $embed_items); + my $record = GetMarcBiblio({ + biblionumber => $biblionumber, + embed_items => $embed_items }); if ($record) { $biblioitem->{marcxml} = $record->as_xml_record(); } diff --git a/C4/Items.pm b/C4/Items.pm index 036b4f7..18debb5 100644 --- a/C4/Items.pm +++ b/C4/Items.pm @@ -1321,7 +1321,7 @@ references on array of itemnumbers. sub get_hostitemnumbers_of { my ($biblionumber) = @_; - my $marcrecord = GetMarcBiblio($biblionumber); + my $marcrecord = GetMarcBiblio({ biblionumber => $biblionumber }); return unless $marcrecord; diff --git a/C4/Labels/Label.pm b/C4/Labels/Label.pm index c7c5371..8fe725f 100644 --- a/C4/Labels/Label.pm +++ b/C4/Labels/Label.pm @@ -396,7 +396,7 @@ sub draw_label_text { my $font = $self->{'font'}; my $item = _get_label_item($self->{'item_number'}); my $label_fields = _get_text_fields($self->{'format_string'}); - my $record = GetMarcBiblio($item->{'biblionumber'}); + my $record = GetMarcBiblio({ biblionumber => $item->{'biblionumber'} }); # FIXME - returns all items, so you can't get data from an embedded holdings field. # TODO - add a GetMarcBiblio1item(bibnum,itemnum) or a GetMarcItem(itemnum). my $cn_source = ($item->{'cn_source'} ? $item->{'cn_source'} : C4::Context->preference('DefaultClassificationSource')); @@ -601,7 +601,7 @@ sub csv_data { my $self = shift; my $label_fields = _get_text_fields($self->{'format_string'}); my $item = _get_label_item($self->{'item_number'}); - my $bib_record = GetMarcBiblio($item->{biblionumber}); + my $bib_record = GetMarcBiblio({ biblionumber => $item->{biblionumber} }); my @csv_data = (map { _get_barcode_data($_->{'code'},$item,$bib_record) } @$label_fields); return \@csv_data; } diff --git a/C4/Record.pm b/C4/Record.pm index e36e035..af619ac 100644 --- a/C4/Record.pm +++ b/C4/Record.pm @@ -471,7 +471,7 @@ sub marcrecord2csv { my $output; # Getting the record - my $record = GetMarcBiblio($biblio); + my $record = GetMarcBiblio({ biblionumber => $biblio }); return unless $record; C4::Biblio::EmbedItemsInMarcBiblio( $record, $biblio, $itemnumbers ); # Getting the framework diff --git a/C4/Search.pm b/C4/Search.pm index fa920cf..9278f26 100644 --- a/C4/Search.pm +++ b/C4/Search.pm @@ -2008,7 +2008,9 @@ sub searchResults { my $hostbiblionumber = $hostfield->subfield("0"); my $linkeditemnumber = $hostfield->subfield("9"); if(!$hostbiblionumber eq undef){ - my $hostbiblio = GetMarcBiblio($hostbiblionumber, 1); + my $hostbiblio = GetMarcBiblio({ + biblionumber => $hostbiblionumber, + embed_items => 1 }); my ($itemfield, undef) = GetMarcFromKohaField( 'items.itemnumber', GetFrameworkCode($hostbiblionumber) ); if(!$hostbiblio eq undef){ my @hostitems = $hostbiblio->field($itemfield); diff --git a/C4/Serials.pm b/C4/Serials.pm index b4897c2..d79c0a5 100644 --- a/C4/Serials.pm +++ b/C4/Serials.pm @@ -1485,7 +1485,7 @@ sub NewSubscription { #set serial flag on biblio if not already set. my $biblio = Koha::Biblios->find( $biblionumber ); if ( $biblio and !$biblio->serial ) { - my $record = GetMarcBiblio($biblionumber); + my $record = GetMarcBiblio({ biblionumber => $biblionumber }); my ( $tag, $subf ) = GetMarcFromKohaField( 'biblio.serial', $biblio->frameworkcode ); if ($tag) { eval { $record->field($tag)->update( $subf => 1 ); }; diff --git a/C4/ShelfBrowser.pm b/C4/ShelfBrowser.pm index 8ae813a..ee551d2 100644 --- a/C4/ShelfBrowser.pm +++ b/C4/ShelfBrowser.pm @@ -223,7 +223,7 @@ sub GetShelfInfo { my $this_biblio = GetBibData($item->{biblionumber}); next unless defined $this_biblio; $item->{'title'} = $this_biblio->{'title'}; - my $this_record = GetMarcBiblio($this_biblio->{'biblionumber'}); + my $this_record = GetMarcBiblio({ biblionumber => $this_biblio->{'biblionumber'} }); $item->{'browser_normalized_upc'} = GetNormalizedUPC($this_record,$marcflavour); $item->{'browser_normalized_oclc'} = GetNormalizedOCLCNumber($this_record,$marcflavour); $item->{'browser_normalized_isbn'} = GetNormalizedISBN(undef,$this_record,$marcflavour); diff --git a/Koha/Biblio.pm b/Koha/Biblio.pm index aad4343..f4e5e2f 100644 --- a/Koha/Biblio.pm +++ b/Koha/Biblio.pm @@ -58,7 +58,11 @@ Keyword to MARC mapping for subtitle must be set for this method to return any p sub subtitles { my ( $self ) = @_; - return map { $_->{subfield} } @{ C4::Biblio::GetRecordValue( 'subtitle', C4::Biblio::GetMarcBiblio( $self->id ), $self->frameworkcode ) }; + return map { $_->{subfield} } @{ + C4::Biblio::GetRecordValue( + 'subtitle', + C4::Biblio::GetMarcBiblio({ biblionumber => $self->id }), + $self->frameworkcode ) }; } =head3 can_article_request diff --git a/Koha/BiblioUtils.pm b/Koha/BiblioUtils.pm index abb0721..73fc12a 100644 --- a/Koha/BiblioUtils.pm +++ b/Koha/BiblioUtils.pm @@ -121,7 +121,9 @@ sub get_all_biblios_iterator { while (1) { my $row = $rs->next(); return if !$row; - my $marc = C4::Biblio::GetMarcBiblio( $row->biblionumber, 1 ); + my $marc = C4::Biblio::GetMarcBiblio({ + biblionumber => $row->biblionumber, + embed_items => 1 }); my $next = eval { __PACKAGE__->new($marc, $row->biblionumber); }; @@ -158,7 +160,9 @@ If set to true, item data is embedded in the record. Default is to not do this. sub get_marc_biblio { my ($class, $bibnum, %options) = @_; - return C4::Biblio::GetMarcBiblio( $bibnum, ($options{item_data} ? 1 : 0 ) ); + return C4::Biblio::GetMarcBiblio({ + biblionumber => $bibnum, + embed_items => ($options{item_data} ? 1 : 0 ) }); } 1; diff --git a/Koha/Exporter/Record.pm b/Koha/Exporter/Record.pm index 193f87e..f9d62df 100644 --- a/Koha/Exporter/Record.pm +++ b/Koha/Exporter/Record.pm @@ -65,7 +65,7 @@ sub _get_biblio_for_export { my $export_items = $params->{export_items} // 1; my $only_export_items_for_branch = $params->{only_export_items_for_branch}; - my $record = eval { C4::Biblio::GetMarcBiblio($biblionumber); }; + my $record = eval { C4::Biblio::GetMarcBiblio({ biblionumber => $biblionumber }); }; return if $@ or not defined $record; diff --git a/Koha/OAI/Server/Repository.pm b/Koha/OAI/Server/Repository.pm index 50891c0..da136cd 100644 --- a/Koha/OAI/Server/Repository.pm +++ b/Koha/OAI/Server/Repository.pm @@ -160,7 +160,10 @@ sub get_biblio_marcxml { if ( my $conf = $self->{conf} ) { $with_items = $conf->{format}->{$format}->{include_items}; } - my $record = GetMarcBiblio($biblionumber, $with_items, 1); + my $record = GetMarcBiblio({ + biblionumber => $biblionumber, + embed_items => $with_items, + opac => 1 }); $record ? $record->as_xml_record() : undef; } diff --git a/basket/basket.pl b/basket/basket.pl index ae65a8e..76edc34 100755 --- a/basket/basket.pl +++ b/basket/basket.pl @@ -65,7 +65,7 @@ foreach my $biblionumber ( @bibs ) { my $dat = &GetBiblioData($biblionumber); next unless $dat; - my $record = &GetMarcBiblio($biblionumber); + my $record = &GetMarcBiblio({ biblionumber => $biblionumber }); $dat->{subtitle} = GetRecordValue('subtitle', $record, $fw); my $marcnotesarray = GetMarcNotes( $record, $marcflavour ); my $marcauthorsarray = GetMarcAuthors( $record, $marcflavour ); diff --git a/basket/downloadcart.pl b/basket/downloadcart.pl index 278b2c7..4653449 100755 --- a/basket/downloadcart.pl +++ b/basket/downloadcart.pl @@ -65,7 +65,9 @@ if ($bib_list && $format) { foreach my $biblio (@bibs) { - my $record = GetMarcBiblio($biblio, 1); + my $record = GetMarcBiblio({ + biblionumber => $biblio, + embed_items => 1 }); next unless $record; if ($format eq 'iso2709') { diff --git a/basket/sendbasket.pl b/basket/sendbasket.pl index 47bd1c9..224db2d 100755 --- a/basket/sendbasket.pl +++ b/basket/sendbasket.pl @@ -73,7 +73,9 @@ if ( $email_add ) { my $dat = GetBiblioData($biblionumber); next unless $dat; - my $record = GetMarcBiblio($biblionumber, 1); + my $record = GetMarcBiblio({ + biblionumber => $biblionumber, + embed_items => 1 }); my $marcauthorsarray = GetMarcAuthors( $record, $marcflavour ); my $marcsubjctsarray = GetMarcSubjects( $record, $marcflavour ); diff --git a/catalogue/ISBDdetail.pl b/catalogue/ISBDdetail.pl index f5fa00a..f58e1a9 100755 --- a/catalogue/ISBDdetail.pl +++ b/catalogue/ISBDdetail.pl @@ -78,7 +78,9 @@ if ( not defined $biblionumber ) { exit; } -my $record = GetMarcBiblio($biblionumber,1); +my $record = GetMarcBiblio({ + biblionumber => $biblionumber, + embed_items => 1 }); if ( not defined $record ) { # biblionumber invalid -> report and exit diff --git a/catalogue/MARCdetail.pl b/catalogue/MARCdetail.pl index 2152ffd..6474f3e 100755 --- a/catalogue/MARCdetail.pl +++ b/catalogue/MARCdetail.pl @@ -88,7 +88,9 @@ my ( $template, $loggedinuser, $cookie ) = get_template_and_user( } ); -my $record = GetMarcBiblio($biblionumber, 1); +my $record = GetMarcBiblio({ + biblionumber => $biblionumber, + embed_items => 1 }); $template->param( ocoins => GetCOinSBiblio($record) ); if ( not defined $record ) { diff --git a/catalogue/detail.pl b/catalogue/detail.pl index 221532f..1e18a1d 100755 --- a/catalogue/detail.pl +++ b/catalogue/detail.pl @@ -63,7 +63,7 @@ my ( $template, $borrowernumber, $cookie, $flags ) = get_template_and_user( my $biblionumber = $query->param('biblionumber'); $biblionumber = HTML::Entities::encode($biblionumber); -my $record = GetMarcBiblio($biblionumber); +my $record = GetMarcBiblio({ biblionumber => $biblionumber }); if ( not defined $record ) { # biblionumber invalid -> report and exit diff --git a/catalogue/export.pl b/catalogue/export.pl index f82250d..c10686c 100755 --- a/catalogue/export.pl +++ b/catalogue/export.pl @@ -28,7 +28,9 @@ if ($op eq "export") { my $biblionumber = $query->param("bib"); if ($biblionumber){ - my $marc = GetMarcBiblio($biblionumber, 1); + my $marc = GetMarcBiblio({ + biblionumber => $biblionumber, + embed_items => 1 }); if ($format =~ /endnote/) { $marc = marc2endnote($marc); diff --git a/catalogue/labeledMARCdetail.pl b/catalogue/labeledMARCdetail.pl index 090326d..d84c75f 100755 --- a/catalogue/labeledMARCdetail.pl +++ b/catalogue/labeledMARCdetail.pl @@ -56,7 +56,7 @@ my ( $template, $loggedinuser, $cookie ) = get_template_and_user( } ); -my $record = GetMarcBiblio($biblionumber); +my $record = GetMarcBiblio({ biblionumber => $biblionumber }); if ( not defined $record ) { # biblionumber invalid -> report and exit $template->param( unknownbiblionumber => 1, diff --git a/catalogue/moredetail.pl b/catalogue/moredetail.pl index 85b491a..5bc1d2f 100755 --- a/catalogue/moredetail.pl +++ b/catalogue/moredetail.pl @@ -100,7 +100,7 @@ for my $itm (@all_items) { ($itemnumber != $itm->{itemnumber})); } -my $record=GetMarcBiblio($biblionumber); +my $record=GetMarcBiblio({ biblionumber => $biblionumber }); my $hostrecords; # adding items linked via host biblios diff --git a/catalogue/showmarc.pl b/catalogue/showmarc.pl index a48a852..11c4f39 100755 --- a/catalogue/showmarc.pl +++ b/catalogue/showmarc.pl @@ -46,7 +46,7 @@ if ($importid) { $record = C4::ImportBatch::GetRecordFromImportBiblio( $importid, 'embed_items' ); } else { - $record =GetMarcBiblio($biblionumber); + $record =GetMarcBiblio({ biblionumber => $biblionumber }); } if(!ref $record) { print $input->redirect("/cgi-bin/koha/errors/404.pl"); diff --git a/cataloguing/addbiblio.pl b/cataloguing/addbiblio.pl index 013c312..b72d71f 100755 --- a/cataloguing/addbiblio.pl +++ b/cataloguing/addbiblio.pl @@ -770,7 +770,7 @@ my ( ); if (($biblionumber) && !($breedingid)){ - $record = GetMarcBiblio($biblionumber); + $record = GetMarcBiblio({ biblionumber => $biblionumber }); } if ($breedingid) { ( $record, $encoding ) = MARCfindbreeding( $breedingid ) ; diff --git a/cataloguing/additem.pl b/cataloguing/additem.pl index 9387072..eb18cc3 100755 --- a/cataloguing/additem.pl +++ b/cataloguing/additem.pl @@ -411,7 +411,7 @@ $restrictededition = 0 if ($restrictededition != 0 && C4::Context->IsSuperLibra $restrictededition = 0 if ($restrictededition != 0 && $frameworkcode eq 'FA' && haspermission($uid, {'editcatalogue' => 'fast_cataloging'})); my $tagslib = &GetMarcStructure(1,$frameworkcode); -my $record = GetMarcBiblio($biblionumber); +my $record = GetMarcBiblio({ biblionumber => $biblionumber }); my $oldrecord = TransformMarcToKoha($record); my $itemrecord; my $nextop="additem"; @@ -724,7 +724,7 @@ if ($op eq "additem") { #------------------------------------------------------------------------------- # now, build existiing item list -my $temp = GetMarcBiblio( $biblionumber ); +my $temp = GetMarcBiblio({ biblionumber => $biblionumber }); #my @fields = $record->fields(); @@ -748,7 +748,9 @@ if ( C4::Context->preference('EasyAnalyticalRecords') ) { foreach my $hostfield ($temp->field($analyticfield)){ my $hostbiblionumber = $hostfield->subfield('0'); if ($hostbiblionumber){ - my $hostrecord = GetMarcBiblio($hostbiblionumber, 1); + my $hostrecord = GetMarcBiblio({ + biblionumber => $hostbiblionumber, + embed_items => 1 }); if ($hostrecord) { my ($itemfield, undef) = GetMarcFromKohaField( 'items.itemnumber', GetFrameworkCode($hostbiblionumber) ); foreach my $hostitem ($hostrecord->field($itemfield)){ diff --git a/cataloguing/linkitem.pl b/cataloguing/linkitem.pl index 5f33c16..e23ff25 100755 --- a/cataloguing/linkitem.pl +++ b/cataloguing/linkitem.pl @@ -45,7 +45,7 @@ my ($template, $loggedinuser, $cookie) = get_template_and_user( } ); -my $biblio = GetMarcBiblio($biblionumber); +my $biblio = GetMarcBiblio({ biblionumber => $biblionumber }); my $marcflavour = C4::Context->preference("marcflavour"); $marcflavour ||="MARC21"; if ($marcflavour eq 'MARC21' || $marcflavour eq 'NORMARC') { diff --git a/cataloguing/merge.pl b/cataloguing/merge.pl index 11bb4e2..4594671 100755 --- a/cataloguing/merge.pl +++ b/cataloguing/merge.pl @@ -78,7 +78,7 @@ if ($merge) { } # Rewriting the leader - $record->leader(GetMarcBiblio($ref_biblionumber)->leader()); + $record->leader(GetMarcBiblio({ biblionumber => $ref_biblionumber })->leader()); my $frameworkcode = $input->param('frameworkcode'); my @notmoveditems; @@ -115,7 +115,7 @@ if ($merge) { my $report_header = {}; foreach my $biblionumber ($ref_biblionumber, @biblionumbers) { # build report - my $marcrecord = GetMarcBiblio($biblionumber); + my $marcrecord = GetMarcBiblio({ biblionumber => $biblionumber }); my %report_record = ( biblionumber => $biblionumber, fields => {}, @@ -202,7 +202,7 @@ if ($merge) { # Creating a loop for display my @records; foreach my $biblionumber (@biblionumbers) { - my $marcrecord = GetMarcBiblio($biblionumber); + my $marcrecord = GetMarcBiblio({ biblionumber => $biblionumber }); my $frameworkcode = GetFrameworkCode($biblionumber); my $recordObj = new Koha::MetadataRecord({'record' => $marcrecord, schema => $marcflavour}); my $record = { diff --git a/cataloguing/value_builder/marc21_linking_section.pl b/cataloguing/value_builder/marc21_linking_section.pl index 7efa49e..0fb9b7b 100755 --- a/cataloguing/value_builder/marc21_linking_section.pl +++ b/cataloguing/value_builder/marc21_linking_section.pl @@ -85,7 +85,7 @@ my $launcher = sub { ); #get marc record - $marcrecord = GetMarcBiblio($biblionumber); + $marcrecord = GetMarcBiblio({ biblionumber => $biblionumber }); my $subfield_value_9 = $biblionumber; my $subfield_value_0 = $biblionumber; diff --git a/cataloguing/value_builder/unimarc_field_4XX.pl b/cataloguing/value_builder/unimarc_field_4XX.pl index 75c9dec..c514349 100755 --- a/cataloguing/value_builder/unimarc_field_4XX.pl +++ b/cataloguing/value_builder/unimarc_field_4XX.pl @@ -96,7 +96,7 @@ sub plugin { ); #get marc record - $marcrecord = GetMarcBiblio($biblionumber); + $marcrecord = GetMarcBiblio({ biblionumber => $biblionumber }); my $subfield_value_9 = $biblionumber; my $subfield_value_0; diff --git a/circ/branchoverdues.pl b/circ/branchoverdues.pl index f334dd1..5f4f01f 100755 --- a/circ/branchoverdues.pl +++ b/circ/branchoverdues.pl @@ -110,7 +110,7 @@ if ($tagslib->{$tag}->{$subfield}->{authorised_value}) { # now display infos foreach my $num (@getoverdues) { my %overdueforbranch; - my $record = GetMarcBiblio($num->{biblionumber}); + my $record = GetMarcBiblio({ biblionumber => $num->{biblionumber} }); if ($record){ $overdueforbranch{'subtitle'} = GetRecordValue('subtitle',$record,'')->[0]->{subfield}; } diff --git a/circ/reserveratios.pl b/circ/reserveratios.pl index 56c84d8..e7c28c7 100755 --- a/circ/reserveratios.pl +++ b/circ/reserveratios.pl @@ -144,7 +144,7 @@ while ( my $data = $sth->fetchrow_hashref ) { my $thisratio = $data->{reservecount} / $data->{itemcount}; my $ratiocalc = ($thisratio / $ratio); ($thisratio / $ratio) >= 1 or next; # TODO: tighter targeting -- get ratio limit into SQL using HAVING clause - my $record = GetMarcBiblio($data->{biblionumber}); + my $record = GetMarcBiblio({ biblionumber => $data->{biblionumber} }); $data->{subtitle} = GetRecordValue('subtitle', $record, GetFrameworkCode($data->{biblionumber})); push( @reservedata, diff --git a/circ/transferstoreceive.pl b/circ/transferstoreceive.pl index 88f9aa6..0929ed3 100755 --- a/circ/transferstoreceive.pl +++ b/circ/transferstoreceive.pl @@ -109,7 +109,7 @@ while ( my $library = $libraries->next ) { itemcallnumber => $item->itemcallnumber, ); - my $record = GetMarcBiblio($biblio->biblionumber); + my $record = GetMarcBiblio({ biblionumber => $biblio->biblionumber }); $getransf{'subtitle'} = GetRecordValue('subtitle', $record, $biblio->frameworkcode); # we check if we have a reserv for this transfer diff --git a/circ/waitingreserves.pl b/circ/waitingreserves.pl index 555d04e..55c5c07 100755 --- a/circ/waitingreserves.pl +++ b/circ/waitingreserves.pl @@ -113,7 +113,10 @@ foreach my $num (@getreserves) { $getreserv{'itemtype'} = $itemtype->description; # FIXME Should not it be translated_description? $getreserv{'title'} = $biblio->title; - $getreserv{'subtitle'} = GetRecordValue('subtitle', GetMarcBiblio($biblio->biblionumber), $biblio->frameworkcode); + $getreserv{'subtitle'} = GetRecordValue( + 'subtitle', + GetMarcBiblio({ biblionumber => $biblio->biblionumber }), + $biblio->frameworkcode); $getreserv{'biblionumber'} = $biblio->biblionumber; $getreserv{'barcode'} = $item->barcode; $getreserv{'homebranch'} = $homebranch; diff --git a/misc/batchRebuildBiblioTables.pl b/misc/batchRebuildBiblioTables.pl index dc4175c..5db801b 100755 --- a/misc/batchRebuildBiblioTables.pl +++ b/misc/batchRebuildBiblioTables.pl @@ -61,7 +61,7 @@ $sth->execute; my @errors; while (my ($biblionumber)= $sth->fetchrow) { #now, parse the record, extract the item fields, and store them in somewhere else. - my $record = GetMarcBiblio($biblionumber); + my $record = GetMarcBiblio({ biblionumber => $biblionumber }); if (not defined $record) { push @errors, $biblionumber; next; diff --git a/misc/batchRebuildItemsTables.pl b/misc/batchRebuildItemsTables.pl index 5545607..e0499c0 100755 --- a/misc/batchRebuildItemsTables.pl +++ b/misc/batchRebuildItemsTables.pl @@ -68,7 +68,9 @@ $sth->execute(); while ( my ( $biblionumber, $biblioitemnumber, $frameworkcode ) = $sth->fetchrow ) { $count++; warn $count unless $count % 1000; - my $record = GetMarcBiblio( $biblionumber, 1 ); + my $record = GetMarcBiblio({ + biblionummber => $biblionumber, + embed_items => 1 }); unless ($record) { push @errors, "bad record biblionumber $biblionumber"; next; } unless ($test_parameter) { diff --git a/misc/batchRepairMissingBiblionumbers.pl b/misc/batchRepairMissingBiblionumbers.pl index 3b3c345..ca8064c 100755 --- a/misc/batchRepairMissingBiblionumbers.pl +++ b/misc/batchRepairMissingBiblionumbers.pl @@ -24,7 +24,7 @@ my $sth=$dbh->prepare("SELECT biblio.biblionumber, biblioitemnumber, frameworkco $sth->execute(); while (my ($biblionumber,$biblioitemnumber,$frameworkcode)=$sth->fetchrow ){ - my $record = GetMarcBiblio($biblionumber); + my $record = GetMarcBiblio({ biblionumber => $biblionumber }); C4::Biblio::_koha_marc_update_bib_ids($record, $frameworkcode, $biblionumber, $biblioitemnumber); my $biblionumber = eval {ModBiblioMarc( $record, $biblionumber, $frameworkcode )}; if($@){ diff --git a/misc/cronjobs/build_browser_and_cloud.pl b/misc/cronjobs/build_browser_and_cloud.pl index 1c74744..d5e0d1a 100755 --- a/misc/cronjobs/build_browser_and_cloud.pl +++ b/misc/cronjobs/build_browser_and_cloud.pl @@ -91,7 +91,7 @@ while ((my ($biblionumber)= $sth->fetchrow)) { #now, parse the record, extract the item fields, and store them in somewhere else. my $Koharecord; eval{ - $Koharecord = GetMarcBiblio($biblionumber); + $Koharecord = GetMarcBiblio({ biblionumber => $biblionumber }); }; if($@){ warn 'pb when getting biblio '.$i.' : '.$@; diff --git a/misc/cronjobs/check-url-quick.pl b/misc/cronjobs/check-url-quick.pl index e599808..f9b1c32 100755 --- a/misc/cronjobs/check-url-quick.pl +++ b/misc/cronjobs/check-url-quick.pl @@ -90,7 +90,7 @@ sub check_all_url { cb => sub { return if $count > $maxconn; while ( my ($biblionumber) = $sth->fetchrow ) { - my $record = GetMarcBiblio($biblionumber); + my $record = GetMarcBiblio({ biblionumber => $biblionumber }); for my $tag (@tags) { foreach my $field ( $record->field($tag) ) { my $url = $field->subfield('u'); diff --git a/misc/cronjobs/check-url.pl b/misc/cronjobs/check-url.pl index 71885ab..5c0957b 100755 --- a/misc/cronjobs/check-url.pl +++ b/misc/cronjobs/check-url.pl @@ -105,7 +105,7 @@ sub check_biblio { my $host = $self->{ host_default }; my $bad_url = $self->{ bad_url }; - my $record = GetMarcBiblio( $biblionumber ); + my $record = GetMarcBiblio({ biblionumber => $biblionumber }); return unless $record->field('856'); my @urls = (); diff --git a/misc/link_bibs_to_authorities.pl b/misc/link_bibs_to_authorities.pl index 37596c5..b139a76 100755 --- a/misc/link_bibs_to_authorities.pl +++ b/misc/link_bibs_to_authorities.pl @@ -187,7 +187,7 @@ sub process_bib { my $linker = shift; my $biblionumber = shift; - my $bib = GetMarcBiblio($biblionumber); + my $bib = GetMarcBiblio({ biblionumber => $biblionumber }); unless ( defined $bib ) { print "\nCould not retrieve bib $biblionumber from the database - record is corrupt.\n"; diff --git a/misc/maintenance/UNIMARC_sync_date_created_with_marc_biblio.pl b/misc/maintenance/UNIMARC_sync_date_created_with_marc_biblio.pl index 9c3fd01..a46dc7b 100755 --- a/misc/maintenance/UNIMARC_sync_date_created_with_marc_biblio.pl +++ b/misc/maintenance/UNIMARC_sync_date_created_with_marc_biblio.pl @@ -87,7 +87,7 @@ my $sth_prepared; sub updateMarc { my $id = shift; - my $biblio = GetMarcBiblio($id); + my $biblio = GetMarcBiblio({ biblionumber => $id }); unless ($biblio) { $debug and warn '[ERROR] GetMarcBiblio did not return any biblio.'; diff --git a/misc/maintenance/process_record_through_filter.pl b/misc/maintenance/process_record_through_filter.pl index 3b3e537..baf137a 100755 --- a/misc/maintenance/process_record_through_filter.pl +++ b/misc/maintenance/process_record_through_filter.pl @@ -10,7 +10,7 @@ use Koha::RecordProcessor; use Data::Dumper; use C4::Biblio; -my $record = GetMarcBiblio($ARGV[0]); +my $record = GetMarcBiblio({ biblionumber => $ARGV[0] }); print "Before: " . $record->as_formatted() . "\n"; my $processor = Koha::RecordProcessor->new( { filters => ( $ARGV[1] ) }); diff --git a/misc/maintenance/remove_items_from_biblioitems.pl b/misc/maintenance/remove_items_from_biblioitems.pl index 9af69c9..597195e 100755 --- a/misc/maintenance/remove_items_from_biblioitems.pl +++ b/misc/maintenance/remove_items_from_biblioitems.pl @@ -49,7 +49,7 @@ while (my $biblionumber = $query->fetchrow){ $count++; print "." unless $silent; print "\r$count" unless ($silent or ($count % 100)); - my $record = GetMarcBiblio($biblionumber); + my $record = GetMarcBiblio({ biblionumber => $biblionumber }); if ($record) { ModBiblio($record, $biblionumber, GetFrameworkCode($biblionumber)) ; diff --git a/misc/maintenance/sanitize_records.pl b/misc/maintenance/sanitize_records.pl index 42123d1..7079ea0 100755 --- a/misc/maintenance/sanitize_records.pl +++ b/misc/maintenance/sanitize_records.pl @@ -108,7 +108,7 @@ for my $biblionumber (@biblionumbers) { say " skipping. ERROR: Invalid biblionumber." if $verbose; next; } - my $record = C4::Biblio::GetMarcBiblio($biblionumber); + my $record = C4::Biblio::GetMarcBiblio({ biblionumber => $biblionumber }); unless ($record) { say " skipping. ERROR: Invalid record." if $verbose; next; diff --git a/misc/maintenance/touch_all_biblios.pl b/misc/maintenance/touch_all_biblios.pl index ec48091..d091089 100755 --- a/misc/maintenance/touch_all_biblios.pl +++ b/misc/maintenance/touch_all_biblios.pl @@ -78,7 +78,7 @@ $sth1->execute(); # fetch info from the search while (my ($biblionumber, $frameworkcode) = $sth1->fetchrow_array){ - my $record = GetMarcBiblio($biblionumber); + my $record = GetMarcBiblio({ biblionumber => $biblionumber }); my $modok = ModBiblio($record, $biblionumber, $frameworkcode); diff --git a/misc/migration_tools/buildEDITORS.pl b/misc/migration_tools/buildEDITORS.pl index 0126ae6..f5e1a71 100755 --- a/misc/migration_tools/buildEDITORS.pl +++ b/misc/migration_tools/buildEDITORS.pl @@ -70,7 +70,7 @@ my %alreadydone; my $counter; my %hash; while (my ($bibid) = $sth->fetchrow) { - my $record = GetMarcBiblio($bibid); + my $record = GetMarcBiblio({ biblionumber => $bibid }); my $isbnField = $record->field('010'); next unless $isbnField; my $isbn=$isbnField->subfield('a'); @@ -182,8 +182,8 @@ exit; # # OK, on garde la notice d'autorit� on cherche les notices biblio et on les met �jour... # if ($fieldnumber eq '710') { # $sthBIBLIOS710->execute($authentry); -# while (my ($bibid,$tag,$tagorder,$subfieldorder) = $sthBIBLIOS710->fetchrow) { -# my $inbiblio = GetMarcBiblio($bibid); +# while (my ($bibid,$tag,$tagorder,$subfieldorder) = $sthBIBLIOS710->fetchrow) { +# my $inbiblio = GetMarcBiblio({ biblionumber => $bibid }); # my $isOK = 0; # foreach my $in7xx ($inbiblio->field($fieldnumber)) { # # !!!!! ici, il faut reconstruire l'entr� de la table de hachage comme ci dessus @@ -203,7 +203,7 @@ exit; # if ($fieldnumber eq '711') { # $sthBIBLIOS711->execute($authentry); # while (my ($bibid,$tag,$tagorder,$subfieldorder) = $sthBIBLIOS711->fetchrow) { -# my $inbiblio = GetMarcBiblio($bibid); +# my $inbiblio = GetMarcBiblio({ biblionumber => $bibid }); # my $isOK = 0; # foreach my $in7xx ($inbiblio->field($fieldnumber)) { # # !!!!! ici, il faut reconstruire l'entr� de la table de hachage comme ci dessus @@ -223,7 +223,7 @@ exit; # if ($fieldnumber eq '712') { # $sthBIBLIOS712->execute($authentry); # while (my ($bibid,$tag,$tagorder,$subfieldorder) = $sthBIBLIOS712->fetchrow) { -# my $inbiblio = GetMarcBiblio($bibid); +# my $inbiblio = GetMarcBiblio({ biblionumber => $bibid }); # my $isOK = 0; # foreach my $in7xx ($inbiblio->field($fieldnumber)) { # # !!!!! ici, il faut reconstruire l'entr� de la table de hachage comme ci dessus diff --git a/misc/migration_tools/create_analytical_rel.pl b/misc/migration_tools/create_analytical_rel.pl index 3069a34..a06305f 100755 --- a/misc/migration_tools/create_analytical_rel.pl +++ b/misc/migration_tools/create_analytical_rel.pl @@ -81,7 +81,7 @@ _SUMMARY_ sub process_bib { my $biblionumber = shift; - my $bib = GetMarcBiblio($biblionumber); + my $bib = GetMarcBiblio({ biblionumber => $biblionumber }); unless (defined $bib) { print "\nCould not retrieve bib $biblionumber from the database - record is corrupt.\n"; $num_bad_bibs++; diff --git a/misc/migration_tools/import_lexile.pl b/misc/migration_tools/import_lexile.pl index b185c04..131db44 100755 --- a/misc/migration_tools/import_lexile.pl +++ b/misc/migration_tools/import_lexile.pl @@ -152,7 +152,7 @@ while ( my $row = $csv->getline_hr($fh) ) { foreach my $biblionumber (@biblionumbers) { $counter++; - my $record = GetMarcBiblio($biblionumber); + my $record = GetMarcBiblio({ biblionumber => $biblionumber }); if ($verbose) { say "Found matching record! Biblionumber: $biblionumber"; diff --git a/misc/migration_tools/rebuild_zebra.pl b/misc/migration_tools/rebuild_zebra.pl index 28ce27c..5e43cd6 100755 --- a/misc/migration_tools/rebuild_zebra.pl +++ b/misc/migration_tools/rebuild_zebra.pl @@ -675,7 +675,7 @@ sub get_raw_marc_record { my $marc; if ($record_type eq 'biblio') { - eval { $marc = GetMarcBiblio($record_number, 1); }; + eval { $marc = GetMarcBiblio({ biblionumber => $record_number, embed_items => 1 }); }; if ($@ || !$marc) { # here we do warn since catching an exception # means that the bib was found but failed diff --git a/misc/migration_tools/switch_marc21_series_info.pl b/misc/migration_tools/switch_marc21_series_info.pl index a51f830..ef05f0a 100755 --- a/misc/migration_tools/switch_marc21_series_info.pl +++ b/misc/migration_tools/switch_marc21_series_info.pl @@ -139,7 +139,7 @@ while ( my ( $biblionumber ) = $bibs_sth->fetchrow ) { my ( @newfields ); # Get biblio marc - my $biblio = GetMarcBiblio( $biblionumber ); + my $biblio = GetMarcBiblio({ biblionumber => $biblionumber }); foreach my $field ( $biblio->field( '440' ) ) { my @newsubfields; diff --git a/misc/migration_tools/upgradeitems.pl b/misc/migration_tools/upgradeitems.pl index c5469ee..e3f11d6 100755 --- a/misc/migration_tools/upgradeitems.pl +++ b/misc/migration_tools/upgradeitems.pl @@ -18,7 +18,7 @@ my $rqitemnumber=$dbh->prepare("SELECT itemnumber, biblionumber from items where $rqbiblios->execute; $|=1; while (my ($biblionumber)= $rqbiblios->fetchrow_array){ - my $record=GetMarcBiblio($biblionumber); + my $record=GetMarcBiblio({ biblionumber => $biblionumber }); foreach my $itemfield ($record->field('995')){ my $marcitem=MARC::Record->new(); $marcitem->encoding('UTF-8'); diff --git a/opac/opac-ISBDdetail.pl b/opac/opac-ISBDdetail.pl index f341884..a3cb1a9 100755 --- a/opac/opac-ISBDdetail.pl +++ b/opac/opac-ISBDdetail.pl @@ -93,7 +93,9 @@ if (scalar @items >= 1) { } } -my $record = GetMarcBiblio($biblionumber,1); +my $record = GetMarcBiblio({ + biblionumber => $biblionumber, + embed_items => 1 }); if ( ! $record ) { print $query->redirect("/cgi-bin/koha/errors/404.pl"); exit; diff --git a/opac/opac-MARCdetail.pl b/opac/opac-MARCdetail.pl index a899e92..9605cdd 100755 --- a/opac/opac-MARCdetail.pl +++ b/opac/opac-MARCdetail.pl @@ -71,7 +71,9 @@ if ( ! $biblionumber ) { exit; } -my $record = GetMarcBiblio($biblionumber, 1); +my $record = GetMarcBiblio({ + biblionumber => $biblionumber, + embed_items => 1 }); if ( ! $record ) { print $query->redirect("/cgi-bin/koha/errors/404.pl"); exit; diff --git a/opac/opac-basket.pl b/opac/opac-basket.pl index bfa9688..f842587 100755 --- a/opac/opac-basket.pl +++ b/opac/opac-basket.pl @@ -65,7 +65,7 @@ foreach my $biblionumber ( @bibs ) { my $dat = &GetBiblioData($biblionumber); next unless $dat; - my $record = &GetMarcBiblio( $biblionumber ); + my $record = &GetMarcBiblio({ biblionumber => $biblionumber }); my $framework = &GetFrameworkCode( $biblionumber ); $record_processor->options({ interface => 'opac', diff --git a/opac/opac-detail.pl b/opac/opac-detail.pl index ae89f82..8252e50 100755 --- a/opac/opac-detail.pl +++ b/opac/opac-detail.pl @@ -90,7 +90,7 @@ if (scalar @all_items >= 1) { } } -my $record = GetMarcBiblio($biblionumber); +my $record = GetMarcBiblio({ biblionumber => $biblionumber }); if ( ! $record ) { print $query->redirect("/cgi-bin/koha/errors/404.pl"); # escape early exit; diff --git a/opac/opac-downloadcart.pl b/opac/opac-downloadcart.pl index d20000e..76fa095 100755 --- a/opac/opac-downloadcart.pl +++ b/opac/opac-downloadcart.pl @@ -68,7 +68,9 @@ if ($bib_list && $format) { }); foreach my $biblio (@bibs) { - my $record = GetMarcBiblio($biblio, 1); + my $record = GetMarcBiblio({ + biblionumber => $biblio, + embed_items => 1 }); my $framework = &GetFrameworkCode( $biblio ); $record_processor->options({ interface => 'opac', diff --git a/opac/opac-downloadshelf.pl b/opac/opac-downloadshelf.pl index b91f3a3..007dd5f 100755 --- a/opac/opac-downloadshelf.pl +++ b/opac/opac-downloadshelf.pl @@ -81,7 +81,9 @@ if ( $shelf and $shelf->can_be_viewed( $borrowernumber ) ) { while ( my $content = $contents->next ) { my $biblionumber = $content->biblionumber; - my $record = GetMarcBiblio($biblionumber, 1); + my $record = GetMarcBiblio({ + biblionumber => $biblionumber, + embed_items => 1 }); my $framework = &GetFrameworkCode( $biblionumber ); $record_processor->options({ interface => 'opac', diff --git a/opac/opac-export.pl b/opac/opac-export.pl index c0f18bf..6023d78 100755 --- a/opac/opac-export.pl +++ b/opac/opac-export.pl @@ -36,8 +36,11 @@ $biblionumber = int($biblionumber); my $error = q{}; my $include_items = ($format =~ /bibtex/) ? 0 : 1; -my $marc = GetMarcBiblio($biblionumber, $include_items) - if $biblionumber; +my $marc = $biblionumber + ? GetMarcBiblio({ + biblionumber => $biblionumber, + embed_items => $include_items }) + : undef; if(!$marc) { print $query->redirect("/cgi-bin/koha/errors/404.pl"); diff --git a/opac/opac-reserve.pl b/opac/opac-reserve.pl index 5312449..95204b3 100755 --- a/opac/opac-reserve.pl +++ b/opac/opac-reserve.pl @@ -159,7 +159,7 @@ foreach my $biblioNumber (@biblionumbers) { my @itemInfos = GetItemsInfo($biblioNumber); - my $marcrecord= GetMarcBiblio($biblioNumber); + my $marcrecord= GetMarcBiblio({ biblionumber => $biblioNumber }); # flag indicating existence of at least one item linked via a host record my $hostitemsflag; @@ -401,7 +401,7 @@ $template->param('item_level_itypes' => $itemLevelTypes); foreach my $biblioNum (@biblionumbers) { my @not_available_at = (); - my $record = GetMarcBiblio($biblioNum); + my $record = GetMarcBiblio({ biblionumber => $biblioNum }); # Init the bib item with the choices for branch pickup my %biblioLoopIter; diff --git a/opac/opac-search.pl b/opac/opac-search.pl index 2272587..c10e958 100755 --- a/opac/opac-search.pl +++ b/opac/opac-search.pl @@ -659,7 +659,7 @@ for (my $i=0;$i<@servers;$i++) { } if (C4::Context->preference('COinSinOPACResults')) { - my $record = GetMarcBiblio($res->{'biblionumber'}); + my $record = GetMarcBiblio({ biblionumber => $res->{'biblionumber'} }); $res->{coins} = GetCOinSBiblio($record); } if ( C4::Context->preference( "Babeltheque" ) and $res->{normalized_isbn} ) { diff --git a/opac/opac-sendbasket.pl b/opac/opac-sendbasket.pl index b7167e8..c51e8c4 100755 --- a/opac/opac-sendbasket.pl +++ b/opac/opac-sendbasket.pl @@ -87,7 +87,9 @@ if ( $email_add ) { my $dat = GetBiblioData($biblionumber); next unless $dat; - my $record = GetMarcBiblio($biblionumber, 1); + my $record = GetMarcBiblio({ + biblionumber => $biblionumber, + embed_items => 1 }); my $marcauthorsarray = GetMarcAuthors( $record, $marcflavour ); my $marcsubjctsarray = GetMarcSubjects( $record, $marcflavour ); diff --git a/opac/opac-sendshelf.pl b/opac/opac-sendshelf.pl index e58ce7c..3c19e61 100755 --- a/opac/opac-sendshelf.pl +++ b/opac/opac-sendshelf.pl @@ -90,7 +90,9 @@ if ( $email ) { my $biblionumber = $content->biblionumber; my $fw = GetFrameworkCode($biblionumber); my $dat = GetBiblioData($biblionumber); - my $record = GetMarcBiblio($biblionumber, 1); + my $record = GetMarcBiblio({ + biblionumber => $biblionumber, + embed_items => 1 }); my $marcauthorsarray = GetMarcAuthors( $record, $marcflavour ); my $marcsubjctsarray = GetMarcSubjects( $record, $marcflavour ); my $subtitle = GetRecordValue('subtitle', $record, $fw); diff --git a/opac/opac-shelves.pl b/opac/opac-shelves.pl index e790b43..e5b9cc6 100755 --- a/opac/opac-shelves.pl +++ b/opac/opac-shelves.pl @@ -270,7 +270,7 @@ if ( $op eq 'view' ) { while ( my $content = $contents->next ) { my $biblionumber = $content->biblionumber; my $this_item = GetBiblioData($biblionumber); - my $record = GetMarcBiblio($biblionumber); + my $record = GetMarcBiblio({ biblionumber => $biblionumber }); my $framework = GetFrameworkCode( $biblionumber ); $record_processor->options({ interface => 'opac', diff --git a/opac/opac-showmarc.pl b/opac/opac-showmarc.pl index 250c519..1eced61 100755 --- a/opac/opac-showmarc.pl +++ b/opac/opac-showmarc.pl @@ -47,7 +47,7 @@ if ($importid) { $record = MARC::Record->new_from_usmarc($marc); } else { - $record = GetMarcBiblio($biblionumber); + $record = GetMarcBiblio({ biblionumber => $biblionumber }); my $framework = GetFrameworkCode($biblionumber); $record_processor->options({ interface => 'opac', diff --git a/opac/opac-showreviews.pl b/opac/opac-showreviews.pl index 84eba04..b844167 100755 --- a/opac/opac-showreviews.pl +++ b/opac/opac-showreviews.pl @@ -91,7 +91,7 @@ for my $result (@$reviews){ my $biblionumber = $result->{biblionumber}; my $biblio = Koha::Biblios->find( $biblionumber ); my $biblioitem = $biblio->biblioitem; - my $record = GetMarcBiblio($biblionumber); + my $record = GetMarcBiblio({ biblionumber => $biblionumber }); my $frameworkcode = GetFrameworkCode($biblionumber); my $borr = Koha::Patrons->find( $result->{borrowernumber} )->unblessed; $result->{normalized_upc} = GetNormalizedUPC($record,$marcflavour); diff --git a/opac/opac-tags.pl b/opac/opac-tags.pl index 873a9c5..267c3c0 100755 --- a/opac/opac-tags.pl +++ b/opac/opac-tags.pl @@ -232,7 +232,7 @@ if ($loggedinuser) { my $my_approved_tags = get_approval_rows({ approved => 1 }); foreach my $tag (@$my_tags) { my $biblio = Koha::Biblios->find( $tag->{biblionumber} ); - my $record = &GetMarcBiblio( $tag->{biblionumber} ); + my $record = &GetMarcBiblio({ biblionumber => $tag->{biblionumber} }); $tag->{subtitle} = GetRecordValue( 'subtitle', $record, GetFrameworkCode( $tag->{biblionumber} ) ); $tag->{title} = $biblio->title; $tag->{author} = $biblio->author; diff --git a/opac/opac-user.pl b/opac/opac-user.pl index e7c3a06..bc39c80 100755 --- a/opac/opac-user.pl +++ b/opac/opac-user.pl @@ -204,7 +204,7 @@ if ($issues){ } $issue->{'charges'} = $charges; $issue->{'rentalfines'} = $rentalfines; - my $marcrecord = GetMarcBiblio( $issue->{'biblionumber'} ); + my $marcrecord = GetMarcBiblio({ biblionumber => $issue->{'biblionumber'} }); $issue->{'subtitle'} = GetRecordValue('subtitle', $marcrecord, GetFrameworkCode($issue->{'biblionumber'})); # check if item is renewable my ($status,$renewerror) = CanBookBeRenewed( $borrowernumber, $issue->{'itemnumber'} ); diff --git a/serials/subscription-add.pl b/serials/subscription-add.pl index c73b28d..1849ed7 100755 --- a/serials/subscription-add.pl +++ b/serials/subscription-add.pl @@ -439,7 +439,9 @@ sub redirect_mod_subscription { sub insert_additional_fields { my ( $additional_fields, $biblionumber, $subscriptionid ) = @_; - my $record = GetMarcBiblio( $biblionumber, 1 ); + my $record = GetMarcBiblio({ + biblionumber => $biblionumber, + embed_items => 1 }); for my $field ( @$additional_fields ) { my $af = Koha::AdditionalField->new({ id => $field->{id} })->fetch; if ( $af->{marcfield} ) { diff --git a/svc/bib b/svc/bib index 789951b..2e5f38d 100755 --- a/svc/bib +++ b/svc/bib @@ -66,7 +66,9 @@ exit 0; sub fetch_bib { my $query = shift; my $biblionumber = shift; - my $record = GetMarcBiblio( $biblionumber, $query->url_param('items') ); + my $record = GetMarcBiblio({ + biblionumber => $biblionumber, + embed_items => $query->url_param('items') }); if (defined $record) { print $query->header(-type => 'text/xml',-charset => 'utf-8',); print $record->as_xml_record(); @@ -78,7 +80,7 @@ sub fetch_bib { sub update_bib { my $query = shift; my $biblionumber = shift; - my $old_record = GetMarcBiblio($biblionumber); + my $old_record = GetMarcBiblio({ biblionumber => $biblionumber }); unless (defined $old_record) { print $query->header(-type => 'text/xml', -status => '404 Not Found'); return; @@ -113,8 +115,9 @@ sub update_bib { } ModBiblio( $record, $biblionumber, '' ); - my $new_record = - GetMarcBiblio( $biblionumber, $query->url_param('items') ); + my $new_record = GetMarcBiblio({ + biblionumber => $biblionumber, + embed_items => $query->url_param('items') }); $result->{'status'} = "ok"; $result->{'biblionumber'} = $biblionumber; diff --git a/svc/checkouts b/svc/checkouts index d8d6156..98251b5 100755 --- a/svc/checkouts +++ b/svc/checkouts @@ -209,8 +209,10 @@ while ( my $c = $sth->fetchrow_hashref() ) { as_due_date => 1 } ), - subtitle => - GetRecordValue( 'subtitle', GetMarcBiblio( $c->{biblionumber} ), GetFrameworkCode( $c->{biblionumber} ) ), + subtitle => GetRecordValue( + 'subtitle', + GetMarcBiblio({ biblionumber => $c->{biblionumber} }), + GetFrameworkCode( $c->{biblionumber} ) ), lost => $lost, damaged => $damaged, borrower => { diff --git a/svc/holds b/svc/holds index 4642356..5c0ed35 100755 --- a/svc/holds +++ b/svc/holds @@ -103,7 +103,8 @@ while ( my $h = $holds_rs->next() ) { priority => $h->priority(), itemtype_limit => $itemtype_limit, subtitle => GetRecordValue( - 'subtitle', GetMarcBiblio($biblionumber), + 'subtitle', + GetMarcBiblio({ biblionumber => $biblionumber }), GetFrameworkCode($biblionumber) ), reservedate_formatted => $h->reservedate() ? output_pref( diff --git a/svc/new_bib b/svc/new_bib index ba6742a..fc9be48 100755 --- a/svc/new_bib +++ b/svc/new_bib @@ -75,7 +75,7 @@ sub add_bib { $record->delete_field($field); } my ( $biblionumber, $biblioitemnumber ) = AddBiblio( $record, '' ); - my $new_record = GetMarcBiblio($biblionumber); + my $new_record = GetMarcBiblio({ biblionumber => $biblionumber }); if ( $query->url_param('items') ) { foreach my $field ( $fullrecord->field($itemtag) ) { my $one_item_record = $new_record->clone(); @@ -84,8 +84,9 @@ sub add_bib { } } - $new_record = - GetMarcBiblio( $biblionumber, $query->url_param('items') ); + $new_record = GetMarcBiblio({ + biblionumber => $biblionumber, + embed_items => $query->url_param('items') }); $result->{'status'} = "ok"; $result->{'biblionumber'} = $biblionumber; my $xml = $new_record->as_xml_record(); diff --git a/svc/records/preview b/svc/records/preview index c1bdc67..e4855c7 100755 --- a/svc/records/preview +++ b/svc/records/preview @@ -32,7 +32,7 @@ my $mmtid = $query->param('mmtid'); # Marc modification template id my $record; if ( $record_type eq 'biblio' ) { - $record = GetMarcBiblio( $record_id ); + $record = GetMarcBiblio({ biblionumber => $record_id }); } else { my $authority = Koha::MetadataRecord::Authority->get_from_authid( $record_id ); $record = $authority->record; diff --git a/t/Biblio.t b/t/Biblio.t index 8fd388f..4ade7cc 100755 --- a/t/Biblio.t +++ b/t/Biblio.t @@ -25,7 +25,7 @@ use Module::Load::Conditional qw/check_install/; BEGIN { if ( check_install( module => 'Test::DBIx::Class' ) ) { - plan tests => 46; + plan tests => 47; } else { plan skip_all => "Need Test::DBIx::Class" } @@ -181,6 +181,10 @@ warning_is { $ret = RemoveAllNsb() } ok( !defined $ret, 'RemoveAllNsb returns undef if not passed rec'); warning_is { $ret = GetMarcBiblio() } + { carped => 'GetMarcBiblio called without parameters'}, + "GetMarcBiblio returns carped warning on no parameters"; + +warning_is { $ret = GetMarcBiblio({ biblionumber => undef }) } { carped => 'GetMarcBiblio called with undefined biblionumber'}, "GetMarcBiblio returns carped warning on undef biblionumber"; diff --git a/t/db_dependent/Authorities/Merge.t b/t/db_dependent/Authorities/Merge.t index b2cd97e..29f6a80 100755 --- a/t/db_dependent/Authorities/Merge.t +++ b/t/db_dependent/Authorities/Merge.t @@ -94,13 +94,13 @@ subtest 'Test merge A1 to A2 (within same authtype)' => sub { is( $rv, 1, 'We expect one biblio record (out of two) to be updated' ); # Check the results - my $newbiblio1 = GetMarcBiblio($biblionumber1); + my $newbiblio1 = GetMarcBiblio({ biblionumber => $biblionumber1 }); compare_fields( $biblio1, $newbiblio1, {}, 'count' ); compare_fields( $biblio1, $newbiblio1, {}, 'order' ); is( $newbiblio1->subfield('609', '9'), $authid1, 'Check biblio1 609$9' ); is( $newbiblio1->subfield('609', 'a'), 'George Orwell', 'Check biblio1 609$a' ); - my $newbiblio2 = GetMarcBiblio($biblionumber2); + my $newbiblio2 = GetMarcBiblio({ biblionumber => $biblionumber2 }); compare_fields( $biblio2, $newbiblio2, {}, 'count' ); compare_fields( $biblio2, $newbiblio2, {}, 'order' ); is( $newbiblio2->subfield('609', '9'), $authid1, 'Check biblio2 609$9' ); @@ -138,11 +138,11 @@ subtest 'Test merge A1 to modified A1, test strict mode' => sub { is( $rv, 2, 'Both records are updated now' ); #Check the results - my $biblio1 = GetMarcBiblio($biblionumber1); + my $biblio1 = GetMarcBiblio({ biblionumber => $biblionumber1 }); compare_fields( $MARC1, $biblio1, {}, 'count' ); compare_fields( $MARC1, $biblio1, {}, 'order' ); is( $auth1new->field(109)->subfield('a'), $biblio1->field(109)->subfield('a'), 'Record1 values updated correctly' ); - my $biblio2 = GetMarcBiblio( $biblionumber2 ); + my $biblio2 = GetMarcBiblio({ biblionumber => $biblionumber2 }); compare_fields( $MARC2, $biblio2, {}, 'count' ); compare_fields( $MARC2, $biblio2, {}, 'order' ); is( $auth1new->field(109)->subfield('a'), $biblio2->field(109)->subfield('a'), 'Record2 values updated correctly' ); @@ -154,7 +154,7 @@ subtest 'Test merge A1 to modified A1, test strict mode' => sub { ModBiblio( $MARC1, $biblionumber1, '' ); @linkedrecords = ( $biblionumber1 ); $rv = C4::AuthoritiesMarc::merge({ mergefrom => $authid1, MARCfrom => $auth1old, mergeto => $authid1, MARCto => $auth1new }); - $biblio1 = GetMarcBiblio($biblionumber1); + $biblio1 = GetMarcBiblio({ biblionumber => $biblionumber1 }); is( $biblio1->field(109)->subfield('b'), undef, 'Subfield overwritten in strict mode' ); compare_fields( $MARC1, $biblio1, { 609 => 1 }, 'count' ); my @old609 = $MARC1->field('609'); @@ -195,7 +195,7 @@ subtest 'Test merge A1 to B1 (changing authtype)' => sub { MARC::Field->new( '612', '', '', a => 'unrelated', 9 => 'other' ), ); my ( $biblionumber ) = C4::Biblio::AddBiblio( $marc, '' ); - my $oldbiblio = C4::Biblio::GetMarcBiblio( $biblionumber ); + my $oldbiblio = C4::Biblio::GetMarcBiblio({ biblionumber => $biblionumber }); # Time to merge @linkedrecords = ( $biblionumber ); @@ -203,7 +203,7 @@ subtest 'Test merge A1 to B1 (changing authtype)' => sub { is( $retval, 1, 'We touched only one biblio' ); # Get new marc record for compares - my $newbiblio = C4::Biblio::GetMarcBiblio( $biblionumber ); + my $newbiblio = C4::Biblio::GetMarcBiblio({ biblionumber => $biblionumber }); compare_fields( $oldbiblio, $newbiblio, {}, 'count' ); # Exclude 109/609 and 112/612 in comparing order my $excl = { '109' => 1, '112' => 1, '609' => 1, '612' => 1 }; @@ -260,7 +260,7 @@ subtest 'Merging authorities should handle deletes (BZ 18070)' => sub { DelAuthority({ authid => $authid1 }); # this triggers a merge call # See what happened in the biblio record - my $marc1 = C4::Biblio::GetMarcBiblio( $biblionumber ); + my $marc1 = C4::Biblio::GetMarcBiblio({ biblionumber => $biblionumber }); is( $marc1->field('609'), undef, 'Field 609 should be gone too' ); # Now we simulate the delete as done in the cron job @@ -282,7 +282,7 @@ subtest 'Merging authorities should handle deletes (BZ 18070)' => sub { $mocks->{auth_mod}->unmock_all; merge({ mergefrom => $authid1, biblionumbers => [ $biblionumber ] }); # Final check - $marc1 = C4::Biblio::GetMarcBiblio( $biblionumber ); + $marc1 = C4::Biblio::GetMarcBiblio({ biblionumber => $biblionumber }); is( $marc1->field('609'), undef, 'Merge removed the 609 again even after deleting the authority record' ); }; @@ -306,14 +306,14 @@ subtest "Test some specific postponed merge issues" => sub { # This proves the !authtypefrom condition in sub merge # Additionally, we test clearing subfield merge({ mergefrom => $id + 1, MARCfrom => $oldauthmarc, mergeto => $id, MARCto => $authmarc, biblionumbers => [ $biblionumber ] }); - $biblio = C4::Biblio::GetMarcBiblio( $biblionumber ); + $biblio = C4::Biblio::GetMarcBiblio({ biblionumber => $biblionumber }); is( $biblio->subfield('609', '9'), $id, '612 moved to 609' ); is( $biblio->subfield('609', 'c'), undef, '609c cleared correctly' ); # Merge A to B postponed, delete B immediately (hits B < hits A) # This proves the !@record_to test in sub merge merge({ mergefrom => $id + 2, mergeto => $id + 1, MARCto => undef, biblionumbers => [ $biblionumber ] }); - $biblio = C4::Biblio::GetMarcBiblio( $biblionumber ); + $biblio = C4::Biblio::GetMarcBiblio({ biblionumber => $biblionumber }); is( $biblio->field('612'), undef, 'Last 612 must be gone' ); # Show that we 'need' skip_merge; this example is far-fetched. @@ -325,7 +325,7 @@ subtest "Test some specific postponed merge issues" => sub { my $restored_mocks = set_mocks(); DelAuthority({ authid => $id, skip_merge => 1 }); # delete A $restored_mocks->{auth_mod}->unmock_all; - $biblio = C4::Biblio::GetMarcBiblio( $biblionumber ); + $biblio = C4::Biblio::GetMarcBiblio({ biblionumber => $biblionumber }); is( $biblio->subfield('109', '9'), $id, 'If the 109 is no longer present, another modify merge would not bring it back' ); }; diff --git a/t/db_dependent/Biblio.t b/t/db_dependent/Biblio.t index 572bc0a..0890350 100755 --- a/t/db_dependent/Biblio.t +++ b/t/db_dependent/Biblio.t @@ -120,7 +120,7 @@ sub run_tests { '(GetBiblioData) Title field is empty in fresh biblio.'); my ( $isbn_field, $isbn_subfield ) = get_isbn_field(); - my $marc = GetMarcBiblio( $biblionumber ); + my $marc = GetMarcBiblio({ biblionumber => $biblionumber }); is( $marc->subfield( $isbn_field, $isbn_subfield ), $isbn, ); # Add title @@ -131,7 +131,7 @@ sub run_tests { is( $data->{ title }, $title, 'ModBiblio correctly added the title field, and GetBiblioData.'); is( $data->{ isbn }, $isbn, '(ModBiblio) ISBN is still there after ModBiblio.'); - $marc = GetMarcBiblio( $biblionumber ); + $marc = GetMarcBiblio({ biblionumber => $biblionumber }); my ( $title_field, $title_subfield ) = get_title_field(); is( $marc->subfield( $title_field, $title_subfield ), $title, ); @@ -253,7 +253,9 @@ sub run_tests { "GetMarcPrice returns the correct value"); my $newincbiblioitemnumber=$biblioitemnumber+1; $dbh->do("UPDATE biblioitems SET biblioitemnumber = ? WHERE biblionumber = ?;", undef, $newincbiblioitemnumber, $biblionumber ); - my $updatedrecord = GetMarcBiblio($biblionumber, 0); + my $updatedrecord = GetMarcBiblio({ + biblionumber => $biblionumber, + embed_items => 0 }); my $frameworkcode = GetFrameworkCode($biblionumber); my ( $biblioitem_tag, $biblioitem_subfield ) = GetMarcFromKohaField( "biblioitems.biblioitemnumber", $frameworkcode ); die qq{No biblioitemnumber tag for framework "$frameworkcode"} unless $biblioitem_tag; diff --git a/t/db_dependent/Items.t b/t/db_dependent/Items.t index f85d48a..39f76d0 100755 --- a/t/db_dependent/Items.t +++ b/t/db_dependent/Items.t @@ -557,7 +557,7 @@ subtest 'C4::Biblio::EmbedItemsInMarcBiblio' => sub { my ($itemfield) = C4::Biblio::GetMarcFromKohaField( 'items.itemnumber', '' ); - my $record = C4::Biblio::GetMarcBiblio($biblionumber); + my $record = C4::Biblio::GetMarcBiblio({ biblionumber => $biblionumber }); warning_is { C4::Biblio::EmbedItemsInMarcBiblio() } { carped => 'EmbedItemsInMarcBiblio: No MARC record passed' }, 'Should crap is no record passed.'; diff --git a/t/db_dependent/Koha/Filter/EmbedItemsAvailability.t b/t/db_dependent/Koha/Filter/EmbedItemsAvailability.t index ca70fb1..797ebb7 100755 --- a/t/db_dependent/Koha/Filter/EmbedItemsAvailability.t +++ b/t/db_dependent/Koha/Filter/EmbedItemsAvailability.t @@ -93,7 +93,7 @@ subtest 'EmbedItemsAvailability tests' => sub { my $processor = Koha::RecordProcessor->new( { filters => ('EmbedItemsAvailability') } ); is( ref($processor), 'Koha::RecordProcessor', 'Created record processor' ); - my $record = GetMarcBiblio($biblionumber); + my $record = GetMarcBiblio({ biblionumber => $biblionumber }); ok( !defined $record->field('999')->subfield('x'), q{The record doesn't originally contain 999$x} ); # Apply filter $processor->process($record); @@ -141,7 +141,7 @@ subtest 'EmbedItemsAvailability tests' => sub { $processor = Koha::RecordProcessor->new( { filters => ('EmbedItemsAvailability') } ); is( ref($processor), 'Koha::RecordProcessor', 'Created record processor' ); - $record = GetMarcBiblio($biblionumber); + $record = GetMarcBiblio({ biblionumber => $biblionumber }); ok( !defined $record->subfield('999', 'x'), q{The record doesn't originally contain 999$x} ); # Apply filter $processor->process($record); diff --git a/t/db_dependent/OAI/Server.t b/t/db_dependent/OAI/Server.t index 97d2c8d..951d7b0 100644 --- a/t/db_dependent/OAI/Server.t +++ b/t/db_dependent/OAI/Server.t @@ -86,7 +86,7 @@ foreach my $index ( 0 .. NUMBER_OF_MARC_RECORDS - 1 ) { my $timestamp = $sth->fetchrow_array . 'Z'; $timestamp =~ s/ /T/; $timestamp = manipulate_timestamp( $index, $biblionumber, $timestamp ); - $record = GetMarcBiblio($biblionumber); + $record = GetMarcBiblio({ biblionumber => $biblionumber }); $record = XMLin($record->as_xml_record); push @header, { datestamp => $timestamp, identifier => "TEST:$biblionumber" }; push @oaidc, { diff --git a/t/db_dependent/OAI/Sets.t b/t/db_dependent/OAI/Sets.t index 33b12e0..88f14bf 100644 --- a/t/db_dependent/OAI/Sets.t +++ b/t/db_dependent/OAI/Sets.t @@ -520,7 +520,7 @@ ModOAISetMappings($setVH_id, $mappingsVH); my $biblionumberVH = create_helper_biblio('Victor Hugo'); #Update -my $record = GetMarcBiblio($biblionumberVH); +my $record = GetMarcBiblio({ biblionumber => $biblionumberVH }); UpdateOAISetsBiblio($biblionumberVH, $record); #is biblio attached to setVH ? @@ -575,7 +575,7 @@ ModOAISetMappings($setNotVH_id, $mappingsNotVH); my $biblionumberNotVH = create_helper_biblio('Sponge, Bob'); #Update -$record = GetMarcBiblio($biblionumberNotVH); +$record = GetMarcBiblio({ biblionumber => $biblionumberNotVH }); UpdateOAISetsBiblio($biblionumberNotVH, $record); my @setsNotEq = CalcOAISetsBiblio($record); diff --git a/t/db_dependent/Reserves.t b/t/db_dependent/Reserves.t index d28c284..99f42b2 100755 --- a/t/db_dependent/Reserves.t +++ b/t/db_dependent/Reserves.t @@ -529,7 +529,7 @@ t::lib::Mocks::mock_preference( 'AgeRestrictionMarker', 'FSK|PEGI|Age|K' ); #Reserving an not-agerestricted Biblio by a Borrower with no dateofbirth is tested previously. #Set the ageRestriction for the Biblio -my $record = GetMarcBiblio( $bibnum ); +my $record = GetMarcBiblio({ biblionumber => $bibnum }); my ( $ageres_tagid, $ageres_subfieldid ) = GetMarcFromKohaField( "biblioitems.agerestriction" ); $record->append_fields( MARC::Field->new($ageres_tagid, '', '', $ageres_subfieldid => 'PEGI 16') ); C4::Biblio::ModBiblio( $record, $bibnum, $frameworkcode ); diff --git a/tags/list.pl b/tags/list.pl index cbc1bd3..9e90670 100755 --- a/tags/list.pl +++ b/tags/list.pl @@ -62,7 +62,7 @@ else { my $taglist = get_tag_rows( { term => $tag } ); for ( @{$taglist} ) { my $dat = &GetBiblioData( $_->{biblionumber} ); - my $record = &GetMarcBiblio( $_->{biblionumber} ); + my $record = &GetMarcBiblio({ biblionumber => $_->{biblionumber} }); $dat->{'subtitle'} = GetRecordValue( 'subtitle', $record, GetFrameworkCode( $_->{biblionumber} ) ); diff --git a/tools/batch_delete_records.pl b/tools/batch_delete_records.pl index 4be2427..a9ca2b3 100755 --- a/tools/batch_delete_records.pl +++ b/tools/batch_delete_records.pl @@ -80,7 +80,7 @@ if ( $op eq 'form' ) { } my $holds_count = $biblio->holds->count; $biblio = $biblio->unblessed; - my $record = &GetMarcBiblio( $record_id ); + my $record = &GetMarcBiblio({ biblionumber => $record_id }); $biblio->{subtitle} = GetRecordValue( 'subtitle', $record, GetFrameworkCode( $record_id ) ); $biblio->{itemnumbers} = C4::Items::GetItemnumbersForBiblio( $record_id ); $biblio->{holds_count} = $holds_count; diff --git a/tools/batch_record_modification.pl b/tools/batch_record_modification.pl index 89527fb..bfdb758 100755 --- a/tools/batch_record_modification.pl +++ b/tools/batch_record_modification.pl @@ -191,7 +191,7 @@ if ( $op eq 'form' ) { # Finally, modify the biblio my $error = eval { - my $record = GetMarcBiblio( $biblionumber ); + my $record = GetMarcBiblio({ biblionumber => $biblionumber }); ModifyRecordWithTemplate( $mmtid, $record ); my $frameworkcode = C4::Biblio::GetFrameworkCode( $biblionumber ); ModBiblio( $record, $biblionumber, $frameworkcode ); diff --git a/tools/showdiffmarc.pl b/tools/showdiffmarc.pl index 5ccb497..ba050a2 100755 --- a/tools/showdiffmarc.pl +++ b/tools/showdiffmarc.pl @@ -59,7 +59,9 @@ my ( $template, $loggedinuser, $cookie ) = get_template_and_user( } ); -$recordBiblionumber = GetMarcBiblio($biblionumber, 'embed_items'); +$recordBiblionumber = GetMarcBiblio({ + biblionumber => $biblionumber, + embed_items => 'embed_items' }); if( $recordBiblionumber ) { $formatted1 = $recordBiblionumber->as_formatted; my $biblio = Koha::Biblios->find( $biblionumber ); diff --git a/virtualshelves/downloadshelf.pl b/virtualshelves/downloadshelf.pl index 9faf4ad..b8b37fb 100755 --- a/virtualshelves/downloadshelf.pl +++ b/virtualshelves/downloadshelf.pl @@ -71,7 +71,9 @@ if ($shelfid && $format) { else { #Other formats while ( my $content = $contents->next ) { my $biblionumber = $content->biblionumber; - my $record = GetMarcBiblio($biblionumber, 1); + my $record = GetMarcBiblio({ + biblionumber => $biblionumber, + embed_items => 1 }); if ($format eq 'iso2709') { $output .= $record->as_usmarc(); } diff --git a/virtualshelves/sendshelf.pl b/virtualshelves/sendshelf.pl index 1226d3e..9880efd 100755 --- a/virtualshelves/sendshelf.pl +++ b/virtualshelves/sendshelf.pl @@ -80,7 +80,9 @@ if ($email) { my $biblionumber = $content->biblionumber; my $fw = GetFrameworkCode($biblionumber); my $dat = GetBiblioData($biblionumber); - my $record = GetMarcBiblio($biblionumber, 1); + my $record = GetMarcBiblio({ + biblionumber => $biblionumber, + embed_items => 1 }); my $marcauthorsarray = GetMarcAuthors( $record, $marcflavour ); my $marcsubjctsarray = GetMarcSubjects( $record, $marcflavour ); my $subtitle = GetRecordValue( 'subtitle', $record, $fw ); diff --git a/virtualshelves/shelves.pl b/virtualshelves/shelves.pl index bcd52b7..d3aea7e 100755 --- a/virtualshelves/shelves.pl +++ b/virtualshelves/shelves.pl @@ -237,7 +237,7 @@ if ( $op eq 'view' ) { while ( my $content = $contents->next ) { my $this_item; my $biblionumber = $content->biblionumber; - my $record = GetMarcBiblio($biblionumber); + my $record = GetMarcBiblio({ biblionumber => $biblionumber }); if ( $xslfile ) { $this_item->{XSLTBloc} = XSLTParse4Display( $biblionumber, $record, "XSLTListsDisplay", -- 2.1.4