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

(-)a/C4/Ris.pm (-23 / +16 lines)
Lines 76-86 use Koha::SimpleMARC qw(read_field); Link Here
76
  &marc2ris
76
  &marc2ris
77
);
77
);
78
78
79
our $utf;
79
our $marcprint = 0; # Debug flag;
80
our $intype;
81
our $marcprint;
82
our $protoyear;
83
84
80
85
=head1 marc2bibtex - Convert from UNIMARC to RIS
81
=head1 marc2bibtex - Convert from UNIMARC to RIS
86
82
Lines 97-104 sub marc2ris { Link Here
97
    my $output;
93
    my $output;
98
94
99
    my $marcflavour = C4::Context->preference("marcflavour");
95
    my $marcflavour = C4::Context->preference("marcflavour");
100
    $intype = lc($marcflavour);
96
    my $intype = lc($marcflavour);
101
    my $marcprint = 0; # Debug flag;
102
97
103
    # Let's redirect stdout
98
    # Let's redirect stdout
104
    open my $oldout, ">&STDOUT";
99
    open my $oldout, ">&STDOUT";
Lines 113-119 sub marc2ris { Link Here
113
    if ( $intype eq "marc21" ) {
108
    if ( $intype eq "marc21" ) {
114
        if ( $leader =~ /^.{9}a/ ) {
109
        if ( $leader =~ /^.{9}a/ ) {
115
            print "<marc>---\r\n<marc>UTF-8 data\r\n" if $marcprint;
110
            print "<marc>---\r\n<marc>UTF-8 data\r\n" if $marcprint;
116
            $utf = 1;
117
        }
111
        }
118
        else {
112
        else {
119
            print "<marc>---\r\n<marc>MARC-8 data\r\n" if $marcprint;
113
            print "<marc>---\r\n<marc>MARC-8 data\r\n" if $marcprint;
Lines 395-415 sub print_typetag { Link Here
395
    ## hints
389
    ## hints
396
390
397
    my %typehash;
391
    my %typehash;
398
    
392
    my $marcflavour = C4::Context->preference("marcflavour");
399
    ## the ukmarc here is just a guess
393
    my $intype = lc($marcflavour);
400
    if (! defined $intype) {
394
    if ($intype eq "unimarc") {
401
        ## assume MARC21 as default
395
        %typehash = %unitypehash;
402
        %typehash = %ustypehash;
403
    }
404
    elsif ($intype eq "marc21" || $intype eq "ukmarc") {
405
	%typehash = %ustypehash;
406
    }
407
    elsif ($intype eq "unimarc") {
408
	%typehash = %unitypehash;
409
    }
396
    }
410
    else {
397
    else {
411
	## assume MARC21 as default
398
        %typehash = %ustypehash;
412
	%typehash = %ustypehash;
413
    }
399
    }
414
400
415
    if (!defined $typeofrecord || !exists $typehash{$typeofrecord}) {
401
    if (!defined $typeofrecord || !exists $typehash{$typeofrecord}) {
Lines 482-487 sub get_author { Link Here
482
468
483
    ## the sequence of the name parts is encoded either in indicator
469
    ## the sequence of the name parts is encoded either in indicator
484
    ## 1 (marc21) or 2 (unimarc)
470
    ## 1 (marc21) or 2 (unimarc)
471
    my $marcflavour = C4::Context->preference("marcflavour");
472
    my $intype = lc($marcflavour);
485
    if ($intype eq "unimarc") {
473
    if ($intype eq "unimarc") {
486
	$indicator = 2;
474
	$indicator = 2;
487
    }
475
    }
Lines 552-557 $clean_subtitle ||= q{}; Link Here
552
	$clean_title =~ s% *[/:;.]$%%;
540
	$clean_title =~ s% *[/:;.]$%%;
553
	$clean_subtitle =~ s%^ *(.*) *[/:;.]$%$1%;
541
	$clean_subtitle =~ s%^ *(.*) *[/:;.]$%$1%;
554
542
543
    my $marcflavour = C4::Context->preference("marcflavour");
544
    my $intype = lc($marcflavour);
555
	if (length($clean_title) > 0
545
	if (length($clean_title) > 0
556
	    || (length($clean_subtitle) > 0 && $intype ne "unimarc")) {
546
	    || (length($clean_subtitle) > 0 && $intype ne "unimarc")) {
557
	    print "TI  - ", $clean_title;
547
	    print "TI  - ", $clean_title;
Lines 591-596 sub print_stitle { Link Here
591
	    print "T2  - ", $clean_title,"\r\n";
581
	    print "T2  - ", $clean_title,"\r\n";
592
	}
582
	}
593
583
584
    my $marcflavour = C4::Context->preference("marcflavour");
585
    my $intype = lc($marcflavour);
594
	if ($intype eq "unimarc") {
586
	if ($intype eq "unimarc") {
595
	    print "<marc>Series vol(\$v): ",$titlefield->subfield('v'),"\r\n" if $marcprint;
587
	    print "<marc>Series vol(\$v): ",$titlefield->subfield('v'),"\r\n" if $marcprint;
596
	    if (length($titlefield->subfield('v')) > 0) {
588
	    if (length($titlefield->subfield('v')) > 0) {
Lines 726-731 sub print_pubinfo { Link Here
726
	my $pubsub_publisher;
718
	my $pubsub_publisher;
727
	my $pubsub_date;
719
	my $pubsub_date;
728
720
721
    my $marcflavour = C4::Context->preference("marcflavour");
722
    my $intype = lc($marcflavour);
729
	if ($intype eq "unimarc") {
723
	if ($intype eq "unimarc") {
730
	    $pubsub_place = "a";
724
	    $pubsub_place = "a";
731
	    $pubsub_publisher = "c";
725
	    $pubsub_publisher = "c";
Lines 758-764 sub print_pubinfo { Link Here
758
		## the dates are free-form, so we want to extract
752
		## the dates are free-form, so we want to extract
759
		## a four-digit year and leave the rest as
753
		## a four-digit year and leave the rest as
760
		## "other info"
754
		## "other info"
761
		$protoyear = @$tuple[1];
755
        my $protoyear = @$tuple[1];
762
		print "<marc>Year (260\$c): $protoyear\r\n" if $marcprint;
756
		print "<marc>Year (260\$c): $protoyear\r\n" if $marcprint;
763
757
764
		## strip any separator chars at the end
758
		## strip any separator chars at the end
765
- 

Return to bug 16442