summaryrefslogtreecommitdiff
path: root/FS/FS
diff options
context:
space:
mode:
authorIvan Kohler <ivan@freeside.biz>2014-01-08 17:53:05 -0800
committerIvan Kohler <ivan@freeside.biz>2014-01-08 17:53:05 -0800
commit26746825705e313c9aa265e406192787a34ce260 (patch)
tree38787d492d4c39a4d770b69888ba677c956f38e2 /FS/FS
parente8fb929a2d140165669fe4cc54dfc70fb99962e3 (diff)
time/data/etc. unit pricing add-ons, RT#24392
Diffstat (limited to 'FS/FS')
-rw-r--r--FS/FS/cust_pkg.pm17
1 files changed, 17 insertions, 0 deletions
diff --git a/FS/FS/cust_pkg.pm b/FS/FS/cust_pkg.pm
index a2173d9..f530947 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) {