[freeside-commits] branch master updated. 2801b7c172cddcab51101d933e57a956d450ace2
Mark Wells
mark at 420.am
Mon Aug 22 14:21:37 PDT 2016
The branch, master has been updated
via 2801b7c172cddcab51101d933e57a956d450ace2 (commit)
from c541cb0f1ab12a904252bd6b2658dba585860f28 (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 2801b7c172cddcab51101d933e57a956d450ace2
Author: Mark Wells <mark at freeside.biz>
Date: Mon Aug 22 13:41:13 2016 -0700
show data usage report link only for customers that might have data usage, #42310
diff --git a/FS/FS/cust_main/Packages.pm b/FS/FS/cust_main/Packages.pm
index ee5bdda..e913402 100644
--- a/FS/FS/cust_main/Packages.pm
+++ b/FS/FS/cust_main/Packages.pm
@@ -748,6 +748,28 @@ sub num_pkgs {
$sth->fetchrow_arrayref->[0];
}
+=item num_usage_pkgs
+
+Returns the number of packages for this customer that have services that
+can have RADIUS usage statistics.
+
+=cut
+
+sub num_usage_pkgs {
+ my $self = shift;
+ # have to enumerate exportnums but it's not bad
+ my @exportnums = map { $_->exportnum }
+ grep { $_->can('usage_sessions') }
+ qsearch('part_export');
+ return 0 if !@exportnums;
+ my $in_exportnums = join(',', @exportnums);
+ my $sql = "SELECT COUNT(DISTINCT pkgnum) FROM cust_pkg
+ JOIN cust_svc USING (pkgnum)
+ JOIN export_svc USING (svcpart)
+ WHERE exportnum IN( $in_exportnums ) AND custnum = ?";
+ FS::Record->scalar_sql($sql, $self->custnum);
+}
+
=item display_recurring
Returns an array of hash references, one for each recurring freq
diff --git a/httemplate/view/cust_main/menu.html b/httemplate/view/cust_main/menu.html
index 7c7303b..695336c 100644
--- a/httemplate/view/cust_main/menu.html
+++ b/httemplate/view/cust_main/menu.html
@@ -397,6 +397,7 @@ my @menu = (
actionlabel => 'Data usage report',
width => 480,
height => 245,
+ condition => sub { shift->num_usage_pkgs > 0 },
},
{
label => 'View CDRs',
-----------------------------------------------------------------------
Summary of changes:
FS/FS/cust_main/Packages.pm | 22 ++++++++++++++++++++++
httemplate/view/cust_main/menu.html | 1 +
2 files changed, 23 insertions(+)
More information about the freeside-commits
mailing list