linking DIDs and users to PBXes, RT#7051
[freeside.git] / FS / FS / svc_acct.pm
index e5fd582..ca33aa8 100644 (file)
@@ -38,6 +38,7 @@ use FS::part_svc;
 use FS::svc_acct_pop;
 use FS::cust_main_invoice;
 use FS::svc_domain;
+use FS::svc_pbx;
 use FS::raddb;
 use FS::queue;
 use FS::radius_usergroup;
@@ -161,45 +162,71 @@ FS::svc_Common.  The following fields are currently supported:
 
 =over 4
 
-=item svcnum - primary key (assigned automatcially for new accounts)
+=item svcnum
+
+Primary key (assigned automatcially for new accounts)
 
 =item username
 
-=item _password - generated if blank
+=item _password
+
+generated if blank
+
+=item _password_encoding
+
+plain, crypt, ldap (or empty for autodetection)
 
-=item _password_encoding - plain, crypt, ldap (or empty for autodetection)
+=item sec_phrase
 
-=item sec_phrase - security phrase
+security phrase
 
-=item popnum - Point of presence (see L<FS::svc_acct_pop>)
+=item popnum
+
+Point of presence (see L<FS::svc_acct_pop>)
 
 =item uid
 
 =item gid
 
-=item finger - GECOS
+=item finger
+
+GECOS
+
+=item dir
 
-=item dir - set automatically if blank (and uid is not)
+set automatically if blank (and uid is not)
 
 =item shell
 
-=item quota - (unimplementd)
+=item quota
 
-=item slipip - IP address
+=item slipip
 
-=item seconds - 
+IP address
+
+=item seconds
+
+=item upbytes
+
+=item downbyte
+
+=item totalbytes
+
+=item domsvc
 
-=item upbytes - 
+svcnum from svc_domain
 
-=item downbytes - 
+=item pbxsvc
 
-=item totalbytes - 
+Optional svcnum from svc_pbx
 
-=item domsvc - svcnum from svc_domain
+=item radius_I<Radius_Attribute>
 
-=item radius_I<Radius_Attribute> - I<Radius-Attribute> (reply)
+I<Radius-Attribute> (reply)
 
-=item rc_I<Radius_Attribute> - I<Radius-Attribute> (check)
+=item rc_I<Radius_Attribute>
+
+I<Radius-Attribute> (check)
 
 =back
 
@@ -275,6 +302,20 @@ sub table_info {
                          disable_inventory => 1,
 
                        },
+        'domsvc'    => {
+                         label     => 'Domain',
+                         type      => 'select',
+                         select_table => 'svc_domain',
+                         select_key   => 'svcnum',
+                         select_label => 'domain',
+                         disable_inventory => 1,
+
+                       },
+        'pbxsvc'    => { label => 'PBX',
+                         type  => 'select-svc_pbx.html',
+                         disable_inventory => 1,
+                         disable_select => 1, #UI wonky, pry works otherwise
+                       },
         'usergroup' => {
                          label => 'RADIUS groups',
                          type  => 'radius_usergroup_selector',
@@ -1011,7 +1052,8 @@ sub check {
 
   my $error = $self->ut_numbern('svcnum')
               #|| $self->ut_number('domsvc')
-              || $self->ut_foreign_key('domsvc', 'svc_domain', 'svcnum' )
+              || $self->ut_foreign_key( 'domsvc', 'svc_domain', 'svcnum' )
+              || $self->ut_foreign_keyn('pbxsvc', 'svc_pbx',    'svcnum' )
               || $self->ut_textn('sec_phrase')
               || $self->ut_snumbern('seconds')
               || $self->ut_snumbern('upbytes')