[freeside-commits] branch FREESIDE_3_BRANCH updated. 6dff12f555fe81ed44b517eb48e1d708636709f6

Ivan ivan at 420.am
Wed Mar 19 19:28:51 PDT 2014


The branch, FREESIDE_3_BRANCH has been updated
       via  6dff12f555fe81ed44b517eb48e1d708636709f6 (commit)
      from  c9bc9298c5b02010221d837624154d65bd0d5a85 (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 6dff12f555fe81ed44b517eb48e1d708636709f6
Author: Ivan Kohler <ivan at freeside.biz>
Date:   Wed Mar 19 19:28:50 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 1dcd601..ce61786 100644
--- a/FS/FS/cust_svc.pm
+++ b/FS/FS/cust_svc.pm
@@ -371,8 +371,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 );
 
@@ -381,6 +398,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