Bug 10572: Add phone to message_transport_types table for new installs
[koha.git] / C4 / Record.pm
index be1912c..9d72d5a 100644 (file)
@@ -310,9 +310,9 @@ sub _transformWithStylesheet {
     my $xslt = XML::LibXSLT->new();
     my $source = $parser->parse_string($xmlrecord);
     my $style_doc = $parser->parse_file($xslfile);
-    my $stylesheet = $xslt->parse_stylesheet($style_doc);
-    my $results = $stylesheet->transform($source);
-    my $newxmlrecord = $stylesheet->output_string($results);
+    my $style_sheet = $xslt->parse_stylesheet($style_doc);
+    my $results = $style_sheet->transform($source);
+    my $newxmlrecord = $style_sheet->output_string($results);
     return ($newxmlrecord);
 }
 
@@ -461,7 +461,7 @@ sub marcrecord2csv {
     $csv->sep_char($csvseparator);
 
     # Getting the marcfields
-    my $marcfieldslist = $profile->{marcfields};
+    my $marcfieldslist = $profile->{content};
 
     # Getting the marcfields as an array
     my @marcfieldsarray = split('\|', $marcfieldslist);
@@ -652,29 +652,19 @@ sub marc2bibtex {
     # Authors
     my $author;
     my @texauthors;
-    my ( $mintag, $maxtag, $fields_filter );
-    if ( $marcflavour eq "UNIMARC" ) {
-        $mintag        = "700";
-        $maxtag        = "712";
-        $fields_filter = '7..';
-    }
-    else {
-        $mintag        = "700";
-        $maxtag        = "720";
-        $fields_filter = '7..';
-    }
-    foreach my $field ( $record->field($fields_filter) ) {
-        next unless $field->tag() >= $mintag && $field->tag() <= $maxtag;
+    my @authorFields = ('100','110','111','700','710','711');
+    @authorFields = ('700','701','702','710','711','721') if ( $marcflavour eq "UNIMARC" );
+
+    foreach my $field ( @authorFields ) {
         # author formatted surname, firstname
         my $texauthor = '';
         if ( $marcflavour eq "UNIMARC" ) {
-            $texauthor = join ', ',
-              ( $field->subfield('a'), $field->subfield('b') );
-        }
-        else {
-            $texauthor = $field->subfield('a');
-        }
-        push @texauthors, $texauthor if $texauthor;
+           $texauthor = join ', ',
+           ( $record->subfield($field,"a"), $record->subfield($field,"b") );
+       } else {
+           $texauthor = $record->subfield($field,"a");
+       }
+       push @texauthors, $texauthor if $texauthor;
     }
     $author = join ' and ', @texauthors;
 
@@ -726,7 +716,7 @@ sub marc2bibtex {
     }
 
     $tex .= "\@book{";
-    $tex .= join(",\n", $id, map { $bh{$_} ? qq(\t$_ = "$bh{$_}") : () } keys %bh);
+    $tex .= join(",\n", $id, map { $bh{$_} ? qq(\t$_ = {$bh{$_}}) : () } keys %bh);
     $tex .= "\n}\n";
 
     return $tex;