Bug 27259: Add HomeOrHoldingBranch checks where it was missing from
[koha-ffzg.git] / C4 / Record.pm
index d2377ed..69a60f3 100644 (file)
@@ -26,7 +26,7 @@ use MARC::Record; # marc2marcxml, marcxml2marc, changeEncoding
 use MARC::File::XML; # marc2marcxml, marcxml2marc, changeEncoding
 use Biblio::EndnoteStyle;
 use Unicode::Normalize qw( NFC ); # _entity_encode
-use C4::Biblio qw( GetFrameworkCode GetMarcBiblio );
+use C4::Biblio qw( GetFrameworkCode );
 use C4::Koha; #marc2csv
 use C4::XSLT;
 use YAML::XS; #marcrecords2csv
@@ -231,7 +231,7 @@ EXAMPLE
 Convert MARC or MARCXML to Dublin Core metadata (XSLT Transformation),
 optionally can get an XML directly from biblio_metadata
 without item information. This method take into consideration the syspref
-'marcflavour' (UNIMARC, MARC21 and NORMARC).
+'marcflavour' (UNIMARC or MARC21).
 Return an XML file with the format defined in C<$format>
 
 C<$marc> - an ISO-2709 scalar or MARC::Record object
@@ -265,23 +265,12 @@ sub marc2dcxml {
         $marcxml = $xml;
     }
 
-    # only proceed if MARC21 or UNIMARC; else clause is executed if marcflavour set it to NORMARC
-    # generate MARC::Record object to see if not a marcxml record
-    unless ( C4::Context->preference('marcflavour') eq 'NORMARC' ) {
-        eval { $record = MARC::Record->new_from_xml(
-                         $marcxml,
-                         'UTF-8',
-                         C4::Context->preference('marcflavour')
-               );
-        };
-    } else {
-        eval { $record = MARC::Record->new_from_xml(
-                         $marcxml,
-                        'UTF-8',
-                        'MARC21'
-               );
-        };
-    }
+    eval { $record = MARC::Record->new_from_xml(
+                     $marcxml,
+                     'UTF-8',
+                     C4::Context->preference('marcflavour')
+           );
+    };
 
     # conversion to MARC::Record object failed
     if ( $@ ) {
@@ -465,18 +454,19 @@ C<$itemnumbers> a list of itemnumbers to export
 =cut
 
 sub marcrecord2csv {
-    my ($biblio, $id, $header, $csv, $fieldprocessing, $itemnumbers) = @_;
+    my ($biblionumber, $id, $header, $csv, $fieldprocessing, $itemnumbers) = @_;
     my $output;
 
     # Getting the record
-    my $record = GetMarcBiblio({ biblionumber => $biblio });
+    my $biblio = Koha::Biblios->find($biblionumber);
+    return unless $biblio;
+    my $record = eval {
+        $biblio->metadata->record(
+            { embed_items => 1, itemnumbers => $itemnumbers } );
+    };
     return unless $record;
-    C4::Biblio::EmbedItemsInMarcBiblio({
-        marc_record  => $record,
-        biblionumber => $biblio,
-        item_numbers => $itemnumbers });
     # Getting the framework
-    my $frameworkcode = GetFrameworkCode($biblio);
+    my $frameworkcode = $biblio->frameworkcode;
 
     # Getting information about the csv profile
     my $profile = Koha::CsvProfiles->find($id);