View | Details | Raw Unified | Return to bug 16199
Collapse All | Expand All

(-)a/C4/Ris.pm (-37 / +16 lines)
Lines 165-171 sub marc2ris { Link Here
165
	foreach my $field (@author_fields) {
165
	foreach my $field (@author_fields) {
166
	    if (length($field)) {
166
	    if (length($field)) {
167
		my $author = &get_author($field);
167
		my $author = &get_author($field);
168
		print "AU  - ",&charconv($author),"\r\n";
168
		print "AU  - ",$author,"\r\n";
169
	    }
169
	    }
170
	}
170
	}
171
171
Lines 191-197 sub marc2ris { Link Here
191
	foreach my $field (@editor_fields) {
191
	foreach my $field (@editor_fields) {
192
	    if (length($field)) {
192
	    if (length($field)) {
193
		my $editor = &get_editor($field);
193
		my $editor = &get_editor($field);
194
		print "ED  - ",&charconv($editor),"\r\n";
194
		print "ED  - ",$editor,"\r\n";
195
	    }
195
	    }
196
	}
196
	}
197
197
Lines 266-272 sub marc2ris { Link Here
266
    @kwpool = uniq @kwpool;
266
    @kwpool = uniq @kwpool;
267
267
268
    for my $kw ( @kwpool ) {
268
    for my $kw ( @kwpool ) {
269
        print "KW  - ", &charconv($kw), "\r\n";
269
        print "KW  - ", $kw, "\r\n";
270
    }
270
    }
271
271
272
	## 5XX have various candidates for notes and abstracts. We pool
272
	## 5XX have various candidates for notes and abstracts. We pool
Lines 293-299 sub marc2ris { Link Here
293
	my $allnotes = join "; ", @notepool;
293
	my $allnotes = join "; ", @notepool;
294
294
295
	if (length($allnotes) > 0) {
295
	if (length($allnotes) > 0) {
296
	    print "N1  - ", &charconv($allnotes), "\r\n";
296
	    print "N1  - ", $allnotes, "\r\n";
297
	}
297
	}
298
298
299
	## 320/520 have the abstract
299
	## 320/520 have the abstract
Lines 554-564 $clean_subtitle ||= q{}; Link Here
554
554
555
	if (length($clean_title) > 0
555
	if (length($clean_title) > 0
556
	    || (length($clean_subtitle) > 0 && $intype ne "unimarc")) {
556
	    || (length($clean_subtitle) > 0 && $intype ne "unimarc")) {
557
	    print "TI  - ", &charconv($clean_title);
557
	    print "TI  - ", $clean_title;
558
558
559
	    ## subfield $b is relevant only for marc21/ukmarc
559
	    ## subfield $b is relevant only for marc21/ukmarc
560
	    if (length($clean_subtitle) > 0 && $intype ne "unimarc") {
560
	    if (length($clean_subtitle) > 0 && $intype ne "unimarc") {
561
		print ": ",&charconv($clean_subtitle);
561
		print ": ",$clean_subtitle;
562
	    }
562
	    }
563
	    print "\r\n";
563
	    print "\r\n";
564
	}
564
	}
Lines 588-600 sub print_stitle { Link Here
588
	$clean_title =~ s% *[/:;.]$%%;
588
	$clean_title =~ s% *[/:;.]$%%;
589
589
590
	if (length($clean_title) > 0) {
590
	if (length($clean_title) > 0) {
591
	    print "T2  - ", &charconv($clean_title),"\r\n";
591
	    print "T2  - ", $clean_title,"\r\n";
592
	}
592
	}
593
593
594
	if ($intype eq "unimarc") {
594
	if ($intype eq "unimarc") {
595
	    print "<marc>Series vol(\$v): ",$titlefield->subfield('v'),"\r\n" if $marcprint;
595
	    print "<marc>Series vol(\$v): ",$titlefield->subfield('v'),"\r\n" if $marcprint;
596
	    if (length($titlefield->subfield('v')) > 0) {
596
	    if (length($titlefield->subfield('v')) > 0) {
597
		print "VL  - ", &charconv($titlefield->subfield('v')),"\r\n";
597
		print "VL  - ", $titlefield->subfield('v'),"\r\n";
598
	    }
598
	    }
599
	}
599
	}
600
    }
600
    }
Lines 618-624 sub print_isbn { Link Here
618
	}
618
	}
619
619
620
    my $isbn = $isbnfield->subfield('a');
620
    my $isbn = $isbnfield->subfield('a');
621
	print "SN  - ", &charconv($isbn), "\r\n";
621
	print "SN  - ", $isbn, "\r\n";
622
    }
622
    }
623
}
623
}
624
624
Lines 640-646 sub print_issn { Link Here
640
	}
640
	}
641
641
642
	my $issn = substr($issnfield->subfield('a'), 0, 9);
642
	my $issn = substr($issnfield->subfield('a'), 0, 9);
643
	print "SN  - ", &charconv($issn), "\r\n";
643
	print "SN  - ", $issn, "\r\n";
644
    }
644
    }
645
}
645
}
646
646
Lines 652-658 sub print_uri { Link Here
652
652
653
    foreach my $f856 (@f856s) {
653
    foreach my $f856 (@f856s) {
654
        if (my $uri = $f856->subfield('u')) {
654
        if (my $uri = $f856->subfield('u')) {
655
	        print "UR  - ", charconv($uri), "\r\n";
655
	        print "UR  - ", $uri, "\r\n";
656
        }
656
        }
657
    }
657
    }
658
}
658
}
Lines 669-675 sub print_loc_callno { Link Here
669
	warn("no LOC call number found") if $marcprint;
669
	warn("no LOC call number found") if $marcprint;
670
    }
670
    }
671
    else {
671
    else {
672
	print "AV  - ", &charconv($callnofield->subfield('a')), " ", &charconv($callnofield->subfield('b')), "\r\n";
672
	print "AV  - ", $callnofield->subfield('a'), " ", $callnofield->subfield('b'), "\r\n";
673
    }
673
    }
674
}
674
}
675
675
Lines 685-691 sub print_dewey { Link Here
685
	warn("no Dewey number found") if $marcprint;
685
	warn("no Dewey number found") if $marcprint;
686
    }
686
    }
687
    else {
687
    else {
688
	print "U1  - ", &charconv($deweyfield->subfield('a')), " ", &charconv($deweyfield->subfield('2')), "\r\n";
688
	print "U1  - ", $deweyfield->subfield('a'), " ", $deweyfield->subfield('2'), "\r\n";
689
    }
689
    }
690
}
690
}
691
691
Lines 799-808 sub print_pubinfo { Link Here
799
799
800
	## now dump the collected CY and PB lists
800
	## now dump the collected CY and PB lists
801
	if (@cities > 0) {
801
	if (@cities > 0) {
802
	    print "CY  - ", &charconv(join(", ", @cities)), "\r\n";
802
	    print "CY  - ", join(", ", @cities), "\r\n";
803
	}
803
	}
804
	if (@publishers > 0) {
804
	if (@publishers > 0) {
805
	    print "PB  - ", &charconv(join(", ", @publishers)), "\r\n";
805
	    print "PB  - ", join(", ", @publishers), "\r\n";
806
	}
806
	}
807
    }
807
    }
808
}
808
}
Lines 1002-1031 sub print_abstract { Link Here
1002
    my $allabs = join "; ", @abstrings;
1002
    my $allabs = join "; ", @abstrings;
1003
1003
1004
    if (length($allabs) > 0) {
1004
    if (length($allabs) > 0) {
1005
	print "N2  - ", &charconv($allabs), "\r\n";
1005
	print "N2  - ", $allabs, "\r\n";
1006
    }
1006
    }
1007
1007
1008
}
1008
}
1009
1009
1010
    
1011
    
1012
##********************************************************************
1013
## charconv(): converts to a different charset based on a global var
1014
## Arguments: string
1015
## Returns: string
1016
##********************************************************************
1017
sub charconv {
1018
    if ($utf) {
1019
	## return unaltered if already utf-8
1020
	return @_;
1021
    }
1022
    elsif (my $uniout eq "t") {
1023
	## convert to utf-8
1024
	return marc8_to_utf8("@_");
1025
    }
1026
    else {
1027
	## return unaltered if no utf-8 requested
1028
	return @_;
1029
    }
1030
}
1031
1;
1010
1;
(-)a/t/Ris.t (-5 / +1 lines)
Lines 6-12 Link Here
6
use strict;
6
use strict;
7
use warnings;
7
use warnings;
8
8
9
use Test::More tests => 6;
9
use Test::More tests => 4;
10
10
11
BEGIN {
11
BEGIN {
12
        use_ok('C4::Ris');
12
        use_ok('C4::Ris');
Lines 17-22 is(C4::Ris::print_typetag(),undef,'test printing typetag'); Link Here
17
is(C4::Ris::print_title(),undef, 'test printing title when print_title is nil');
17
is(C4::Ris::print_title(),undef, 'test printing title when print_title is nil');
18
18
19
is(C4::Ris::print_stitle(),undef, 'test printing info from series title field when its nil');
19
is(C4::Ris::print_stitle(),undef, 'test printing info from series title field when its nil');
20
21
ok((C4::Ris::charconv('hello world'))[0] eq 'hello world', 'testing that it returns what you entered');
22
ok(C4::Ris::charconv() == 0, 'testing when charconv is nil');
23
- 

Return to bug 16199