[freeside-commits] branch master updated. 71b86f3f89e8fdeb7142fa82cdbe3e3afce7a903

Ivan ivan at 420.am
Tue May 6 06:04:32 PDT 2014


The branch, master has been updated
       via  71b86f3f89e8fdeb7142fa82cdbe3e3afce7a903 (commit)
      from  da0e47d64f0aabf03c308dd93ab0c7c88a98208b (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 71b86f3f89e8fdeb7142fa82cdbe3e3afce7a903
Author: Ivan Kohler <ivan at freeside.biz>
Date:   Tue May 6 06:04:28 2014 -0700

    optimize package list with lots of packages, RT#28526

diff --git a/FS/FS/Conf.pm b/FS/FS/Conf.pm
index 0a29b7e..4b55f65 100644
--- a/FS/FS/Conf.pm
+++ b/FS/FS/Conf.pm
@@ -3456,6 +3456,13 @@ and customer address. Include units.',
   },
 
   {
+    'key'         => 'cust_pkg-hide_discontinued-part_svc',
+    'section'     => 'UI',
+    'description' => "In customer view, hide provisioned services which are no longer available in the package definition.  Not normally used except for very specific situations as it hides still-provisioned services.",
+    'type'        => 'checkbox',
+  },
+
+  {
     'key'         => 'svc_acct-edit_uid',
     'section'     => 'shell',
     'description' => 'Allow UID editing.',
diff --git a/FS/FS/cust_pkg.pm b/FS/FS/cust_pkg.pm
index cf9e324..b1cdf45 100644
--- a/FS/FS/cust_pkg.pm
+++ b/FS/FS/cust_pkg.pm
@@ -2977,17 +2977,35 @@ following extra fields:
 
 =over 4
 
-=item num_cust_svc  (count)
+=item num_cust_svc
 
-=item num_avail     (quantity - count)
+(count)
 
-=item cust_pkg_svc (services) - array reference containing the provisioned services, as cust_svc objects
+=item num_avail
+
+(quantity - count)
+
+=item cust_pkg_svc
+
+(services) - array reference containing the provisioned services, as cust_svc objects
 
 =back
 
-Accepts one option: summarize_size.  If specified and non-zero, will omit the
-extra cust_pkg_svc option for objects where num_cust_svc is this size or
-greater.
+Accepts two options:
+
+=over 4
+
+=item summarize_size
+
+If true, will omit the extra cust_pkg_svc option for objects where num_cust_svc
+is this size or greater.
+
+=item hide_discontinued
+
+If true, will omit looking for services that are no longer avaialble in the
+package definition.
+
+=back
 
 =cut
 
@@ -3016,16 +3034,18 @@ sub part_svc {
     $part_svc;
   } $self->part_pkg->pkg_svc;
 
-  #extras
-  push @part_svc, map {
-    my $part_svc = $_;
-    my $num_cust_svc = $self->num_cust_svc($part_svc->svcpart);
-    $part_svc->{'Hash'}{'num_cust_svc'} = $num_cust_svc; #speak no evail
-    $part_svc->{'Hash'}{'num_avail'}    = 0; #0-$num_cust_svc ?
-    $part_svc->{'Hash'}{'cust_pkg_svc'} =
-      $num_cust_svc ? [ $self->cust_svc($part_svc->svcpart) ] : [];
-    $part_svc;
-  } $self->extra_part_svc;
+  unless ( $opt{hide_discontinued} ) {
+    #extras
+    push @part_svc, map {
+      my $part_svc = $_;
+      my $num_cust_svc = $self->num_cust_svc($part_svc->svcpart);
+      $part_svc->{'Hash'}{'num_cust_svc'} = $num_cust_svc; #speak no evail
+      $part_svc->{'Hash'}{'num_avail'}    = 0; #0-$num_cust_svc ?
+      $part_svc->{'Hash'}{'cust_pkg_svc'} =
+        $num_cust_svc ? [ $self->cust_svc($part_svc->svcpart) ] : [];
+      $part_svc;
+    } $self->extra_part_svc;
+  }
 
   @part_svc;
 
diff --git a/httemplate/view/cust_main/packages/section.html b/httemplate/view/cust_main/packages/section.html
index 7c82978..95b486f 100755
--- a/httemplate/view/cust_main/packages/section.html
+++ b/httemplate/view/cust_main/packages/section.html
@@ -126,6 +126,7 @@ my %conf_opt = (
   'manage_link_loc'           => scalar($conf->config('svc_broadband-manage_link_loc')),
   'manage_link-new_window'    => $conf->exists('svc_broadband-manage_link-new_window'),
   'cust_pkg-large_pkg_size'   => scalar($conf->config('cust_pkg-large_pkg_size')),
+  'cust_pkg-hide_discontinued-part_svc' => $conf->exists('cust_pkg-hide_discontinued-part_svc'),
 
 );
 
diff --git a/httemplate/view/cust_main/packages/services.html b/httemplate/view/cust_main/packages/services.html
index 7dfc004..bb676e8 100644
--- a/httemplate/view/cust_main/packages/services.html
+++ b/httemplate/view/cust_main/packages/services.html
@@ -10,13 +10,15 @@ function clearhint_search_cust_svc(obj, str) {
 }
     </SCRIPT>
 
-%  foreach my $part_svc ( $cust_pkg->part_svc(
-%                           'summarize_size' => $opt{'cust_pkg-large_pkg_size'}
-%                       ) )
-%  {
-
+%  foreach my $part_svc (
+%    $cust_pkg->part_svc(
+%      'summarize_size'    => $opt{'cust_pkg-large_pkg_size'},
+%      'hide_discontinued' => $opt{'cust_pkg-hide_discontinued-part_svc'},
+%    )
+%  ) {
+%
 %    my $num_cust_svc = $cust_pkg->num_cust_svc( $part_svc->svcpart );
-
+%
 %    if ( $opt{'cust_pkg-large_pkg_size'} > 0 and
 %         $opt{'cust_pkg-large_pkg_size'} <= $num_cust_svc ) { # summarize
 %
@@ -116,8 +118,6 @@ my $cust_pkg = $opt{'cust_pkg'};
 my $part_pkg = $opt{'part_pkg'};
 my $curuser  = $FS::CurrentUser::CurrentUser;
 
-my $conf = new FS::Conf;
-
 sub svc_provision_link {
   my ($cust_pkg, $part_svc, $opt, $curuser) = @_;
 

-----------------------------------------------------------------------

Summary of changes:
 FS/FS/Conf.pm                                    |    7 +++
 FS/FS/cust_pkg.pm                                |   52 +++++++++++++++-------
 httemplate/view/cust_main/packages/section.html  |    1 +
 httemplate/view/cust_main/packages/services.html |   16 +++---
 4 files changed, 52 insertions(+), 24 deletions(-)




More information about the freeside-commits mailing list