From c5da72bf051919af525a1b0a8edcc84b47f89fd9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joonas=20Kylm=C3=A4l=C3=A4?= Date: Sun, 26 Sep 2021 08:10:15 +0000 Subject: [PATCH] Bug 29111: Remove unused indicator modification code for items The indicator value for 952 was hard coded in every case to " ". In order to achieve that we can simply pass undef to TransformHtmlToXml() and it will set the indicator values to " ". To test: 1) Make sure the submission of (at least some) the modified files still work, e.g. test that making a new item via cataloguing/additem.pl works. --- acqui/addorder.pl | 8 ++------ acqui/addorderiso2709.pl | 4 +--- acqui/finishreceive.pl | 8 ++------ cataloguing/additem.pl | 10 ++-------- .../prog/en/modules/cataloguing/additem.tt | 2 -- serials/serials-edit.pl | 8 ++------ tools/batchMod.pl | 5 +---- 7 files changed, 10 insertions(+), 35 deletions(-) diff --git a/acqui/addorder.pl b/acqui/addorder.pl index e62cfe4710..318b148c8a 100755 --- a/acqui/addorder.pl +++ b/acqui/addorder.pl @@ -360,8 +360,6 @@ if ( $basket->{is_standing} || $orderinfo->{quantity} ne '0' ) { my @field_values = $input->multi_param('field_value'); my @serials = $input->multi_param('serial'); my @itemid = $input->multi_param('itemid'); - my @ind_tag = $input->multi_param('ind_tag'); - my @indicator = $input->multi_param('indicator'); #Rebuilding ALL the data for items into a hash # parting them on $itemid. @@ -375,15 +373,13 @@ if ( $basket->{is_standing} || $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}->{'indicator'}, - $itemhash{$item}->{'ind_tag'}, + undef, + undef, 'ITEM'); my $record=MARC::Record::new_from_xml($xml, 'UTF-8'); my ($barcodefield,$barcodesubfield) = GetMarcFromKohaField('items.barcode'); diff --git a/acqui/addorderiso2709.pl b/acqui/addorderiso2709.pl index 47c2ff2cca..fd38741c20 100755 --- a/acqui/addorderiso2709.pl +++ b/acqui/addorderiso2709.pl @@ -376,9 +376,7 @@ if ($op eq ""){ my @subfields = $input->multi_param('subfield'); my @field_values = $input->multi_param('field_value'); my @serials = $input->multi_param('serial'); - my @ind_tag = $input->multi_param('ind_tag'); - my @indicator = $input->multi_param('indicator'); - my $xml = TransformHtmlToXml( \@tags, \@subfields, \@field_values, \@indicator, \@ind_tag ); + 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 f97c7ff46c..afa97242a1 100755 --- a/acqui/finishreceive.pl +++ b/acqui/finishreceive.pl @@ -139,8 +139,6 @@ if ($quantityrec > $origquantityrec ) { my @field_values = $input->multi_param('field_value'); my @serials = $input->multi_param('serial'); my @itemid = $input->multi_param('itemid'); - my @ind_tag = $input->multi_param('ind_tag'); - my @indicator = $input->multi_param('indicator'); #Rebuilding ALL the data for items into a hash # parting them on $itemid. my %itemhash; @@ -153,16 +151,14 @@ 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 $new_order = Koha::Acquisition::Orders->find( $new_ordernumber ); foreach my $item (keys %itemhash){ my $xml = TransformHtmlToXml( $itemhash{$item}->{'tags'}, $itemhash{$item}->{'subfields'}, $itemhash{$item}->{'field_values'}, - $itemhash{$item}->{'indicator'}, - $itemhash{$item}->{'ind_tag'}, + undef, + undef, 'ITEM' ); my $record=MARC::Record::new_from_xml($xml, 'UTF-8'); my (undef,$bibitemnum,$itemnumber) = AddItemFromMarc($record,$biblionumber); diff --git a/cataloguing/additem.pl b/cataloguing/additem.pl index d3f9456db5..17814f2a60 100755 --- a/cataloguing/additem.pl +++ b/cataloguing/additem.pl @@ -492,10 +492,7 @@ if ($op eq "additem") { my @tags = $input->multi_param('tag'); my @subfields = $input->multi_param('subfield'); my @values = $input->multi_param('field_value'); - # build indicator hash. - my @ind_tag = $input->multi_param('ind_tag'); - my @indicator = $input->multi_param('indicator'); - my $xml = TransformHtmlToXml(\@tags,\@subfields,\@values,\@indicator,\@ind_tag, 'ITEM'); + my $xml = TransformHtmlToXml(\@tags,\@subfields,\@values,undef,undef, 'ITEM'); my $record = MARC::Record::new_from_xml($xml, 'UTF-8'); # type of add @@ -745,11 +742,8 @@ if ($op eq "additem") { my @tags = $input->multi_param('tag'); my @subfields = $input->multi_param('subfield'); my @values = $input->multi_param('field_value'); - # build indicator hash. - my @ind_tag = $input->multi_param('ind_tag'); - my @indicator = $input->multi_param('indicator'); # my $itemnumber = $input->param('itemnumber'); - my $xml = TransformHtmlToXml(\@tags,\@subfields,\@values,\@indicator,\@ind_tag,'ITEM'); + my $xml = TransformHtmlToXml(\@tags,\@subfields,\@values,undef,undef,'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/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/additem.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/additem.tt index bfecf0016c..4a828b4d3e 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/additem.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/additem.tt @@ -234,8 +234,6 @@ [% END %] - -
[% IF op != 'saveitem' %] diff --git a/serials/serials-edit.pl b/serials/serials-edit.pl index 76a6bf0b25..8c5720e88f 100755 --- a/serials/serials-edit.pl +++ b/serials/serials-edit.pl @@ -285,8 +285,6 @@ if ( $op and $op eq 'serialchangestatus' ) { my @serials = $query->multi_param('serial'); my @bibnums = $query->multi_param('bibnum'); my @itemid = $query->multi_param('itemid'); - my @ind_tag = $query->multi_param('ind_tag'); - my @indicator = $query->multi_param('indicator'); my @num_copies = $query->multi_param('number_of_copies'); #Rebuilding ALL the data for items into a hash @@ -313,8 +311,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 ) { @@ -334,8 +330,8 @@ if ( $op and $op eq 'serialchangestatus' ) { $itemhash{$item}->{'tags'}, $itemhash{$item}->{'subfields'}, $itemhash{$item}->{'field_values'}, - $itemhash{$item}->{'indicator'}, - $itemhash{$item}->{'ind_tag'} + undef, + undef ); # warn $xml; diff --git a/tools/batchMod.pl b/tools/batchMod.pl index 0f57a2debd..7518ed8edc 100755 --- a/tools/batchMod.pl +++ b/tools/batchMod.pl @@ -117,9 +117,6 @@ if ($op eq "action") { my @replaces = $input->multi_param('regex_replace'); my @modifiers = $input->multi_param('regex_modifiers'); my @disabled = $input->multi_param('disable_input'); - # build indicator hash. - my @ind_tag = $input->multi_param('ind_tag'); - my @indicator = $input->multi_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 @@ -131,7 +128,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,undef,undef, 'ITEM'); $marcitem = MARC::Record::new_from_xml($xml, 'UTF-8'); } if ($values_to_blank){ -- 2.20.1