Bugzilla – Attachment 51219 Details for
Bug 16442
C4::Ris is not plack safe
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 16442: C4::Ris is not plack safe
Bug-16442-C4Ris-is-not-plack-safe.patch (text/plain), 3.87 KB, created by
Jonathan Druart
on 2016-05-04 19:04:48 UTC
(
hide
)
Description:
Bug 16442: C4::Ris is not plack safe
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2016-05-04 19:04:48 UTC
Size:
3.87 KB
patch
obsolete
>From c6f5e0a029d7a8d8380c054f21693a1d626ce16b Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Wed, 4 May 2016 19:53:46 +0100 >Subject: [PATCH] Bug 16442: C4::Ris is not plack safe > >C4::Ris incorrectly uses 4 package variables: >- $utf: not used, can be removed >- $intype: set to marcflavour once, but later it assumes that it is > usmarc if not defined >- $marcprint: always 0, so set it to 0 >- $protoyear: only used in 1 subroutine, let's define it at this > level > >Test plan: >Just make sure the RIS export works as before this patch >--- > C4/Ris.pm | 38 ++++++++++++++++---------------------- > 1 file changed, 16 insertions(+), 22 deletions(-) > >diff --git a/C4/Ris.pm b/C4/Ris.pm >index 4833202..2303fc2 100644 >--- a/C4/Ris.pm >+++ b/C4/Ris.pm >@@ -76,11 +76,7 @@ use Koha::SimpleMARC qw(read_field); > &marc2ris > ); > >-our $utf; >-our $intype; >-our $marcprint; >-our $protoyear; >- >+our $marcprint = 0; # Debug flag; > > =head1 marc2bibtex - Convert from UNIMARC to RIS > >@@ -97,8 +93,7 @@ sub marc2ris { > my $output; > > my $marcflavour = C4::Context->preference("marcflavour"); >- $intype = lc($marcflavour); >- my $marcprint = 0; # Debug flag; >+ my $intype = lc($marcflavour); > > # Let's redirect stdout > open my $oldout, ">&STDOUT"; >@@ -113,7 +108,6 @@ sub marc2ris { > if ( $intype eq "marc21" ) { > if ( $leader =~ /^.{9}a/ ) { > print "<marc>---\r\n<marc>UTF-8 data\r\n" if $marcprint; >- $utf = 1; > } > else { > print "<marc>---\r\n<marc>MARC-8 data\r\n" if $marcprint; >@@ -395,21 +389,13 @@ sub print_typetag { > ## hints > > my %typehash; >- >- ## the ukmarc here is just a guess >- if (! defined $intype) { >- ## assume MARC21 as default >- %typehash = %ustypehash; >- } >- elsif ($intype eq "marc21" || $intype eq "ukmarc") { >- %typehash = %ustypehash; >- } >- elsif ($intype eq "unimarc") { >- %typehash = %unitypehash; >+ my $marcflavour = C4::Context->preference("marcflavour"); >+ my $intype = lc($marcflavour); >+ if ($intype eq "unimarc") { >+ %typehash = %unitypehash; > } > else { >- ## assume MARC21 as default >- %typehash = %ustypehash; >+ %typehash = %ustypehash; > } > > if (!defined $typeofrecord || !exists $typehash{$typeofrecord}) { >@@ -482,6 +468,8 @@ sub get_author { > > ## the sequence of the name parts is encoded either in indicator > ## 1 (marc21) or 2 (unimarc) >+ my $marcflavour = C4::Context->preference("marcflavour"); >+ my $intype = lc($marcflavour); > if ($intype eq "unimarc") { > $indicator = 2; > } >@@ -552,6 +540,8 @@ $clean_subtitle ||= q{}; > $clean_title =~ s% *[/:;.]$%%; > $clean_subtitle =~ s%^ *(.*) *[/:;.]$%$1%; > >+ my $marcflavour = C4::Context->preference("marcflavour"); >+ my $intype = lc($marcflavour); > if (length($clean_title) > 0 > || (length($clean_subtitle) > 0 && $intype ne "unimarc")) { > print "TI - ", $clean_title; >@@ -591,6 +581,8 @@ sub print_stitle { > print "T2 - ", $clean_title,"\r\n"; > } > >+ my $marcflavour = C4::Context->preference("marcflavour"); >+ my $intype = lc($marcflavour); > if ($intype eq "unimarc") { > print "<marc>Series vol(\$v): ",$titlefield->subfield('v'),"\r\n" if $marcprint; > if (length($titlefield->subfield('v')) > 0) { >@@ -726,6 +718,8 @@ sub print_pubinfo { > my $pubsub_publisher; > my $pubsub_date; > >+ my $marcflavour = C4::Context->preference("marcflavour"); >+ my $intype = lc($marcflavour); > if ($intype eq "unimarc") { > $pubsub_place = "a"; > $pubsub_publisher = "c"; >@@ -758,7 +752,7 @@ sub print_pubinfo { > ## the dates are free-form, so we want to extract > ## a four-digit year and leave the rest as > ## "other info" >- $protoyear = @$tuple[1]; >+ my $protoyear = @$tuple[1]; > print "<marc>Year (260\$c): $protoyear\r\n" if $marcprint; > > ## strip any separator chars at the end >-- >2.7.0
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 16442
:
51219
|
51221
|
51773
|
52005