fix on-demand credit cards not being masked in UI. i believe huntsburg is in the...
[freeside.git] / FS / FS / part_svc.pm
index e94c803..0ece185 100644 (file)
@@ -3,6 +3,7 @@ package FS::part_svc;
 use strict;
 use vars qw( @ISA $DEBUG );
 use FS::Record qw( qsearch qsearchs fields dbh );
+use FS::Schema qw( dbdef );
 use FS::part_svc_column;
 use FS::part_export;
 use FS::export_svc;
@@ -392,8 +393,8 @@ sub all_part_svc_column {
 
 =item part_export [ EXPORTTYPE ]
 
-Returns all exports (see L<FS::part_export>) for this service, or, if an
-export type is specified, only returns exports of the given type.
+Returns a list of all exports (see L<FS::part_export>) for this service, or,
+if an export type is specified, only returns exports of the given type.
 
 =cut
 
@@ -405,6 +406,18 @@ sub part_export {
     qsearch('export_svc', { 'svcpart' => $self->svcpart } );
 }
 
+=item part_export_usage
+
+Returns a list of any exports (see L<FS::part_export>) for this service that
+are capable of reporting usage information.
+
+=cut
+
+sub part_export_usage {
+  my $self = shift;
+  grep $_->can('usage_sessions'), $self->part_export;
+}
+
 =item cust_svc
 
 Returns a list of associated FS::cust_svc records.
@@ -465,7 +478,7 @@ sub process {
               my @fields = fields($svcdb);
               push @fields, 'usergroup' if $svcdb eq 'svc_acct'; #kludge
               map { ( $svcdb.'__'.$_, $svcdb.'__'.$_.'_flag' )  } @fields;
-            } grep defined( $FS::Record::dbdef->table($_) ),
+            } grep defined( dbdef->table($_) ),
                    qw( svc_acct svc_domain svc_forward svc_www svc_broadband )
       )
   } );