[freeside-commits] branch master updated. faa774764df03c6f3280177f6adfcd2214995a13

Ivan ivan at 420.am
Tue Jan 31 18:05:15 PST 2017


The branch, master has been updated
       via  faa774764df03c6f3280177f6adfcd2214995a13 (commit)
       via  219264fd9a80e8819ce275ac3bd71a685af95e27 (commit)
       via  f4daf7e8c831fe126dc3fd1d6d0db5ee3b46d602 (commit)
       via  67ce801775e44289e9868593d58bfa78aed2ae45 (commit)
      from  a6c5bd2d56ad177a8f79ac0aa5c88b389513dc82 (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 faa774764df03c6f3280177f6adfcd2214995a13
Merge: 219264f a6c5bd2
Author: Ivan Kohler <ivan at freeside.biz>
Date:   Tue Jan 31 18:05:11 2017 -0800

    Merge branch 'master' of git.freeside.biz:/home/git/freeside


commit 219264fd9a80e8819ce275ac3bd71a685af95e27
Author: Ivan Kohler <ivan at freeside.biz>
Date:   Tue Jan 31 18:05:02 2017 -0800

    add condition_sql optimization to "Customer has uncancelled specific package(s)" condition, RT#74456

diff --git a/FS/FS/part_event/Condition/has_pkgpart.pm b/FS/FS/part_event/Condition/has_pkgpart.pm
index 5505a99..deeb1b7 100644
--- a/FS/FS/part_event/Condition/has_pkgpart.pm
+++ b/FS/FS/part_event/Condition/has_pkgpart.pm
@@ -27,13 +27,23 @@ sub condition {
   my $cust_main = $self->cust_main($object);
 
   my $if_pkgpart = $self->option('if_pkgpart') || {};
-  grep $if_pkgpart->{ $_->pkgpart }, $cust_main->ncancelled_pkgs;
+  grep $if_pkgpart->{ $_->pkgpart },
+         $cust_main->ncancelled_pkgs( 'skip_label_sort'=>1 );
 
 }
 
-#XXX 
-#sub condition_sql {
-#
-#}
+sub condition_sql {
+  my( $self, $table ) = @_;
+
+  'ARRAY'. $self->condition_sql_option_option_integer('if_pkgpart').
+  ' && '. #overlap (have elements in common)
+  'ARRAY( SELECT pkgpart FROM cust_pkg AS has_pkgpart_cust_pkg
+            WHERE has_pkgpart_cust_pkg.custnum = cust_main.custnum
+              AND (    has_pkgpart_cust_pkg.cancel IS NULL
+                    OR has_pkgpart_cust_pkg.cancel = 0
+                  )
+        )
+  ';
+}
 
 1;

commit f4daf7e8c831fe126dc3fd1d6d0db5ee3b46d602
Author: Ivan Kohler <ivan at freeside.biz>
Date:   Tue Jan 31 17:29:10 2017 -0800

    add condition_sql optimization to "Package definitions" condition, RT#74456

diff --git a/FS/FS/part_event/Condition/pkg_pkgpart.pm b/FS/FS/part_event/Condition/pkg_pkgpart.pm
index 6adef8e..d5b5c8d 100644
--- a/FS/FS/part_event/Condition/pkg_pkgpart.pm
+++ b/FS/FS/part_event/Condition/pkg_pkgpart.pm
@@ -25,15 +25,16 @@ sub option_fields {
 sub condition {
   my( $self, $cust_pkg) = @_;
 
-  #XXX test
   my $if_pkgpart = $self->option('if_pkgpart') || {};
   $if_pkgpart->{ $cust_pkg->pkgpart };
 
 }
 
-#XXX 
-#sub condition_sql {
-#
-#}
+sub condition_sql {
+  my( $self, $table ) = @_;
+  
+  'cust_pkg.pkgpart IN '.
+    $self->condition_sql_option_option_integer('if_pkgpart');
+}
 
 1;

commit 67ce801775e44289e9868593d58bfa78aed2ae45
Author: Ivan Kohler <ivan at freeside.biz>
Date:   Tue Jan 31 05:50:52 2017 -0800

    fix perf issues displaying bulk invoices w/100k+ services, RT#74103

diff --git a/FS/FS/Template_Mixin.pm b/FS/FS/Template_Mixin.pm
index d7add71..5e85f8e 100644
--- a/FS/FS/Template_Mixin.pm
+++ b/FS/FS/Template_Mixin.pm
@@ -3338,19 +3338,24 @@ sub _items_cust_bill_pkg {
             && ! $cust_bill_pkg->recur_show_zero;
 
           my @d = ();
-          my $svc_label;
-
-          # always pass the svc_label through to the template, even if 
-          # not displaying it as an ext_description
-          my @svc_labels = map &{$escape_function}($_),
-            $cust_pkg->h_labels_short($self->_date,
-                                      undef,
-                                      'I',
-                                      $self->conf->{locale},
-                                     );
-          $svc_label = $svc_labels[0];
-
-          unless ( $cust_pkg->part_pkg->hide_svc_detail
+          my @svc_labels = ();
+          my $svc_label = '';
+
+          unless ( $part_pkg->hide_svc_detail ) {
+
+            # still pass the svc_label through to the template, even if 
+            # not displaying it as an ext_description
+            @svc_labels = map &{$escape_function}($_),
+              $cust_pkg->h_labels_short($self->_date,
+                                        undef,
+                                        'I',
+                                        $self->conf->{locale},
+                                       );
+            $svc_label = $svc_labels[0];
+
+          }
+
+          unless ( $part_pkg->hide_svc_detail
                 || $cust_bill_pkg->hidden )
           {
 
@@ -3427,6 +3432,7 @@ sub _items_cust_bill_pkg {
 
           my @d = ();
           my @seconds = (); # for display of usage info
+          my @svc_labels = ();
           my $svc_label = '';
 
           #at least until cust_bill_pkg has "past" ranges in addition to
@@ -3436,11 +3442,13 @@ sub _items_cust_bill_pkg {
           push @dates, $prev->sdate if $prev;
           push @dates, undef if !$prev;
 
-          my @svc_labels = map &{$escape_function}($_),
-            $cust_pkg->h_labels_short(@dates,
-                                      'I',
-                                      $self->conf->{locale});
-          $svc_label = $svc_labels[0];
+          unless ( $part_pkg->hide_svc_detail ) {
+            @svc_labels = map &{$escape_function}($_),
+              $cust_pkg->h_labels_short(@dates,
+                                        'I',
+                                        $self->conf->{locale});
+            $svc_label = $svc_labels[0];
+          }
 
           # show service labels, unless...
                     # the package is set not to display them

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

Summary of changes:
 FS/FS/Template_Mixin.pm                   |   44 +++++++++++++++++------------
 FS/FS/part_event/Condition/has_pkgpart.pm |   20 +++++++++----
 FS/FS/part_event/Condition/pkg_pkgpart.pm |   11 ++++----
 3 files changed, 47 insertions(+), 28 deletions(-)




More information about the freeside-commits mailing list