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 549-559 $clean_subtitle ||= q{}; Link Here
549
549
550
	if (length($clean_title) > 0
550
	if (length($clean_title) > 0
551
	    || (length($clean_subtitle) > 0 && $intype ne "unimarc")) {
551
	    || (length($clean_subtitle) > 0 && $intype ne "unimarc")) {
552
	    print "TI  - ", &charconv($clean_title);
552
	    print "TI  - ", $clean_title;
553
553
554
	    ## subfield $b is relevant only for marc21/ukmarc
554
	    ## subfield $b is relevant only for marc21/ukmarc
555
	    if (length($clean_subtitle) > 0 && $intype ne "unimarc") {
555
	    if (length($clean_subtitle) > 0 && $intype ne "unimarc") {
556
		print ": ",&charconv($clean_subtitle);
556
		print ": ",$clean_subtitle;
557
	    }
557
	    }
558
	    print "\r\n";
558
	    print "\r\n";
559
	}
559
	}
Lines 583-595 sub print_stitle { Link Here
583
	$clean_title =~ s% *[/:;.]$%%;
583
	$clean_title =~ s% *[/:;.]$%%;
584
584
585
	if (length($clean_title) > 0) {
585
	if (length($clean_title) > 0) {
586
	    print "T2  - ", &charconv($clean_title),"\r\n";
586
	    print "T2  - ", $clean_title,"\r\n";
587
	}
587
	}
588
588
589
	if ($intype eq "unimarc") {
589
	if ($intype eq "unimarc") {
590
	    print "<marc>Series vol(\$v): ",$titlefield->subfield('v'),"\r\n" if $marcprint;
590
	    print "<marc>Series vol(\$v): ",$titlefield->subfield('v'),"\r\n" if $marcprint;
591
	    if (length($titlefield->subfield('v')) > 0) {
591
	    if (length($titlefield->subfield('v')) > 0) {
592
		print "VL  - ", &charconv($titlefield->subfield('v')),"\r\n";
592
		print "VL  - ", $titlefield->subfield('v'),"\r\n";
593
	    }
593
	    }
594
	}
594
	}
595
    }
595
    }
Lines 613-619 sub print_isbn { Link Here
613
	}
613
	}
614
614
615
    my $isbn = $isbnfield->subfield('a');
615
    my $isbn = $isbnfield->subfield('a');
616
	print "SN  - ", &charconv($isbn), "\r\n";
616
	print "SN  - ", $isbn, "\r\n";
617
    }
617
    }
618
}
618
}
619
619
Lines 635-641 sub print_issn { Link Here
635
	}
635
	}
636
636
637
	my $issn = substr($issnfield->subfield('a'), 0, 9);
637
	my $issn = substr($issnfield->subfield('a'), 0, 9);
638
	print "SN  - ", &charconv($issn), "\r\n";
638
	print "SN  - ", $issn, "\r\n";
639
    }
639
    }
640
}
640
}
641
641
Lines 647-653 sub print_uri { Link Here
647
647
648
    foreach my $f856 (@f856s) {
648
    foreach my $f856 (@f856s) {
649
        if (my $uri = $f856->subfield('u')) {
649
        if (my $uri = $f856->subfield('u')) {
650
	        print "UR  - ", charconv($uri), "\r\n";
650
	        print "UR  - ", $uri, "\r\n";
651
        }
651
        }
652
    }
652
    }
653
}
653
}
Lines 664-670 sub print_loc_callno { Link Here
664
	warn("no LOC call number found") if $marcprint;
664
	warn("no LOC call number found") if $marcprint;
665
    }
665
    }
666
    else {
666
    else {
667
	print "AV  - ", &charconv($callnofield->subfield('a')), " ", &charconv($callnofield->subfield('b')), "\r\n";
667
	print "AV  - ", $callnofield->subfield('a'), " ", $callnofield->subfield('b'), "\r\n";
668
    }
668
    }
669
}
669
}
670
670
Lines 680-686 sub print_dewey { Link Here
680
	warn("no Dewey number found") if $marcprint;
680
	warn("no Dewey number found") if $marcprint;
681
    }
681
    }
682
    else {
682
    else {
683
	print "U1  - ", &charconv($deweyfield->subfield('a')), " ", &charconv($deweyfield->subfield('2')), "\r\n";
683
	print "U1  - ", $deweyfield->subfield('a'), " ", $deweyfield->subfield('2'), "\r\n";
684
    }
684
    }
685
}
685
}
686
686
Lines 794-803 sub print_pubinfo { Link Here
794
794
795
	## now dump the collected CY and PB lists
795
	## now dump the collected CY and PB lists
796
	if (@cities > 0) {
796
	if (@cities > 0) {
797
	    print "CY  - ", &charconv(join(", ", @cities)), "\r\n";
797
	    print "CY  - ", join(", ", @cities), "\r\n";
798
	}
798
	}
799
	if (@publishers > 0) {
799
	if (@publishers > 0) {
800
	    print "PB  - ", &charconv(join(", ", @publishers)), "\r\n";
800
	    print "PB  - ", join(", ", @publishers), "\r\n";
801
	}
801
	}
802
    }
802
    }
803
}
803
}
Lines 997-1026 sub print_abstract { Link Here
997
    my $allabs = join "; ", @abstrings;
997
    my $allabs = join "; ", @abstrings;
998
998
999
    if (length($allabs) > 0) {
999
    if (length($allabs) > 0) {
1000
	print "N2  - ", &charconv($allabs), "\r\n";
1000
	print "N2  - ", $allabs, "\r\n";
1001
    }
1001
    }
1002
1002
1003
}
1003
}
1004
1004
1005
    
1006
    
1007
##********************************************************************
1008
## charconv(): converts to a different charset based on a global var
1009
## Arguments: string
1010
## Returns: string
1011
##********************************************************************
1012
sub charconv {
1013
    if ($utf) {
1014
	## return unaltered if already utf-8
1015
	return @_;
1016
    }
1017
    elsif (my $uniout eq "t") {
1018
	## convert to utf-8
1019
	return marc8_to_utf8("@_");
1020
    }
1021
    else {
1022
	## return unaltered if no utf-8 requested
1023
	return @_;
1024
    }
1025
}
1026
1;
1005
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