Bug 19040: Refactor GetMarcBiblio parameters
authorMark Tompsett <mtompset@hotmail.com>
Fri, 4 Aug 2017 17:42:56 +0000 (13:42 -0400)
committerJonathan Druart <jonathan.druart@bugs.koha-community.org>
Fri, 25 Aug 2017 13:23:42 +0000 (10:23 -0300)
Change parameters to a hashref.

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Looks good to me.
Two calls in migration_tools/22_to_30 still in old style.

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>

89 files changed:
C4/AuthoritiesMarc.pm
C4/Biblio.pm
C4/HoldsQueue.pm
C4/ILSDI/Services.pm
C4/Items.pm
C4/Labels/Label.pm
C4/Record.pm
C4/Search.pm
C4/Serials.pm
C4/ShelfBrowser.pm
Koha/Biblio.pm
Koha/BiblioUtils.pm
Koha/Exporter/Record.pm
Koha/OAI/Server/Repository.pm
basket/basket.pl
basket/downloadcart.pl
basket/sendbasket.pl
catalogue/ISBDdetail.pl
catalogue/MARCdetail.pl
catalogue/detail.pl
catalogue/export.pl
catalogue/labeledMARCdetail.pl
catalogue/moredetail.pl
catalogue/showmarc.pl
cataloguing/addbiblio.pl
cataloguing/additem.pl
cataloguing/linkitem.pl
cataloguing/merge.pl
cataloguing/value_builder/marc21_linking_section.pl
cataloguing/value_builder/unimarc_field_4XX.pl
circ/branchoverdues.pl
circ/reserveratios.pl
circ/transferstoreceive.pl
circ/waitingreserves.pl
misc/batchRebuildBiblioTables.pl
misc/batchRebuildItemsTables.pl
misc/batchRepairMissingBiblionumbers.pl
misc/cronjobs/build_browser_and_cloud.pl
misc/cronjobs/check-url-quick.pl
misc/cronjobs/check-url.pl
misc/link_bibs_to_authorities.pl
misc/maintenance/UNIMARC_sync_date_created_with_marc_biblio.pl
misc/maintenance/process_record_through_filter.pl
misc/maintenance/remove_items_from_biblioitems.pl
misc/maintenance/sanitize_records.pl
misc/maintenance/touch_all_biblios.pl
misc/migration_tools/buildEDITORS.pl
misc/migration_tools/create_analytical_rel.pl
misc/migration_tools/import_lexile.pl
misc/migration_tools/rebuild_zebra.pl
misc/migration_tools/switch_marc21_series_info.pl
misc/migration_tools/upgradeitems.pl
opac/opac-ISBDdetail.pl
opac/opac-MARCdetail.pl
opac/opac-basket.pl
opac/opac-detail.pl
opac/opac-downloadcart.pl
opac/opac-downloadshelf.pl
opac/opac-export.pl
opac/opac-reserve.pl
opac/opac-search.pl
opac/opac-sendbasket.pl
opac/opac-sendshelf.pl
opac/opac-shelves.pl
opac/opac-showmarc.pl
opac/opac-showreviews.pl
opac/opac-tags.pl
opac/opac-user.pl
serials/subscription-add.pl
svc/bib
svc/checkouts
svc/holds
svc/new_bib
svc/records/preview
t/Biblio.t
t/db_dependent/Authorities/Merge.t
t/db_dependent/Biblio.t
t/db_dependent/Items.t
t/db_dependent/Koha/Filter/EmbedItemsAvailability.t
t/db_dependent/OAI/Server.t
t/db_dependent/OAI/Sets.t
t/db_dependent/Reserves.t
tags/list.pl
tools/batch_delete_records.pl
tools/batch_record_modification.pl
tools/showdiffmarc.pl
virtualshelves/downloadshelf.pl
virtualshelves/sendshelf.pl
virtualshelves/shelves.pl

index 9f1f284..8b9c6c1 100644 (file)
@@ -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) {
index 0ee689d..54a6731 100644 (file)
@@ -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<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>
@@ -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;
index cf86aa8..ce525ba 100755 (executable)
@@ -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};
index 5d35b2b..816f1ed 100644 (file)
@@ -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();
         }
index 036b4f7..18debb5 100644 (file)
@@ -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;
 
index c7c5371..8fe725f 100644 (file)
@@ -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;
 }
index e36e035..af619ac 100644 (file)
@@ -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
index fa920cf..9278f26 100644 (file)
@@ -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);
index b4897c2..d79c0a5 100644 (file)
@@ -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 ); };
index 8ae813a..ee551d2 100644 (file)
@@ -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);
index aad4343..f4e5e2f 100644 (file)
@@ -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
index abb0721..73fc12a 100644 (file)
@@ -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;
index 193f87e..f9d62df 100644 (file)
@@ -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;
 
index 50891c0..da136cd 100644 (file)
@@ -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;
 }
 
index ae65a8e..76edc34 100755 (executable)
@@ -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 );
index 278b2c7..4653449 100755 (executable)
@@ -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') {
index 47bd1c9..224db2d 100755 (executable)
@@ -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 );
 
index f5fa00a..f58e1a9 100755 (executable)
@@ -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
index 2152ffd..6474f3e 100755 (executable)
@@ -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 ) {
index 221532f..1e18a1d 100755 (executable)
@@ -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
index f82250d..c10686c 100755 (executable)
@@ -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);
index 090326d..d84c75f 100755 (executable)
@@ -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,
index 85b491a..5bc1d2f 100755 (executable)
@@ -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
index a48a852..11c4f39 100755 (executable)
@@ -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");
index 013c312..b72d71f 100755 (executable)
@@ -770,7 +770,7 @@ my (
 );
 
 if (($biblionumber) && !($breedingid)){
-       $record = GetMarcBiblio($biblionumber);
+    $record = GetMarcBiblio({ biblionumber => $biblionumber });
 }
 if ($breedingid) {
     ( $record, $encoding ) = MARCfindbreeding( $breedingid ) ;
index 9387072..eb18cc3 100755 (executable)
@@ -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)){
index 5f33c16..e23ff25 100755 (executable)
@@ -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') {
index 11bb4e2..4594671 100755 (executable)
@@ -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 = {
index 7efa49e..0fb9b7b 100755 (executable)
@@ -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;
index 75c9dec..c514349 100755 (executable)
@@ -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;
index f334dd1..5f4f01f 100755 (executable)
@@ -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};
     }
index 56c84d8..e7c28c7 100755 (executable)
@@ -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,
index 88f9aa6..0929ed3 100755 (executable)
@@ -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
index 555d04e..55c5c07 100755 (executable)
@@ -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;
index dc4175c..5db801b 100755 (executable)
@@ -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;
index 5545607..e0499c0 100755 (executable)
@@ -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) {
index 3b3c345..ca8064c 100755 (executable)
@@ -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($@){
index 1c74744..d5e0d1a 100755 (executable)
@@ -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.' : '.$@;
index e599808..f9b1c32 100755 (executable)
@@ -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');
index 71885ab..5c0957b 100755 (executable)
@@ -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 = ();
index 37596c5..b139a76 100755 (executable)
@@ -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";
index 9c3fd01..a46dc7b 100755 (executable)
@@ -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.';
index 3b3e537..baf137a 100755 (executable)
@@ -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] ) });
index 9af69c9..597195e 100755 (executable)
@@ -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)) ;
index 42123d1..7079ea0 100755 (executable)
@@ -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;
index ec48091..d091089 100755 (executable)
@@ -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);
 
index 0126ae6..f5e1a71 100755 (executable)
@@ -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
index 3069a34..a06305f 100755 (executable)
@@ -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++;
index b185c04..131db44 100755 (executable)
@@ -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";
index 28ce27c..5e43cd6 100755 (executable)
@@ -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
index a51f830..ef05f0a 100755 (executable)
@@ -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;
index c5469ee..e3f11d6 100755 (executable)
@@ -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');
index f341884..a3cb1a9 100755 (executable)
@@ -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;
index a899e92..9605cdd 100755 (executable)
@@ -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;
index bfa9688..f842587 100755 (executable)
@@ -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',
index ae89f82..8252e50 100755 (executable)
@@ -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;
index d20000e..76fa095 100755 (executable)
@@ -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',
index b91f3a3..007dd5f 100755 (executable)
@@ -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',
index c0f18bf..6023d78 100755 (executable)
@@ -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");
index 5312449..95204b3 100755 (executable)
@@ -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;
 
index 2272587..c10e958 100755 (executable)
@@ -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} ) {
index b7167e8..c51e8c4 100755 (executable)
@@ -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 );
 
index e58ce7c..3c19e61 100755 (executable)
@@ -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);
index e790b43..e5b9cc6 100755 (executable)
@@ -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',
index 250c519..1eced61 100755 (executable)
@@ -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',
index 84eba04..b844167 100755 (executable)
@@ -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);
index 873a9c5..267c3c0 100755 (executable)
@@ -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;
index e7c3a06..bc39c80 100755 (executable)
@@ -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'} );
index c73b28d..1849ed7 100755 (executable)
@@ -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 (executable)
--- 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;
index d8d6156..98251b5 100755 (executable)
@@ -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 => {
index 4642356..5c0ed35 100755 (executable)
--- 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(
index ba6742a..fc9be48 100755 (executable)
@@ -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();
index c1bdc67..e4855c7 100755 (executable)
@@ -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;
index 8fd388f..4ade7cc 100755 (executable)
@@ -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";
 
index b2cd97e..29f6a80 100755 (executable)
@@ -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' );
 };
 
index 572bc0a..0890350 100755 (executable)
@@ -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;
index f85d48a..39f76d0 100755 (executable)
@@ -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.';
index ca70fb1..797ebb7 100755 (executable)
@@ -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);
index 97d2c8d..951d7b0 100644 (file)
@@ -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, {
index 33b12e0..88f14bf 100644 (file)
@@ -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);
index d28c284..99f42b2 100755 (executable)
@@ -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 );
index cbc1bd3..9e90670 100755 (executable)
@@ -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} ) );
index 4be2427..a9ca2b3 100755 (executable)
@@ -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;
index 89527fb..bfdb758 100755 (executable)
@@ -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 );
index 5ccb497..ba050a2 100755 (executable)
@@ -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 );
index 9faf4ad..b8b37fb 100755 (executable)
@@ -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();
                     }
index 1226d3e..9880efd 100755 (executable)
@@ -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 );
index bcd52b7..d3aea7e 100755 (executable)
@@ -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",