[freeside-commits] freeside/FS/FS Schema.pm, 1.111, 1.112 agent.pm, 1.16, 1.17

Ivan,,, ivan at wavetail.420.am
Sat Oct 18 17:38:10 PDT 2008


Update of /home/cvs/cvsroot/freeside/FS/FS
In directory wavetail.420.am:/tmp/cvs-serv6603/FS/FS

Modified Files:
	Schema.pm agent.pm 
Log Message:
add a master custnum field to agents, RT#2933 (roundabout)

Index: Schema.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/Schema.pm,v
retrieving revision 1.111
retrieving revision 1.112
diff -u -d -r1.111 -r1.112
--- Schema.pm	27 Sep 2008 03:01:43 -0000	1.111
+++ Schema.pm	19 Oct 2008 00:38:08 -0000	1.112
@@ -332,17 +332,17 @@
         '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'] ],
     },
 

Index: agent.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/agent.pm,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -d -r1.16 -r1.17
--- agent.pm	1 Aug 2007 22:24:36 -0000	1.16
+++ agent.pm	19 Oct 2008 00:38:08 -0000	1.17
@@ -48,17 +48,23 @@
 
 =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 _password - Password for the Agent interface
+=item freq - Deprecated (never used)
+
+=item username - (Deprecated) Username for the Agent interface
+
+=item _password - (Deprecated) Password for the Agent interface
 
 =back
 
@@ -118,6 +124,7 @@
       || $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 @@
   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



More information about the freeside-commits mailing list