From: Ivan Kohler Date: Thu, 9 Jan 2014 01:53:05 +0000 (-0800) Subject: time/data/etc. unit pricing add-ons, RT#24392 X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=commitdiff_plain;h=26746825705e313c9aa265e406192787a34ce260 time/data/etc. unit pricing add-ons, RT#24392 --- diff --git a/FS/FS/cust_pkg.pm b/FS/FS/cust_pkg.pm index a2173d921..f53094714 100644 --- a/FS/FS/cust_pkg.pm +++ b/FS/FS/cust_pkg.pm @@ -30,6 +30,7 @@ use FS::reg_code; use FS::part_svc; use FS::cust_pkg_reason; use FS::reason; +use FS::cust_pkg_usageprice; use FS::cust_pkg_discount; use FS::discount; use FS::UI::Web; @@ -1973,6 +1974,22 @@ sub change { } } + # transfer usage pricing add-ons, if we're not changing pkgpart + if ( $same_pkgpart ) { + foreach my $old_cust_pkg_usageprice ($self->cust_pkg_usageprice) { + my $new_cust_pkg_usageprice = new FS::cust_pkg_usageprice { + 'pkgnum' => $cust_pkg->pkgnum, + 'usagepricepart' => $old_cust_pkg_usageprice->usagepricepart, + 'quantity' => $old_cust_pkg_usageprice->quantity, + }; + $error = $new_cust_pkg_usageprice->insert; + if ( $error ) { + $dbh->rollback if $oldAutoCommit; + return "Error transferring usage pricing add-on: $error"; + } + } + } + # transfer discounts, if we're not changing pkgpart if ( $same_pkgpart ) { foreach my $old_discount ($self->cust_pkg_discount_active) {