[freeside-commits] branch master updated. a8e98b0506e1fb15bc2ca721f6c3c6a8e431bd24
Ivan
ivan at 420.am
Wed Mar 19 19:28:50 PDT 2014
The branch, master has been updated
via a8e98b0506e1fb15bc2ca721f6c3c6a8e431bd24 (commit)
from 71fa02dc2a93a81c522b82a62833840614359b8e (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit a8e98b0506e1fb15bc2ca721f6c3c6a8e431bd24
Author: Ivan Kohler <ivan at freeside.biz>
Date: Wed Mar 19 19:28:49 2014 -0700
fix service add-ons RT#27974 / RT#28151, fallout from perf optimization #26097
diff --git a/FS/FS/cust_svc.pm b/FS/FS/cust_svc.pm
index be5a9eb..b01ed84 100644
--- a/FS/FS/cust_svc.pm
+++ b/FS/FS/cust_svc.pm
@@ -370,8 +370,25 @@ sub check {
my $cust_pkg = $self->cust_pkg;
my $pkg_svc = $self->pkg_svc
- or return "No svcpart ". $self->svcpart.
- " services in pkgpart ". $cust_pkg->pkgpart;
+ || new FS::pkg_svc { 'svcpart' => $self->svcpart,
+ 'pkgpart' => $cust_pkg->pkgpart,
+ 'quantity' => 0,
+ };
+
+ #service add-ons, kinda false laziness/reimplementation of part_pkg->pkg_svc
+ foreach my $part_pkg_link ( $cust_pkg->part_pkg->svc_part_pkg_link ) {
+ my $addon_pkg_svc = qsearchs('pkg_svc', {
+ pkgpart => $part_pkg_link->dst_pkgpart,
+ svcpart => $self->svcpart,
+ });
+ $pkg_svc->quantity( $pkg_svc->quantity + $addon_pkg_svc->quantity )
+ if $addon_pkg_svc;
+ }
+
+ #better error message? UI shouldn't get here
+ return "No svcpart ". $self->svcpart.
+ " services in pkgpart ". $cust_pkg->pkgpart
+ unless $pkg_svc->quantity > 0;
my $num_cust_svc = $cust_pkg->num_cust_svc( $self->svcpart );
@@ -380,6 +397,7 @@ sub check {
- $num_cust_svc
);
+ #better error message? again, UI shouldn't get here
return "Already $num_cust_svc ". $pkg_svc->part_svc->svc.
" services for pkgnum ". $self->pkgnum
if $num_avail <= 0;
-----------------------------------------------------------------------
Summary of changes:
FS/FS/cust_svc.pm | 22 ++++++++++++++++++++--
1 files changed, 20 insertions(+), 2 deletions(-)
More information about the freeside-commits
mailing list