radacct update: use sqlradius for datasrc, not plandata options (whew)
[freeside.git] / FS / FS / part_svc.pm
index 7ef996f..06c15ed 100644 (file)
@@ -5,6 +5,7 @@ use vars qw( @ISA );
 use FS::Record qw( qsearch qsearchs fields dbh );
 use FS::part_svc_column;
 use FS::part_export;
+use FS::export_svc;
 
 @ISA = qw(FS::Record);
 
@@ -253,31 +254,6 @@ sub check {
   my @fields = eval { fields( $recref->{svcdb} ) }; #might die
   return "Unknown svcdb!" unless @fields;
 
-##REPLACED BY part_svc_column
-#  my $svcdb;
-#  foreach $svcdb ( qw(
-#    svc_acct svc_acct_sm svc_domain
-#  ) ) {
-#    my @rows = map { /^${svcdb}__(.*)$/; $1 }
-#      grep ! /_flag$/,
-#        grep /^${svcdb}__/,
-#          fields('part_svc');
-#    foreach my $row (@rows) {
-#      unless ( $svcdb eq $recref->{svcdb} ) {
-#        $recref->{$svcdb.'__'.$row}='';
-#        $recref->{$svcdb.'__'.$row.'_flag'}='';
-#        next;
-#      }
-#      $recref->{$svcdb.'__'.$row.'_flag'} =~ /^([DF]?)$/
-#        or return "Illegal flag for $svcdb $row";
-#      $recref->{$svcdb.'__'.$row.'_flag'} = $1;
-#
-#      my $error = $self->ut_anything($svcdb.'__'.$row);
-#      return $error if $error;
-#
-#    }
-#  }
-
   ''; #no error
 }
 
@@ -310,22 +286,23 @@ sub all_part_svc_column {
   qsearch('part_svc_column', { 'svcpart' => $self->svcpart } );
 }
 
-=item part_export
+=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.
 
 =cut
 
 sub part_export {
   my $self = shift;
-  my %search = ( 'svcpart' => $self->svcpart );
-  qsearch('part_export', \%search);
+  my %search;
+  $search{'exporttype'} = shift if @_;
+  map { qsearchs('part_export', { 'exportnum' => $_->exportnum, %search } ) }
+    qsearch('export_svc', { 'svcpart' => $self->svcpart } );
 }
 
 =back
 
-=head1 VERSION
-
-$Id: part_svc.pm,v 1.12 2002-03-26 13:58:29 ivan Exp $
-
 =head1 BUGS
 
 Delete is unimplemented.
@@ -333,6 +310,8 @@ Delete is unimplemented.
 The list of svc_* tables is hardcoded.  When svc_acct_pop is renamed, this
 should be fixed.
 
+all_part_svc_column method should be documented
+
 =head1 SEE ALSO
 
 L<FS::Record>, L<FS::part_svc_column>, L<FS::part_pkg>, L<FS::pkg_svc>,