-
- foreach (@svcs) {
- $by_pkg_label{ $_->{pkg_label} } ||= [];
- push @{ $by_pkg_label{ $_->{pkg_label} } }, $_;
- if ( $_->{svcdb} eq 'svc_acct' ) {
- push @svc_acct, $_;
- } elsif ( $_->{svcdb} eq 'svc_phone' ) {
- push @svc_phone, $_;
- } elsif ( $_->{svcdb} eq 'svc_port' ) {
- push @svc_port, $_;
- } elsif ( $_->{svcdb} eq 'svc_pbx' ) {
- push @svc_pbx, $_;
+ @bytes_svcs = (); # contains svc_acct and svc_broadband
+ @bytes_cols = qw(seconds_used seconds upbytes_used upbytes downbytes_used downbytes totalbytes_used totalbytes);
+ %bytes_show = map { $_ => 0 } @bytes_cols;
+
+ foreach my $svc (@svcs) {
+ $by_pkg_label{ $svc->{pkg_label} } ||= [];
+ push @{ $by_pkg_label{ $svc->{pkg_label} } }, $svc;
+
+ if (( $svc->{svcdb} eq 'svc_acct' ) || ( $svc->{svcdb} eq 'svc_broadband' )) {
+ foreach my $field (@bytes_cols) {
+ $bytes_show{$field} = 1 if length($svc->{$field}) or (($field !~ /_used$/) && $svc->{'recharge_'.$field});
+ }
+ push @bytes_svcs, $svc;
+ } elsif ( $svc->{svcdb} eq 'svc_phone' ) {
+ push @svc_phone, $svc;
+ } elsif ( $svc->{svcdb} eq 'svc_port' ) {
+ push @svc_port, $svc;
+ } elsif ( $svc->{svcdb} eq 'svc_pbx' ) {
+ push @svc_pbx, $svc;