[freeside-commits] freeside/FS/FS AccessRight.pm, 1.23, 1.24 part_pkg.pm, 1.60, 1.61 Schema.pm, 1.66, 1.67 part_event.pm, 1.1, 1.2

Ivan,,, ivan at wavetail.420.am
Sun Sep 23 17:56:52 PDT 2007


Update of /home/cvs/cvsroot/freeside/FS/FS
In directory wavetail:/tmp/cvs-serv23938/FS/FS

Modified Files:
	AccessRight.pm part_pkg.pm Schema.pm part_event.pm 
Log Message:
beginning of agent-virtualization of packages

Index: Schema.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/Schema.pm,v
retrieving revision 1.66
retrieving revision 1.67
diff -u -d -r1.66 -r1.67
--- Schema.pm	18 Sep 2007 17:07:10 -0000	1.66
+++ Schema.pm	24 Sep 2007 00:56:50 -0000	1.67
@@ -862,10 +862,12 @@
         'classnum',      'int',     'NULL', '', '', '', 
         'pay_weight',    'real',    'NULL', '', '', '',
         'credit_weight', 'real',    'NULL', '', '', '',
+        'agentnum',      'int',     'NULL', '', '', '', 
+
       ],
       'primary_key' => 'pkgpart',
       'unique' => [],
-      'index' => [ [ 'promo_code' ], [ 'disabled' ] ],
+      'index' => [ [ 'promo_code' ], [ 'disabled' ], [ 'agentnum' ], ],
     },
 
 #    'part_title' => {
@@ -900,7 +902,7 @@
       ],
       'primary_key' => 'refnum',
       'unique' => [],
-      'index' => [ ['disabled'] ],
+      'index' => [ ['disabled'], ['agentnum'], ],
     },
 
     'part_svc' => {

Index: part_event.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/part_event.pm,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- part_event.pm	1 Aug 2007 22:24:36 -0000	1.1
+++ part_event.pm	24 Sep 2007 00:56:50 -0000	1.2
@@ -138,6 +138,7 @@
     || $self->ut_number('weight')
     || $self->ut_alpha('action')
     || $self->ut_enum('disabled', [ '', 'Y' ] )
+    || $self->ut_agentnum_acl('agentnum', 'Edit global billing events')
   ;
   return $error if $error;
 

Index: AccessRight.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/AccessRight.pm,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -d -r1.23 -r1.24
--- AccessRight.pm	16 Aug 2007 13:40:43 -0000	1.23
+++ AccessRight.pm	24 Sep 2007 00:56:49 -0000	1.24
@@ -223,6 +223,9 @@
   'Configuration rights' => [
     'Edit advertising sources',
     { rightname=>'Edit global advertising sources', global=>1 },
+
+    'Edit package definitions',
+    { rightname=>'Edit global package definitions', global=>1 },
   
     'Edit billing events',
     { rightname=>'Edit global billing events', global=>1 },

Index: part_pkg.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/part_pkg.pm,v
retrieving revision 1.60
retrieving revision 1.61
diff -u -d -r1.60 -r1.61
--- part_pkg.pm	10 Aug 2007 22:48:26 -0000	1.60
+++ part_pkg.pm	24 Sep 2007 00:56:50 -0000	1.61
@@ -13,6 +13,7 @@
 use FS::type_pkgs;
 use FS::part_pkg_option;
 use FS::pkg_class;
+use FS::agent;
 
 @ISA = qw( FS::m2m_Common FS::Record ); # FS::option_Common ); # this can use option_Common
                                                 # when all the plandata bs is
@@ -85,6 +86,8 @@
 
 =item credit_weight - Weight (relative to other package definitions) that controls credit application to specific line items.
 
+=item agentnum - Optional agentnum (see L<FS::agent>)
+
 =back
 
 =head1 METHODS
@@ -449,6 +452,7 @@
     || $self->ut_enum('disabled', [ '', 'Y' ] )
     || $self->ut_floatn('pay_weight')
     || $self->ut_floatn('credit_weight')
+    || $self->ut_agentnum_acl('agentnum', 'Edit global package definitions')
     || $self->SUPER::check
   ;
   return $error if $error;
@@ -501,6 +505,17 @@
     : '';
 }
 
+=item agent 
+
+Returns the associated agent for this event, if any, as an FS::agent object.
+
+=cut
+
+sub agent {
+  my $self = shift;
+  qsearchs('agent', { 'agentnum' => $self->agentnum } );
+}
+
 =item pkg_svc
 
 Returns all FS::pkg_svc objects (see L<FS::pkg_svc>) for this package



More information about the freeside-commits mailing list