From 4ec2818fa42bf6b3ed00f6888c744456855ec0f1 Mon Sep 17 00:00:00 2001 From: Jonathan Prykop Date: Mon, 18 Jul 2016 19:29:59 -0500 Subject: RT#38973: Bill for time worked on ticket resolution [fully functional] --- FS/FS/cust_pkg.pm | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'FS/FS/cust_pkg.pm') diff --git a/FS/FS/cust_pkg.pm b/FS/FS/cust_pkg.pm index de88cc0..1ee8552 100644 --- a/FS/FS/cust_pkg.pm +++ b/FS/FS/cust_pkg.pm @@ -533,6 +533,7 @@ sub delete { # cust_bill_pay.pkgnum (wtf, shouldn't reference pkgnum) # cust_pkg_usage.pkgnum # cust_pkg.uncancel_pkgnum, change_pkgnum, main_pkgnum, and change_to_pkgnum + # rt_field_charge.pkgnum # cust_svc is handled by canceling the package before deleting it # cust_pkg_option is handled via option_Common @@ -2631,6 +2632,19 @@ sub change { return "canceling old package: $error"; } + # transfer rt_field_charge, if we're not changing pkgpart + # after billing of old package, before billing of new package + if ( $same_pkgpart ) { + foreach my $rt_field_charge ($self->rt_field_charge) { + $rt_field_charge->set('pkgnum', $cust_pkg->pkgnum); + $error = $rt_field_charge->replace; + if ( $error ) { + $dbh->rollback if $oldAutoCommit; + return "transferring rt_field_charge: $error"; + } + } + } + if ( $conf->exists('cust_pkg-change_pkgpart-bill_now') ) { #$self->cust_main my $error = $cust_pkg->cust_main->bill( -- cgit v1.1