Bug 11247: Fix calls of TransformHtmlToXml
authorSrdjan <srdjan@catalyst.net.nz>
Thu, 14 Nov 2013 06:10:30 +0000 (19:10 +1300)
committerMason James <mtj@kohaaloha.com>
Mon, 28 Sep 2015 12:06:28 +0000 (01:06 +1300)
The ind_tag of TransformHtmlToXml is unused.
Some calls to this function incorrectly revert indicator and ind_tag (which
is not a problem when both are empty..)

Patch of Srdjan Jankovic, amended and signed off by Marcel de Rooy.

The following calls are fixed:
call in acqui/addorder.pl: switched indicator with ind_tag
call in acqui/addorderiso2709.pl replaced too
acqui/finishreceive.pl replaced too

These calls are fine:
two calls in cataloguing/additem.pl are fine
call in serials/serials-edit.pl is fine
call in tools/batchMod.pl is fine

The folllow-up patch adds a simple unit test.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
With AcqCreateItem=='placing an order', tested if adding an order still
worked (covered both addorder.pl and addorderiso2709.pl).

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit 22b41063981de608402d1dd87f6aa9e2010245dd)
Signed-off-by: Liz Rea <wizzyrea@gmail.com>

C4/Biblio.pm
acqui/addorder.pl
acqui/addorderiso2709.pl
acqui/finishreceive.pl

index 57444cd..29104db 100644 (file)
@@ -2316,6 +2316,8 @@ $auth_type contains :
 
 sub TransformHtmlToXml {
     my ( $tags, $subfields, $values, $indicator, $ind_tag, $auth_type ) = @_;
+    # NOTE: The parameter $ind_tag is NOT USED -- BZ 11247
+
     my $xml = MARC::File::XML::header('UTF-8');
     $xml .= "<record>\n";
     $auth_type = C4::Context->preference('marcflavour') unless $auth_type;
index 1b05f07..d4df903 100755 (executable)
@@ -309,8 +309,8 @@ if ( $orderinfo->{quantity} ne '0' ) {
             my $xml = TransformHtmlToXml( $itemhash{$item}->{'tags'},
                                     $itemhash{$item}->{'subfields'},
                                     $itemhash{$item}->{'field_values'},
-                                    $itemhash{$item}->{'ind_tag'},
                                     $itemhash{$item}->{'indicator'},
+                                    $itemhash{$item}->{'ind_tag'},
                                     'ITEM');
             my $record=MARC::Record::new_from_xml($xml, 'UTF-8');
             my ($biblionumber,$bibitemnum,$itemnumber) = AddItemFromMarc($record,$$orderinfo{biblionumber});
index 91c0a4c..47a2679 100755 (executable)
@@ -274,7 +274,7 @@ if ($op eq ""){
             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, \@indicator, \@ind_tag );
             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 );
index 1723520..557e78d 100755 (executable)
@@ -145,8 +145,9 @@ if ($quantityrec > $origquantityrec ) {
             my $xml = TransformHtmlToXml( $itemhash{$item}->{'tags'},
                                           $itemhash{$item}->{'subfields'},
                                           $itemhash{$item}->{'field_values'},
+                                          $itemhash{$item}->{'indicator'},
                                           $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);