From d4e9a2c7cad7fb76e450af1ac5b54a4ee77ac7f7 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Tue, 5 Apr 2016 07:52:50 +0100 Subject: [PATCH] Bug 16199: Remove C4::Ris::charconv 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 Signed-off-by: Tomas Cohen Arazi --- C4/Ris.pm | 53 ++++++++++++++++------------------------------------- t/Ris.t | 5 +---- 2 files changed, 17 insertions(+), 41 deletions(-) diff --git a/C4/Ris.pm b/C4/Ris.pm index a1db07f..c16bc07 100644 --- 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 @@ -549,11 +549,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"; } @@ -583,13 +583,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 "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"; } } } @@ -613,7 +613,7 @@ sub print_isbn { } my $isbn = $isbnfield->subfield('a'); - print "SN - ", &charconv($isbn), "\r\n"; + print "SN - ", $isbn, "\r\n"; } } @@ -635,7 +635,7 @@ sub print_issn { } my $issn = substr($issnfield->subfield('a'), 0, 9); - print "SN - ", &charconv($issn), "\r\n"; + print "SN - ", $issn, "\r\n"; } } @@ -647,7 +647,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"; } } } @@ -664,7 +664,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"; } } @@ -680,7 +680,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"; } } @@ -794,10 +794,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"; } } } @@ -997,30 +997,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 --- 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'); -- 2.7.4