Bugzilla – Attachment 41911 Details for
Bug 11247
Fix calls of TransformHtmlToXml
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 11247: Removed unused params from TransformHtmlToXml()
Bug-11247-Removed-unused-params-from-TransformHtml.patch (text/plain), 13.93 KB, created by
Mark Tompsett
on 2015-08-25 12:55:36 UTC
(
hide
)
Description:
Bug 11247: Removed unused params from TransformHtmlToXml()
Filename:
MIME Type:
Creator:
Mark Tompsett
Created:
2015-08-25 12:55:36 UTC
Size:
13.93 KB
patch
obsolete
>From f073c2c772ccc9b885874b527848a56484281896 Mon Sep 17 00:00:00 2001 >From: Srdjan <srdjan@catalyst.net.nz> >Date: Thu, 14 Nov 2013 19:10:30 +1300 >Subject: [PATCH] Bug 11247: Removed unused params from TransformHtmlToXml() > >$indicator and $ind_tag should not be TransformHtmlToXml() params. >TransformHtmlToXml() is only used for items: >- $indicator is always empty >- $ind_tag was not even used in the function > >To test: >Check that integrity of following functions is preserved: >* Acquisition - ordering and receiving, needs setting AcqCreateItem to > placing and receiving an order >* Cataloging - create/modify an item >* Batcih modify in Tools >* Serials receiving >--- > C4/Biblio.pm | 31 +++++-------------------------- > acqui/addorder.pl | 6 ------ > acqui/addorderiso2709.pl | 6 +----- > acqui/finishreceive.pl | 7 +------ > cataloguing/additem.pl | 26 ++------------------------ > serials/serials-edit.pl | 6 ------ > tools/batchMod.pl | 21 +-------------------- > 7 files changed, 10 insertions(+), 93 deletions(-) > >diff --git a/C4/Biblio.pm b/C4/Biblio.pm >index d90094e..3c5fb41 100644 >--- a/C4/Biblio.pm >+++ b/C4/Biblio.pm >@@ -2298,8 +2298,7 @@ sub PrepHostMarcField { > > =head2 TransformHtmlToXml > >- $xml = TransformHtmlToXml( $tags, $subfields, $values, $indicator, >- $ind_tag, $auth_type ) >+ $xml = TransformHtmlToXml( $tags, $subfields, $values, $auth_type ) > > $auth_type contains : > >@@ -2316,7 +2315,7 @@ $auth_type contains : > =cut > > sub TransformHtmlToXml { >- my ( $tags, $subfields, $values, $indicator, $ind_tag, $auth_type ) = @_; >+ my ( $tags, $subfields, $values, $auth_type ) = @_; > my $xml = MARC::File::XML::header('UTF-8'); > $xml .= "<record>\n"; > $auth_type = C4::Context->preference('marcflavour') unless $auth_type; >@@ -2352,21 +2351,11 @@ sub TransformHtmlToXml { > > if ( ( @$tags[$i] ne $prevtag ) ) { > $j++ unless ( @$tags[$i] eq "" ); >- my $indicator1 = eval { substr( @$indicator[$j], 0, 1 ) }; >- my $indicator2 = eval { substr( @$indicator[$j], 1, 1 ) }; >- my $ind1 = _default_ind_to_space($indicator1); >- my $ind2; >- if ( @$indicator[$j] ) { >- $ind2 = _default_ind_to_space($indicator2); >- } else { >- warn "Indicator in @$tags[$i] is empty"; >- $ind2 = " "; >- } > if ( !$first ) { > $xml .= "</datafield>\n"; > if ( ( @$tags[$i] && @$tags[$i] > 10 ) > && ( @$values[$i] ne "" ) ) { >- $xml .= "<datafield tag=\"@$tags[$i]\" ind1=\"$ind1\" ind2=\"$ind2\">\n"; >+ $xml .= "<datafield tag=\"@$tags[$i]\" ind1=\"\" ind2=\"\">\n"; > $xml .= "<subfield code=\"@$subfields[$i]\">@$values[$i]</subfield>\n"; > $first = 0; > } else { >@@ -2385,27 +2374,17 @@ sub TransformHtmlToXml { > $xml .= "<controlfield tag=\"@$tags[$i]\">@$values[$i]</controlfield>\n"; > $first = 1; > } else { >- $xml .= "<datafield tag=\"@$tags[$i]\" ind1=\"$ind1\" ind2=\"$ind2\">\n"; >+ $xml .= "<datafield tag=\"@$tags[$i]\" ind1=\"\" ind2=\"\">\n"; > $xml .= "<subfield code=\"@$subfields[$i]\">@$values[$i]</subfield>\n"; > $first = 0; > } > } > } > } else { # @$tags[$i] eq $prevtag >- my $indicator1 = eval { substr( @$indicator[$j], 0, 1 ) }; >- my $indicator2 = eval { substr( @$indicator[$j], 1, 1 ) }; >- my $ind1 = _default_ind_to_space($indicator1); >- my $ind2; >- if ( @$indicator[$j] ) { >- $ind2 = _default_ind_to_space($indicator2); >- } else { >- warn "Indicator in @$tags[$i] is empty"; >- $ind2 = " "; >- } > if ( @$values[$i] eq "" ) { > } else { > if ($first) { >- $xml .= "<datafield tag=\"@$tags[$i]\" ind1=\"$ind1\" ind2=\"$ind2\">\n"; >+ $xml .= "<datafield tag=\"@$tags[$i]\" ind1=\"\" ind2=\"\">\n"; > $first = 0; > } > $xml .= "<subfield code=\"@$subfields[$i]\">@$values[$i]</subfield>\n"; >diff --git a/acqui/addorder.pl b/acqui/addorder.pl >index 5a5cd9d..1d770e3 100755 >--- a/acqui/addorder.pl >+++ b/acqui/addorder.pl >@@ -284,8 +284,6 @@ if ( $orderinfo->{quantity} ne '0' ) { > my @field_values = $input->param('field_value'); > my @serials = $input->param('serial'); > my @itemid = $input->param('itemid'); >- my @ind_tag = $input->param('ind_tag'); >- my @indicator = $input->param('indicator'); > #Rebuilding ALL the data for items into a hash > # parting them on $itemid. > >@@ -299,16 +297,12 @@ if ( $orderinfo->{quantity} ne '0' ) { > push @{$itemhash{$itemid[$i]}->{'tags'}},$tags[$i]; > push @{$itemhash{$itemid[$i]}->{'subfields'}},$subfields[$i]; > push @{$itemhash{$itemid[$i]}->{'field_values'}},$field_values[$i]; >- push @{$itemhash{$itemid[$i]}->{'ind_tag'}},$ind_tag[$i]; >- push @{$itemhash{$itemid[$i]}->{'indicator'}},$indicator[$i]; > } > foreach my $item (keys %itemhash){ > > my $xml = TransformHtmlToXml( $itemhash{$item}->{'tags'}, > $itemhash{$item}->{'subfields'}, > $itemhash{$item}->{'field_values'}, >- $itemhash{$item}->{'ind_tag'}, >- $itemhash{$item}->{'indicator'}, > 'ITEM'); > my $record=MARC::Record::new_from_xml($xml, 'UTF-8'); > my ($biblionumber,$bibitemnum,$itemnumber) = AddItemFromMarc($record,$$orderinfo{biblionumber}); >diff --git a/acqui/addorderiso2709.pl b/acqui/addorderiso2709.pl >index b809fb9..dbf1a36 100755 >--- a/acqui/addorderiso2709.pl >+++ b/acqui/addorderiso2709.pl >@@ -271,15 +271,11 @@ if ($op eq ""){ > my @subfields = $input->param('subfield'); > my @field_values = $input->param('field_value'); > my @serials = $input->param('serial'); >- my @ind_tag = $input->param('ind_tag'); >- my @indicator = $input->param('indicator'); > my $item; > push @{ $item->{tags} }, $tags[0]; > push @{ $item->{subfields} }, $subfields[0]; > push @{ $item->{field_values} }, $field_values[0]; >- push @{ $item->{ind_tag} }, $ind_tag[0]; >- push @{ $item->{indicator} }, $indicator[0]; >- my $xml = TransformHtmlToXml( \@tags, \@subfields, \@field_values, \@ind_tag, \@indicator ); >+ my $xml = TransformHtmlToXml( \@tags, \@subfields, \@field_values ); > my $record = MARC::Record::new_from_xml( $xml, 'UTF-8' ); > for (my $qtyloop=1;$qtyloop <= $c_quantity;$qtyloop++) { > my ( $biblionumber, $bibitemnum, $itemnumber ) = AddItemFromMarc( $record, $biblionumber ); >diff --git a/acqui/finishreceive.pl b/acqui/finishreceive.pl >index 5f0cf81..2dc9a8f 100755 >--- a/acqui/finishreceive.pl >+++ b/acqui/finishreceive.pl >@@ -127,8 +127,6 @@ if ($quantityrec > $origquantityrec ) { > my @field_values = $input->param('field_value'); > my @serials = $input->param('serial'); > my @itemid = $input->param('itemid'); >- my @ind_tag = $input->param('ind_tag'); >- my @indicator = $input->param('indicator'); > #Rebuilding ALL the data for items into a hash > # parting them on $itemid. > my %itemhash; >@@ -141,16 +139,13 @@ if ($quantityrec > $origquantityrec ) { > push @{$itemhash{$itemid[$i]}->{'tags'}},$tags[$i]; > push @{$itemhash{$itemid[$i]}->{'subfields'}},$subfields[$i]; > push @{$itemhash{$itemid[$i]}->{'field_values'}},$field_values[$i]; >- push @{$itemhash{$itemid[$i]}->{'ind_tag'}},$ind_tag[$i]; >- push @{$itemhash{$itemid[$i]}->{'indicator'}},$indicator[$i]; > } > my $order = Koha::Acquisition::Order->fetch({ ordernumber => $new_ordernumber }); > foreach my $item (keys %itemhash){ > my $xml = TransformHtmlToXml( $itemhash{$item}->{'tags'}, > $itemhash{$item}->{'subfields'}, > $itemhash{$item}->{'field_values'}, >- $itemhash{$item}->{'ind_tag'}, >- $itemhash{$item}->{'indicator'},'ITEM'); >+ 'ITEM'); > my $record=MARC::Record::new_from_xml($xml, 'UTF-8'); > my (undef,$bibitemnum,$itemnumber) = AddItemFromMarc($record,$biblionumber); > $order->add_item( $itemnumber ); >diff --git a/cataloguing/additem.pl b/cataloguing/additem.pl >index 38f5d92..01c10d3 100755 >--- a/cataloguing/additem.pl >+++ b/cataloguing/additem.pl >@@ -43,22 +43,6 @@ use URI::Escape; > > our $dbh = C4::Context->dbh; > >-sub find_value { >- my ($tagfield,$insubfield,$record) = @_; >- my $result; >- my $indicator; >- foreach my $field ($record->field($tagfield)) { >- my @subfields = $field->subfields(); >- foreach my $subfield (@subfields) { >- if (@$subfield[0] eq $insubfield) { >- $result .= @$subfield[1]; >- $indicator = $field->indicator(1).$field->indicator(2); >- } >- } >- } >- return($indicator,$result); >-} >- > sub get_item_from_barcode { > my ($barcode)=@_; > my $dbh=C4::Context->dbh; >@@ -433,10 +417,7 @@ if ($op eq "additem") { > my @tags = $input->param('tag'); > my @subfields = $input->param('subfield'); > my @values = $input->param('field_value'); >- # build indicator hash. >- my @ind_tag = $input->param('ind_tag'); >- my @indicator = $input->param('indicator'); >- my $xml = TransformHtmlToXml(\@tags,\@subfields,\@values,\@indicator,\@ind_tag, 'ITEM'); >+ my $xml = TransformHtmlToXml(\@tags,\@subfields,\@values, 'ITEM'); > my $record = MARC::Record::new_from_xml($xml, 'UTF-8'); > > # type of add >@@ -641,11 +622,8 @@ if ($op eq "additem") { > my @tags = $input->param('tag'); > my @subfields = $input->param('subfield'); > my @values = $input->param('field_value'); >- # build indicator hash. >- my @ind_tag = $input->param('ind_tag'); >- my @indicator = $input->param('indicator'); > # my $itemnumber = $input->param('itemnumber'); >- my $xml = TransformHtmlToXml(\@tags,\@subfields,\@values,\@indicator,\@ind_tag,'ITEM'); >+ my $xml = TransformHtmlToXml(\@tags,\@subfields,\@values,'ITEM'); > my $itemtosave=MARC::Record::new_from_xml($xml, 'UTF-8'); > # MARC::Record builded => now, record in DB > # warn "R: ".$record->as_formatted; >diff --git a/serials/serials-edit.pl b/serials/serials-edit.pl >index 8df489d..bb4f8d8 100755 >--- a/serials/serials-edit.pl >+++ b/serials/serials-edit.pl >@@ -254,8 +254,6 @@ if ( $op and $op eq 'serialchangestatus' ) { > my @serials = $query->param('serial'); > my @bibnums = $query->param('bibnum'); > my @itemid = $query->param('itemid'); >- my @ind_tag = $query->param('ind_tag'); >- my @indicator = $query->param('indicator'); > > #Rebuilding ALL the data for items into a hash > # parting them on $itemid. >@@ -280,8 +278,6 @@ if ( $op and $op eq 'serialchangestatus' ) { > push @{ $itemhash{ $itemid[$i] }->{'subfields'} }, $subfields[$i]; > push @{ $itemhash{ $itemid[$i] }->{'field_values'} }, > $field_values[$i]; >- push @{ $itemhash{ $itemid[$i] }->{'ind_tag'} }, $ind_tag[$i]; >- push @{ $itemhash{ $itemid[$i] }->{'indicator'} }, $indicator[$i]; > } > foreach my $item ( keys %itemhash ) { > >@@ -301,8 +297,6 @@ if ( $op and $op eq 'serialchangestatus' ) { > $itemhash{$item}->{'tags'}, > $itemhash{$item}->{'subfields'}, > $itemhash{$item}->{'field_values'}, >- $itemhash{$item}->{'indicator'}, >- $itemhash{$item}->{'ind_tag'} > ); > > # warn $xml; >diff --git a/tools/batchMod.pl b/tools/batchMod.pl >index 4ed0f10..ddb6597 100755 >--- a/tools/batchMod.pl >+++ b/tools/batchMod.pl >@@ -104,9 +104,6 @@ if ($op eq "action") { > my @subfields = $input->param('subfield'); > my @values = $input->param('field_value'); > my @disabled = $input->param('disable_input'); >- # build indicator hash. >- my @ind_tag = $input->param('ind_tag'); >- my @indicator = $input->param('indicator'); > > # Is there something to modify ? > # TODO : We shall use this var to warn the user in case no modification was done to the items >@@ -146,7 +143,7 @@ if ($op eq "action") { > #initializing values for updates > my ( $itemtagfield, $itemtagsubfield) = &GetMarcFromKohaField("items.itemnumber", ""); > if ($values_to_modify){ >- my $xml = TransformHtmlToXml(\@tags,\@subfields,\@values,\@indicator,\@ind_tag, 'ITEM'); >+ my $xml = TransformHtmlToXml(\@tags,\@subfields,\@values, 'ITEM'); > $marcitem = MARC::Record::new_from_xml($xml, 'UTF-8'); > } > if ($values_to_blank){ >@@ -626,22 +623,6 @@ sub UpdateMarcWith { > return $modified; > } > >-sub find_value { >- my ($tagfield,$insubfield,$record) = @_; >- my $result; >- my $indicator; >- foreach my $field ($record->field($tagfield)) { >- my @subfields = $field->subfields(); >- foreach my $subfield (@subfields) { >- if (@$subfield[0] eq $insubfield) { >- $result .= @$subfield[1]; >- $indicator = $field->indicator(1).$field->indicator(2); >- } >- } >- } >- return($indicator,$result); >-} >- > # ---------------------------- > # Background functions > >-- >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 11247
:
22923
|
22924
|
22953
|
41911
|
41971
|
41972
|
42088
|
42137
|
42138
|
42226