Bugzilla – Attachment 7661 Details for
Bug 3264
Uncloning a dropdown list in MARC authorities/biblio editor may clear all subfields (see comment 17)
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 3264 UnCloneField() / minus button in MARC editor can clear all subfields (authorities AND biblio)
Bug-3264-UnCloneField--minus-button-in-MARC-editor.patch (text/plain), 3.65 KB, created by
Jared Camins-Esakov
on 2012-02-15 17:05:04 UTC
(
hide
)
Description:
Bug 3264 UnCloneField() / minus button in MARC editor can clear all subfields (authorities AND biblio)
Filename:
MIME Type:
Creator:
Jared Camins-Esakov
Created:
2012-02-15 17:05:04 UTC
Size:
3.65 KB
patch
obsolete
>From 39e17905d77c4ea4e0bd93cfdd35cc42dd7efdb3 Mon Sep 17 00:00:00 2001 >From: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> >Date: Thu, 19 Jan 2012 09:50:03 +0100 >Subject: [PATCH] Bug 3264 UnCloneField() / minus button in MARC editor can clear all subfields (authorities AND biblio) >Content-Type: text/plain; charset="utf-8" > >All subfields following the removed subfield were not saved. >Problem is in C4/Biblio routine TransformHtmlToMarc. >If the field is emptied, the param list contains a code param but no subfield >param. The while loop handling the subfields could not handle that. Also added >a FIXME because the whole routine depends on an assumption about the order of >cgi parameters that is not strictly guaranteed. > >Signed-off-by: Jared Camins-Esakov <jcamins@cpbibliography.com> >I was unable to replicate the problem, but can confirm that the patch does >not break anything under any of the following platforms/browsers: >Mac OS X 10.6.8: >Chrome 16.0.912.77 >Firefox 9.0.1 > >Windows 7: >Firefox 3.6.3 >Firefox 9.0.1 >IE 8.0.7600.16385 > >Ubuntu 11.10 >Firefox 8.0 >Chromium 15.0.874.106 (Developer Build 107270 Linux) >--- > C4/Biblio.pm | 27 ++++++++++++++++----------- > 1 files changed, 16 insertions(+), 11 deletions(-) > >diff --git a/C4/Biblio.pm b/C4/Biblio.pm >index 83fef13..8d2dd9d 100644 >--- a/C4/Biblio.pm >+++ b/C4/Biblio.pm >@@ -2142,6 +2142,7 @@ sub TransformHtmlToMarc { > my $record = MARC::Record->new(); > my $i = 0; > my @fields; >+#FIXME This code assumes that the CGI params will be in the same order as the fields in the template; this is no absolute guarantee! > while ( $params[$i] ) { # browse all CGI params > my $param = $params[$i]; > my $newfield = 0; >@@ -2181,19 +2182,23 @@ sub TransformHtmlToMarc { > > # > 009, deal with subfields > } else { >- while ( defined $params[$j] && $params[$j] =~ /_code_/ ) { # browse all it's subfield >- my $inner_param = $params[$j]; >- if ($newfield) { >- if ( $cgi->param( $params[ $j + 1 ] ) ne '' ) { # only if there is a value (code => value) >- $newfield->add_subfields( $cgi->param($inner_param) => $cgi->param( $params[ $j + 1 ] ) ); >- } >- } else { >- if ( $cgi->param( $params[ $j + 1 ] ) ne '' ) { # creating only if there is a value (code => value) >- $newfield = MARC::Field->new( $tag, $ind1, $ind2, $cgi->param($inner_param) => $cgi->param( $params[ $j + 1 ] ), ); >- } >+ # browse subfields for this tag (reason for _code_ match) >+ while(defined $params[$j] && $params[$j] =~ /_code_/) { >+ last unless defined $params[$j+1]; >+ #if next param ne subfield, then it was probably empty >+ #try next param by incrementing j >+ if($params[$j+1]!~/_subfield_/) {$j++; next; } >+ 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); >+ } >+ elsif($fval ne '') { >+ $newfield = MARC::Field->new( $tag, $ind1, $ind2, $cgi->param($params[$j]) => $fval ); > } > $j += 2; >- } >+ } #end-of-while >+ $i= $j-1; #update i for outer loop accordingly > } > push @fields, $newfield if ($newfield); > } >-- >1.7.2.5
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 3264
:
2394
|
7245
| 7661