communigate provisioning phase 2: Domain:Account Defaults:Settings: RulesAllowed...
[freeside.git] / FS / FS / router.pm
index 88ba990..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,7 +82,9 @@ 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;
@@ -125,6 +127,16 @@ sub part_svc {
       $self->part_svc_router;
 }
 
+=item agent
+
+Returns the agent associated with this router, if any.
+
+=cut
+
+sub agent {
+  qsearchs('agent', { 'agentnum' => shift->agentnum });
+}
+
 =back
 
 =head1 BUGS