Bugzilla – Attachment 54535 Details for
Bug 16809
Silence CGI param warnings from C4::Biblio::TransformHtmlToMarc
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 16809: Silence authority warnings C4::Biblio::TransformHtmlToMarc
Bug-16809-Silence-authority-warnings-C4BiblioTrans.patch (text/plain), 3.84 KB, created by
Marcel de Rooy
on 2016-08-17 13:43:52 UTC
(
hide
)
Description:
Bug 16809: Silence authority warnings C4::Biblio::TransformHtmlToMarc
Filename:
MIME Type:
Creator:
Marcel de Rooy
Created:
2016-08-17 13:43:52 UTC
Size:
3.84 KB
patch
obsolete
>From ab51cfe5f118626231409506d854a143a2c306d6 Mon Sep 17 00:00:00 2001 >From: Mark Tompsett <mtompset@hotmail.com> >Date: Fri, 24 Jun 2016 11:29:19 -0400 >Subject: [PATCH] Bug 16809: Silence authority warnings > C4::Biblio::TransformHtmlToMarc >Content-Type: text/plain; charset=utf-8 > >Most of the floodiness is caused by accessing the cgi parameters >in a context which is hard to determine. By purposefully saving >the value to a scalar variable and using the variable, the issue >disappears, and it will likely be a tiny tad faster as variable >access is faster than multiple function calls. > >TEST PLAN >--------- > 1) Back up your intranet error log > -- for example: > cp ~/koha-dev/var/log/koha-error-log ~/koha-error-log.backup > 2) Blank your intranet error log > -- for example: > echo > ~/koha-dev/var/log/koha-error-log > 3) Log into your staff client > 4) Click 'Authorities' > 5) Click 'New from Z39.50' > 5) Type 'Seuss' into 'Name (any):' and press enter > 6) Click 'Import' beside the first link > 7) Click 'Save' > 8) Check your koha-error-log > -- floody! > 9) Apply patch >10) repeat steps 2-8 > -- blank! >11) restore your intranet error log > -- for example: > mv ~/koha-error-log.backup ~/koha-dev/var/log/koha-error-log >12) run koha qa test tools > >Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> >Tested with addbiblio.pl. I would have preferred the scalar option in terms >of simpler code, but this works too. >--- > C4/Biblio.pm | 14 ++++++++------ > 1 file changed, 8 insertions(+), 6 deletions(-) > >diff --git a/C4/Biblio.pm b/C4/Biblio.pm >index 2798325..3c99638 100644 >--- a/C4/Biblio.pm >+++ b/C4/Biblio.pm >@@ -2574,18 +2574,19 @@ sub TransformHtmlToMarc { > if ( $tag < 10 ) { # no code for theses fields > # in MARC editor, 000 contains the leader. > next if $tag == $biblionumbertagfield; >+ my $fval= $cgi->param($params[$j+1]); > if ( $tag eq '000' ) { > # Force a fake leader even if not provided to avoid crashing > # during decoding MARC record containing UTF-8 characters > $record->leader( >- length( $cgi->param($params[$j+1]) ) == 24 >- ? $cgi->param( $params[ $j + 1 ] ) >+ length( $fval ) == 24 >+ ? $fval > : ' nam a22 4500' > ) > ; > # between 001 and 009 (included) >- } elsif ( $cgi->param( $params[ $j + 1 ] ) ne '' ) { >- $newfield = MARC::Field->new( $tag, $cgi->param( $params[ $j + 1 ] ), ); >+ } elsif ( $fval ne '' ) { >+ $newfield = MARC::Field->new( $tag, $fval, ); > } > > # > 009, deal with subfields >@@ -2599,13 +2600,14 @@ sub TransformHtmlToMarc { > #if next param ne subfield, then it was probably empty > #try next param by incrementing j > if($params[$j+1]!~/_subfield_/) {$j++; next; } >+ my $fkey= $cgi->param($params[$j]); > my $fval= $cgi->param($params[$j+1]); > #check if subfield value not empty and field exists > if($fval ne '' && $newfield) { >- $newfield->add_subfields( $cgi->param($params[$j]) => $fval); >+ $newfield->add_subfields( $fkey => $fval); > } > elsif($fval ne '') { >- $newfield = MARC::Field->new( $tag, $ind1, $ind2, $cgi->param($params[$j]) => $fval ); >+ $newfield = MARC::Field->new( $tag, $ind1, $ind2, $fkey => $fval ); > } > $j += 2; > } #end-of-while >-- >2.1.4
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 16809
:
52832
|
54535
|
54536
|
54649
|
54650