Bug 16199: Remove C4::Ris::charconv
authorJonathan Druart <jonathan.druart@bugs.koha-community.org>
Tue, 5 Apr 2016 06:52:50 +0000 (07:52 +0100)
committerBrendan Gallagher <brendan@bywatersolutions.com>
Wed, 6 Apr 2016 23:59:45 +0000 (23:59 +0000)
This subroutine always returns what has been sent in parameter.
It is unecessary and can be removed.

Test plan:
  prove t/Ris.t
should not be noisy

Export a catalogue record in Ris should generate the same file with and
without this patch

NOTE: With/Without were identical in my testing.
      t/Ris.t is nicely silenced.

Signed-off-by: Mark Tompsett <mtompset@hotmail.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Brendan Gallagher brendan@bywatersolutions.com
C4/Ris.pm
t/Ris.t

index ec3159f..4833202 100644 (file)
--- a/C4/Ris.pm
+++ b/C4/Ris.pm
@@ -165,7 +165,7 @@ sub marc2ris {
        foreach my $field (@author_fields) {
            if (length($field)) {
                my $author = &get_author($field);
-               print "AU  - ",&charconv($author),"\r\n";
+               print "AU  - ",$author,"\r\n";
            }
        }
 
@@ -191,7 +191,7 @@ sub marc2ris {
        foreach my $field (@editor_fields) {
            if (length($field)) {
                my $editor = &get_editor($field);
-               print "ED  - ",&charconv($editor),"\r\n";
+               print "ED  - ",$editor,"\r\n";
            }
        }
 
@@ -266,7 +266,7 @@ sub marc2ris {
     @kwpool = uniq @kwpool;
 
     for my $kw ( @kwpool ) {
-        print "KW  - ", &charconv($kw), "\r\n";
+        print "KW  - ", $kw, "\r\n";
     }
 
        ## 5XX have various candidates for notes and abstracts. We pool
@@ -293,7 +293,7 @@ sub marc2ris {
        my $allnotes = join "; ", @notepool;
 
        if (length($allnotes) > 0) {
-           print "N1  - ", &charconv($allnotes), "\r\n";
+           print "N1  - ", $allnotes, "\r\n";
        }
 
        ## 320/520 have the abstract
@@ -554,11 +554,11 @@ $clean_subtitle ||= q{};
 
        if (length($clean_title) > 0
            || (length($clean_subtitle) > 0 && $intype ne "unimarc")) {
-           print "TI  - ", &charconv($clean_title);
+           print "TI  - ", $clean_title;
 
            ## subfield $b is relevant only for marc21/ukmarc
            if (length($clean_subtitle) > 0 && $intype ne "unimarc") {
-               print ": ",&charconv($clean_subtitle);
+               print ": ",$clean_subtitle;
            }
            print "\r\n";
        }
@@ -588,13 +588,13 @@ sub print_stitle {
        $clean_title =~ s% *[/:;.]$%%;
 
        if (length($clean_title) > 0) {
-           print "T2  - ", &charconv($clean_title),"\r\n";
+           print "T2  - ", $clean_title,"\r\n";
        }
 
        if ($intype eq "unimarc") {
            print "<marc>Series vol(\$v): ",$titlefield->subfield('v'),"\r\n" if $marcprint;
            if (length($titlefield->subfield('v')) > 0) {
-               print "VL  - ", &charconv($titlefield->subfield('v')),"\r\n";
+               print "VL  - ", $titlefield->subfield('v'),"\r\n";
            }
        }
     }
@@ -618,7 +618,7 @@ sub print_isbn {
        }
 
     my $isbn = $isbnfield->subfield('a');
-       print "SN  - ", &charconv($isbn), "\r\n";
+       print "SN  - ", $isbn, "\r\n";
     }
 }
 
@@ -640,7 +640,7 @@ sub print_issn {
        }
 
        my $issn = substr($issnfield->subfield('a'), 0, 9);
-       print "SN  - ", &charconv($issn), "\r\n";
+       print "SN  - ", $issn, "\r\n";
     }
 }
 
@@ -652,7 +652,7 @@ sub print_uri {
 
     foreach my $f856 (@f856s) {
         if (my $uri = $f856->subfield('u')) {
-               print "UR  - ", charconv($uri), "\r\n";
+               print "UR  - ", $uri, "\r\n";
         }
     }
 }
@@ -669,7 +669,7 @@ sub print_loc_callno {
        warn("no LOC call number found") if $marcprint;
     }
     else {
-       print "AV  - ", &charconv($callnofield->subfield('a')), " ", &charconv($callnofield->subfield('b')), "\r\n";
+       print "AV  - ", $callnofield->subfield('a'), " ", $callnofield->subfield('b'), "\r\n";
     }
 }
 
@@ -685,7 +685,7 @@ sub print_dewey {
        warn("no Dewey number found") if $marcprint;
     }
     else {
-       print "U1  - ", &charconv($deweyfield->subfield('a')), " ", &charconv($deweyfield->subfield('2')), "\r\n";
+       print "U1  - ", $deweyfield->subfield('a'), " ", $deweyfield->subfield('2'), "\r\n";
     }
 }
 
@@ -799,10 +799,10 @@ sub print_pubinfo {
 
        ## now dump the collected CY and PB lists
        if (@cities > 0) {
-           print "CY  - ", &charconv(join(", ", @cities)), "\r\n";
+           print "CY  - ", join(", ", @cities), "\r\n";
        }
        if (@publishers > 0) {
-           print "PB  - ", &charconv(join(", ", @publishers)), "\r\n";
+           print "PB  - ", join(", ", @publishers), "\r\n";
        }
     }
 }
@@ -1002,30 +1002,9 @@ sub print_abstract {
     my $allabs = join "; ", @abstrings;
 
     if (length($allabs) > 0) {
-       print "N2  - ", &charconv($allabs), "\r\n";
+       print "N2  - ", $allabs, "\r\n";
     }
 
 }
 
-    
-    
-##********************************************************************
-## charconv(): converts to a different charset based on a global var
-## Arguments: string
-## Returns: string
-##********************************************************************
-sub charconv {
-    if ($utf) {
-       ## return unaltered if already utf-8
-       return @_;
-    }
-    elsif (my $uniout eq "t") {
-       ## convert to utf-8
-       return marc8_to_utf8("@_");
-    }
-    else {
-       ## return unaltered if no utf-8 requested
-       return @_;
-    }
-}
 1;
diff --git a/t/Ris.t b/t/Ris.t
index b4126c5..0840e2c 100755 (executable)
--- a/t/Ris.t
+++ b/t/Ris.t
@@ -6,7 +6,7 @@
 use strict;
 use warnings;
 
-use Test::More tests => 6;
+use Test::More tests => 4;
 
 BEGIN {
         use_ok('C4::Ris');
@@ -17,6 +17,3 @@ is(C4::Ris::print_typetag(),undef,'test printing typetag');
 is(C4::Ris::print_title(),undef, 'test printing title when print_title is nil');
 
 is(C4::Ris::print_stitle(),undef, 'test printing info from series title field when its nil');
-
-ok((C4::Ris::charconv('hello world'))[0] eq 'hello world', 'testing that it returns what you entered');
-ok(C4::Ris::charconv() == 0, 'testing when charconv is nil');