From: Ivan Kohler Date: Wed, 1 Feb 2017 02:05:11 +0000 (-0800) Subject: Merge branch 'master' of git.freeside.biz:/home/git/freeside X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=commitdiff_plain;h=faa774764df03c6f3280177f6adfcd2214995a13;hp=a6c5bd2d56ad177a8f79ac0aa5c88b389513dc82 Merge branch 'master' of git.freeside.biz:/home/git/freeside --- diff --git a/FS/FS/Template_Mixin.pm b/FS/FS/Template_Mixin.pm index d7add719f..5e85f8ec8 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 diff --git a/FS/FS/part_event/Condition/has_pkgpart.pm b/FS/FS/part_event/Condition/has_pkgpart.pm index 5505a99c5..deeb1b7e2 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; diff --git a/FS/FS/part_event/Condition/pkg_pkgpart.pm b/FS/FS/part_event/Condition/pkg_pkgpart.pm index 6adef8eb6..d5b5c8daa 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;