summaryrefslogtreecommitdiff
path: root/httemplate
diff options
context:
space:
mode:
authorIvan Kohler <ivan@freeside.biz>2016-11-01 16:20:44 -0700
committerIvan Kohler <ivan@freeside.biz>2016-11-01 16:20:44 -0700
commitf2b43a877c70aa367595fe2fc4fcffd82f62d001 (patch)
tree83c4be349cd80ec6fefa9684b390c8989d550598 /httemplate
parentbd29d65b7ec7b2637656fbc66ae0f57fa02dcbce (diff)
parent6a4b5b3bf9b3e589cf8ff18453e9c6be6a50091a (diff)
Merge branch 'master' of git.freeside.biz:/home/git/freeside
Diffstat (limited to 'httemplate')
-rwxr-xr-xhttemplate/browse/cust_main_county.cgi20
-rw-r--r--httemplate/misc/process/payment.cgi2
-rw-r--r--httemplate/search/sqlradius_usage.html37
3 files changed, 37 insertions, 22 deletions
diff --git a/httemplate/browse/cust_main_county.cgi b/httemplate/browse/cust_main_county.cgi
index 522614886..26a3e21b9 100755
--- a/httemplate/browse/cust_main_county.cgi
+++ b/httemplate/browse/cust_main_county.cgi
@@ -467,13 +467,13 @@ my @fields = (
? '&nbsp;'. add_link(
desc => 'Add more counties',
col => 'state',
- label=> 'add&nbsp;more&nbsp;counties',
+ label=> 'add more counties',
row => $_[0],
cgi => $cgi,
).
' '. collapse_link(
col => 'state',
- label=> 'remove&nbsp;all&nbsp;counties',
+ label=> 'remove all counties',
row => $_[0],
cgi => $cgi,
)
@@ -484,7 +484,7 @@ my @fields = (
? ''
: '&nbsp;'. expand_link( desc => 'Add States',
row => $_[0],
- label => 'add&nbsp;states',
+ label => 'add states',
cgi => $cgi,
)
);
@@ -503,18 +503,18 @@ my @fields = (
? '&nbsp;'. add_link(
desc => 'Add more cities',
col => 'county',
- label=> 'add&nbsp;more&nbsp;cities',
+ label=> 'add more cities',
row => $_[0],
cgi => $cgi,
).
' '. collapse_link(
col => 'county',
- label=> 'remove&nbsp;all&nbsp;cities',
+ label=> 'remove all cities',
row => $_[0],
cgi => $cgi,
)
: '&nbsp;'. remove_link( col => 'county',
- label=> 'remove&nbsp;county',
+ label=> 'remove county',
row => $_[0],
cgi => $cgi,
);
@@ -525,7 +525,7 @@ my @fields = (
: '(all)&nbsp;'.
expand_link( desc => 'Add Counties',
row => $_[0],
- label => 'add&nbsp;counties',
+ label => 'add counties',
cgi => $cgi,
);
},
@@ -541,7 +541,7 @@ my @fields = (
} else {
$r->city. '&nbsp;'.
remove_link( col => 'city',
- label=> 'remove&nbsp;city',
+ label=> 'remove city',
row => $r,
cgi => $cgi,
);
@@ -550,7 +550,7 @@ my @fields = (
'(all)&nbsp;'.
expand_link( desc => 'Add Cities',
row => $r,
- label => 'add&nbsp;cities',
+ label => 'add cities',
cgi => $cgi,
);
}
@@ -562,7 +562,7 @@ my @fields = (
if ( $r->district ) {
$r->district . '&nbsp;'.
remove_link( col => 'district',
- label=> 'remove&nbsp;district',
+ label=> 'remove district',
row => $r,
cgi => $cgi,
);
diff --git a/httemplate/misc/process/payment.cgi b/httemplate/misc/process/payment.cgi
index 74ca7348f..84687f019 100644
--- a/httemplate/misc/process/payment.cgi
+++ b/httemplate/misc/process/payment.cgi
@@ -135,7 +135,7 @@ if ( (my $custpaybynum = scalar($cgi->param('custpaybynum'))) > 0 ) {
validate($payinfo)
or errorpage(gettext('invalid_card'));
- unless ( $payinfo =~ /^99\d{14}$/ ) { #token
+ unless ( $cust_main->tokenized($payinfo) ) { #token
my $cardtype = cardtype($payinfo);
diff --git a/httemplate/search/sqlradius_usage.html b/httemplate/search/sqlradius_usage.html
index 846b50c2c..b810a8bf6 100644
--- a/httemplate/search/sqlradius_usage.html
+++ b/httemplate/search/sqlradius_usage.html
@@ -5,8 +5,8 @@
% $cgi->param('agentnum', $agent->agentnum); #for download links
<DIV WIDTH="100%" STYLE="page-break-after: always">
<FONT SIZE=6><% $agent->agent %></FONT><BR><BR>
- <& cust_pkg_sqlradius_usage.html,
- exports => @exports,
+ <& sqlradius_usage.html,
+ exports => \@exports,
agentnum => $agent->agentnum,
nohtmlheader => 1,
download_label => 'Download this section',
@@ -154,6 +154,17 @@ my %usage_param = (
my @total_usage = ('', 0, 0, 0); # username, input, output, input + output
+# remember which exports apply to which services, so we don't inappropriately
+# ask the wrong ones for usage stats
+my %export_svcparts;
+foreach my $export (@exports) {
+ my %seen;
+ foreach ($export->export_svc) {
+ $seen{ $_->svcpart } = 1;
+ }
+ $export_svcparts{ $export->exportnum } = \%seen;
+}
+
# a single sub to collect data for each package, aggregated across both
# services and exports. when we add per-service breakdown, this should also
# keep the per-service data, but not needed yet
@@ -163,16 +174,20 @@ my $cust_pkg_stats_sub = sub {
my ($upbytes, $downbytes, $totalbytes) = (0, 0, 0);
my $display_username;
foreach my $svcnum ( split(',', $cust_pkg->get('svcnums_concat')) ) {
+ my $cust_svc = FS::cust_svc->by_key($svcnum);
+ my $svc = $cust_svc->svc_x;
foreach my $export (@exports) {
- my $svc = FS::cust_svc->by_key($svcnum)->svc_x;
- my $username = $export->export_username($svc);
- my $usage = $export->usage_sessions({ %usage_param, 'svc' => $svc });
- # returns arrayref with one row
- $upbytes += $usage->[0]->{'acctinputoctets'};
- $downbytes += $usage->[0]->{'acctoutputoctets'};
- # in combined services mode with multiple users/MAC addresses per
- # package, this will just show one of them arbitrarily.
- $display_username ||= $username;
+ if ( $export_svcparts{ $export->exportnum }{ $cust_svc->svcpart } ) {
+ my $username = $export->export_username($svc);
+ my $usage = $export->usage_sessions({ %usage_param, 'svc' => $svc });
+ # returns arrayref with one row
+ $upbytes += $usage->[0]->{'acctinputoctets'};
+ $downbytes += $usage->[0]->{'acctoutputoctets'};
+ # in combined services mode with multiple users/MAC addresses per
+ # package, this will just show one of them arbitrarily.
+ $display_username ||= $username;
+ }
+ # else this export doesn't apply so skip it
}
}
$total_usage[1] += $upbytes;