X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=FS%2FFS%2Fcust_bill_pkg.pm;h=77dce24764eb8b0e8564b51fc0ca2d78128f43f6;hb=de549dfea65bf78508b508f03e4f9637122166a6;hp=a1762e47113fd6613235cf0750e68cae67a6c78d;hpb=8f37f0b3f6a946839132120984ec62b6f7ad7594;p=freeside.git diff --git a/FS/FS/cust_bill_pkg.pm b/FS/FS/cust_bill_pkg.pm index a1762e471..77dce2476 100644 --- a/FS/FS/cust_bill_pkg.pm +++ b/FS/FS/cust_bill_pkg.pm @@ -324,7 +324,7 @@ sub insert { } -=item void [ REASON ] +=item void [ REASON [ , REPROCESS_CDRS ] ] Voids this line item: deletes the line item and adds a record of the voided line item to the FS::cust_bill_pkg_void table (and related tables). @@ -334,6 +334,7 @@ line item to the FS::cust_bill_pkg_void table (and related tables). sub void { my $self = shift; my $reason = scalar(@_) ? shift : ''; + my $reprocess_cdrs = scalar(@_) ? shift : ''; unless (ref($reason) || !$reason) { $reason = FS::reason->new_or_existing( @@ -373,6 +374,9 @@ sub void { cust_tax_exempt_pkg cust_bill_pkg_fee )) { + my %delete_args = (); + $delete_args{'reprocess_cdrs'} = $reprocess_cdrs + if $table eq 'cust_bill_pkg_detail'; foreach my $linked ( qsearch($table, { billpkgnum=>$self->billpkgnum }) ) { @@ -380,7 +384,7 @@ sub void { my $void = $vclass->new( { map { $_ => $linked->get($_) } $linked->fields }); - my $error = $void->insert || $linked->delete; + my $error = $void->insert || $linked->delete(%delete_args); if ( $error ) { $dbh->rollback if $oldAutoCommit; return $error; @@ -863,7 +867,7 @@ sub _item_discount { # show introductory rate as a pseudo-discount if (!$d) { # this will conflict with showing real discounts my $part_pkg = $self->part_pkg; - if ( $part_pkg and $part_pkg->option('show_as_discount') ) { + if ( $part_pkg and $part_pkg->option('show_as_discount',1) ) { my $cust_pkg = $self->cust_pkg; my $intro_end = $part_pkg->intro_end($cust_pkg); my $_date = $self->cust_bill->_date; @@ -1189,9 +1193,12 @@ sub tax_location { if ( $self->pkgnum ) { # normal sales return $self->cust_pkg->tax_location; } elsif ( $self->feepart ) { # fees - my $custnum = $self->fee_origin->custnum; - if ( $custnum ) { - return FS::cust_main->by_key($custnum)->ship_location; + my $fee_origin = $self->fee_origin; + if ( $fee_origin ) { + my $custnum = $fee_origin->custnum; + if ( $custnum ) { + return FS::cust_main->by_key($custnum)->ship_location; + } } } else { # taxes return;