From a201aac3c88bc2f06a2597219119499bc798b043 Mon Sep 17 00:00:00 2001 From: Paul POULAIN Date: Tue, 4 Sep 2007 15:56:12 +0200 Subject: [PATCH] BUGFIX (major) : when editing an existing biblio, biblionumber was lost In Koha 2.2 the biblionumber was an hidden field in the form, exactly as any other subfield. As we also stored biblionumber as specific field, it was useless to have it twice. with this commit, we restore the biblionumber in the MARC:Record in TransformHtml2Marc Signed-off-by: Chris Cormack --- C4/Biblio.pm | 24 +++++++++++++++++++++--- cataloguing/addbiblio.pl | 14 +++++--------- 2 files changed, 26 insertions(+), 12 deletions(-) diff --git a/C4/Biblio.pm b/C4/Biblio.pm index 05527c883e..00688fdfb9 100644 --- a/C4/Biblio.pm +++ b/C4/Biblio.pm @@ -2217,14 +2217,32 @@ sub TransformHtmlToMarc { while ($params->[$i]){ # browse all CGI params my $param = $params->[$i]; - - if($param =~ /^tag_(\d*)_indicator_/){ # new field start when having 'input name="..._indicator_..." + my $newfield=0; + # if we are on biblionumber, store it in the MARC::Record (it may not be in the edited fields) + if ($param eq 'biblionumber') { + my ( $biblionumbertagfield, $biblionumbertagsubfield ) = + &GetMarcFromKohaField( "biblio.biblionumber", '' ); + if ($biblionumbertagfield < 10) { + $newfield = MARC::Field->new( + $biblionumbertagfield, + $cgi->param($param), + ); + } else { + $newfield = MARC::Field->new( + $biblionumbertagfield, + '', + '', + "$biblionumbertagsubfield" => $cgi->param($param), + ); + } + push @fields,$newfield if($newfield); + } + elsif ($param =~ /^tag_(\d*)_indicator_/){ # new field start when having 'input name="..._indicator_..." my $tag = $1; my $ind1 = substr($cgi->param($param),0,1); my $ind2 = substr($cgi->param($param),1,1); - my $newfield=0; my $j=$i+1; if($tag < 10){ # no code for theses fields diff --git a/cataloguing/addbiblio.pl b/cataloguing/addbiblio.pl index b732e7f5f1..4d5459f0d9 100755 --- a/cataloguing/addbiblio.pl +++ b/cataloguing/addbiblio.pl @@ -704,8 +704,8 @@ $mandatory_z3950 = GetMandatoryFieldZ3950($frameworkcode); my $record = -1; my $encoding = ""; my ( - $biblionumtagfield, - $biblionumtagsubfield, + $biblionumbertagfield, + $biblionumbertagsubfield, $biblioitemnumtagfield, $biblioitemnumtagsubfield, $bibitem, @@ -725,7 +725,7 @@ if ($biblionumber) { $is_a_modif = 1; # if it's a modif, retrieve bibli and biblioitem numbers for the future modification of old-DB. - ( $biblionumtagfield, $biblionumtagsubfield ) = + ( $biblionumbertagfield, $biblionumbertagsubfield ) = &GetMarcFromKohaField( "biblio.biblionumber", $frameworkcode ); ( $biblioitemnumtagfield, $biblioitemnumtagsubfield ) = &GetMarcFromKohaField( "biblioitems.biblioitemnumber", $frameworkcode ); @@ -785,10 +785,6 @@ if ( $op eq "addbiblio" ) { build_tabs ($template, $record, $dbh,$encoding,$input); $template->param( biblionumber => $biblionumber, - biblionumtagfield => $biblionumtagfield, - biblionumtagsubfield => $biblionumtagsubfield, - biblioitemnumtagfield => $biblioitemnumtagfield, - biblioitemnumtagsubfield => $biblioitemnumtagsubfield, biblioitemnumber => $biblioitemnumber, duplicatebiblionumber => $duplicatebiblionumber, duplicatebibid => $duplicatebiblionumber, @@ -827,8 +823,8 @@ elsif ( $op eq "delete" ) { build_tabs( $template, $record, $dbh, $encoding,$input ); $template->param( biblionumber => $biblionumber, - biblionumtagfield => $biblionumtagfield, - biblionumtagsubfield => $biblionumtagsubfield, + biblionumbertagfield => $biblionumbertagfield, + biblionumbertagsubfield => $biblionumbertagsubfield, biblioitemnumtagfield => $biblioitemnumtagfield, biblioitemnumtagsubfield => $biblioitemnumtagsubfield, biblioitemnumber => $biblioitemnumber, -- 2.39.5