@@ -, +, @@ - $indicator is always empty - $ind_tag was not even used in the function placing and receiving an order --- C4/Biblio.pm | 31 +++++-------------------------- acqui/addorder.pl | 7 +------ acqui/addorderiso2709.pl | 6 +----- acqui/finishreceive.pl | 7 +------ cataloguing/additem.pl | 26 ++------------------------ serials/serials-edit.pl | 6 ------ tools/batchMod.pl | 21 +-------------------- 7 files changed, 11 insertions(+), 93 deletions(-) --- a/C4/Biblio.pm +++ a/C4/Biblio.pm @@ -2203,8 +2203,7 @@ sub PrepHostMarcField { =head2 TransformHtmlToXml - $xml = TransformHtmlToXml( $tags, $subfields, $values, $indicator, - $ind_tag, $auth_type ) + $xml = TransformHtmlToXml( $tags, $subfields, $values, $indicator, $auth_type ) $auth_type contains : @@ -2221,7 +2220,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 .= "\n"; $auth_type = C4::Context->preference('marcflavour') unless $auth_type; @@ -2260,21 +2259,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 .= "\n"; if ( ( @$tags[$i] && @$tags[$i] > 10 ) && ( @$values[$i] ne "" ) ) { - $xml .= "\n"; + $xml .= "\n"; $xml .= "@$values[$i]\n"; $first = 0; } else { @@ -2293,27 +2282,17 @@ sub TransformHtmlToXml { $xml .= "@$values[$i]\n"; $first = 1; } else { - $xml .= "\n"; + $xml .= "\n"; $xml .= "@$values[$i]\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 .= "\n"; + $xml .= "\n"; $first = 0; } $xml .= "@$values[$i]\n"; --- a/acqui/addorder.pl +++ a/acqui/addorder.pl @@ -286,8 +286,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. @@ -301,16 +299,13 @@ 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){ + use Data::Dumper; die Dumper($itemhash{$item}); 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}); --- a/acqui/addorderiso2709.pl +++ a/acqui/addorderiso2709.pl @@ -244,15 +244,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 <=$quantity;$qtyloop++) { my ( $biblionumber, $bibitemnum, $itemnumber ) = AddItemFromMarc( $record, $biblionumber ); --- a/acqui/finishreceive.pl +++ a/acqui/finishreceive.pl @@ -123,8 +123,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; @@ -137,15 +135,12 @@ 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]; } 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); NewOrderItem($itemnumber, $new_ordernumber); --- a/cataloguing/additem.pl +++ a/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; @@ -377,10 +361,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 @@ -585,11 +566,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; --- a/serials/serials-edit.pl +++ a/serials/serials-edit.pl @@ -251,8 +251,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. @@ -277,8 +275,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 ) { @@ -298,8 +294,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; --- a/tools/batchMod.pl +++ a/tools/batchMod.pl @@ -98,9 +98,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 @@ -140,7 +137,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'); utf8::encode($xml); $marcitem = MARC::Record::new_from_xml($xml, 'UTF-8'); } @@ -595,22 +592,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 --