fix post-consolidation linking of tax on tax records, should be the last piece of...
[freeside.git] / FS / FS / cust_bill_pkg.pm
index 156ab5b..d0cec90 100644 (file)
@@ -207,6 +207,7 @@ sub insert {
   {
     my $tax_location = $self->get($tax_link_table) || [];
     foreach my $link ( @$tax_location ) {
+      $DB::single=1; #XXX
       my $pkey = $link->primary_key;
       next if $link->get($pkey); # don't try to double-insert
       # This cust_bill_pkg can be linked on either side (i.e. it can be the
@@ -238,12 +239,12 @@ sub insert {
           return "error inserting cust_bill_pkg_tax_location: $error";
         }
       } else { # handoff
-        my $other;
+        my $other; # the as yet uninserted cust_bill_pkg
         $other = $link->billpkgnum ? $link->get('taxable_cust_bill_pkg')
                                    : $link->get('tax_cust_bill_pkg');
-        my $link_array = $other->get('cust_bill_pkg_tax_location') || [];
+        my $link_array = $other->get( $tax_link_table ) || [];
         push @$link_array, $link;
-        $other->set('cust_bill_pkg_tax_location' => $link_array);
+        $other->set( $tax_link_table => $link_array);
       }
     } #foreach my $link
   }