Bug 14245: Problems with RIS export in unimarc
authorBernardo Gonzalez Kriegel <bgkriegel@gmail.com>
Thu, 21 May 2015 17:00:05 +0000 (14:00 -0300)
committerMason James <mtj@kohaaloha.com>
Fri, 2 Oct 2015 10:42:35 +0000 (23:42 +1300)
Variable $itype is used an all C4/Ris.pm to switch
between marc falvors, but is local and not passed along
as argument.

As a quick solution, is defined as global

To test:
1) On UNIMARC setup, export a record as RIS,
check that author (and other fields) are displayed
incorrectly

2) Apply the patch

3) Export again, improved results

4) Run t/Ris.t

There are other problems in this script, needs maintenance
(e.g. no Modern::Perl friendly)

Signed-off-by: Victor do Rosário <jvr@fct.unl.pt>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Mason James <mtj@kohaaloha.com>

C4/Ris.pm

index 137b99d..18e2e2e 100644 (file)
--- a/C4/Ris.pm
+++ b/C4/Ris.pm
@@ -87,12 +87,14 @@ C<$record> - a MARC::Record object
 
 =cut
 
+my $intype;
+
 sub marc2ris {
     my ($record) = @_;
     my $output;
 
     my $marcflavour = C4::Context->preference("marcflavour");
-    my $intype = lc($marcflavour);
+    $intype = lc($marcflavour);
     my $marcprint = 0; # Debug flag;
 
     # Let's redirect stdout
@@ -409,7 +411,7 @@ sub normalize_author {
 
        ## we currently ignore subfield c until someone complains
        if (length($rawauthorb) > 0) {
-           return join ",", ($rawauthora, $rawauthorb);
+        return join ", ", ($rawauthora, $rawauthorb);
        }
        else {
            return $rawauthora;
@@ -448,7 +450,7 @@ sub get_author {
        normalize_author($authorname, $authorfield->subfield('b'), $authorfield->subfield('c'), $authorfield->indicator("$indicator"));
     }
     else {
-       normalize_author($authorfield->subfield('a'), $authorfield->subfield('b'), $authorfield->subfield('c'), $authorfield->indicator("$indicator"));
+        normalize_author($authorfield->subfield('a') // '', $authorfield->subfield('b') // '', $authorfield->subfield('c') // '', $authorfield->indicator("$indicator"));
     }
 }