diff options
author | ivan <ivan> | 2008-10-19 00:38:09 +0000 |
---|---|---|
committer | ivan <ivan> | 2008-10-19 00:38:09 +0000 |
commit | 51d044c74ff531b744a6b570fe4a178654a0e7da (patch) | |
tree | 62f4435d7032ca93770ba035d1f94f2b0cdba2dc /FS | |
parent | 86a09d3645f2b92ecd735ce8354e5f99a64b050f (diff) |
add a master custnum field to agents, RT#2933 (roundabout)
Diffstat (limited to 'FS')
-rw-r--r-- | FS/FS/Schema.pm | 6 | ||||
-rw-r--r-- | FS/FS/agent.pm | 29 |
2 files changed, 27 insertions, 8 deletions
diff --git a/FS/FS/Schema.pm b/FS/FS/Schema.pm index 0b121db3e..941eafc7f 100644 --- a/FS/FS/Schema.pm +++ b/FS/FS/Schema.pm @@ -332,17 +332,17 @@ sub tables_hashref { 'agentnum', 'serial', '', '', '', '', 'agent', 'varchar', '', $char_d, '', '', 'typenum', 'int', '', '', '', '', - 'disabled', 'char', 'NULL', 1, '', '', 'ticketing_queueid', 'int', 'NULL', '', '', '', 'invoice_template', 'varchar', 'NULL', $char_d, '', '', + 'agent_custnum', 'int', 'NULL', '', '', '', + 'disabled', 'char', 'NULL', 1, '', '', 'username', 'varchar', 'NULL', $char_d, '', '', #deprecated '_password', 'varchar', 'NULL', $char_d, '', '', #deprecated 'freq', 'int', 'NULL', '', '', '', #deprecated (never used) 'prog', @perl_type, '', '', #deprecated (never used) - ], 'primary_key' => 'agentnum', - 'unique' => [], + 'unique' => [ [ 'agent_custnum' ] ], #one agent per customer? 'index' => [ ['typenum'], ['disabled'] ], }, diff --git a/FS/FS/agent.pm b/FS/FS/agent.pm index 57cc94563..4166a7cac 100644 --- a/FS/FS/agent.pm +++ b/FS/FS/agent.pm @@ -48,17 +48,23 @@ from FS::Record. The following fields are currently supported: =item agent - Text name of this agent -=item typenum - Agent type. See L<FS::agent_type> +=item typenum - Agent type (see L<FS::agent_type>) -=item prog - For future use. +=item ticketing_queueid - Ticketing Queue -=item freq - For future use. +=item invoice_template - Invoice template name + +=item agent_custnum - Optional agent customer (see L<FS::cust_main>) =item disabled - Disabled flag, empty or 'Y' -=item username - Username for the Agent interface +=item prog - Deprecated (never used) + +=item freq - Deprecated (never used) + +=item username - (Deprecated) Username for the Agent interface -=item _password - Password for the Agent interface +=item _password - (Deprecated) Password for the Agent interface =back @@ -118,6 +124,7 @@ sub check { || $self->ut_numbern('freq') || $self->ut_textn('prog') || $self->ut_textn('invoice_template') + || $self->ut_foreign_keyn('agent_custnum', 'cust_main', 'custnum' ) ; return $error if $error; @@ -156,6 +163,18 @@ sub agent_type { qsearchs( 'agent_type', { 'typenum' => $self->typenum } ); } +=item agent_cust_main + +Returns the FS::cust_main object (see L<FS::cust_main>), if any, for this +agent. + +=cut + +sub agent_cust_main { + my $self = shift; + qsearchs( 'cust_main', { 'custnum' => $self->agent_custnum } ); +} + =item pkgpart_hashref Returns a hash reference. The keys of the hash are pkgparts. The value is |