eWay self-signup fixes
[freeside.git] / FS / FS / router.pm
index 3f9459a..7a9fda3 100755 (executable)
@@ -5,7 +5,7 @@ use vars qw( @ISA );
 use FS::Record qw( qsearchs qsearch );
 use FS::addr_block;
 
-@ISA = qw( FS::Record );
+@ISA = qw( FS::Record FS::m2m_Common );
 
 =head1 NAME
 
@@ -82,10 +82,12 @@ sub check {
 
   my $error =
     $self->ut_numbern('routernum')
-    || $self->ut_text('routername');
+    || $self->ut_text('routername')
+    || $self->ut_agentnum_acl('agentnum', 'Broadband global configuration')
+  ;
   return $error if $error;
 
-  '';
+  $self->SUPER::check;
 }
 
 =item addr_block
@@ -100,18 +102,6 @@ sub addr_block {
   return qsearch('addr_block', { routernum => $self->routernum });
 }
 
-=item router_field
-
-Returns a list of FS::router_field objects assigned to this object.
-
-=cut
-
-sub router_field {
-  my $self = shift;
-
-  return qsearch('router_field', { routernum => $self->routernum });
-}
-
 =item part_svc_router
 
 Returns a list of FS::part_svc_router objects associated with this 
@@ -137,17 +127,23 @@ sub part_svc {
       $self->part_svc_router;
 }
 
-=back
+=item agent
 
-=head1 VERSION
+Returns the agent associated with this router, if any.
+
+=cut
 
-$Id:
+sub agent {
+  qsearchs('agent', { 'agentnum' => shift->agentnum });
+}
+
+=back
 
 =head1 BUGS
 
 =head1 SEE ALSO
 
-FS::svc_broadband, FS::router, FS::addr_block, FS::router_field, FS::part_svc,
+FS::svc_broadband, FS::router, FS::addr_block, FS::part_svc,
 schema.html from the base documentation.
 
 =cut