summaryrefslogtreecommitdiff
path: root/FS
diff options
context:
space:
mode:
Diffstat (limited to 'FS')
-rw-r--r--FS/FS/AccessRight.pm3
-rw-r--r--FS/FS/Schema.pm6
-rw-r--r--FS/FS/part_event.pm1
-rw-r--r--FS/FS/part_pkg.pm15
4 files changed, 23 insertions, 2 deletions
diff --git a/FS/FS/AccessRight.pm b/FS/FS/AccessRight.pm
index 4071e9730..5ab6809a4 100644
--- a/FS/FS/AccessRight.pm
+++ b/FS/FS/AccessRight.pm
@@ -223,6 +223,9 @@ tie my %rights, 'Tie::IxHash',
'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 },
diff --git a/FS/FS/Schema.pm b/FS/FS/Schema.pm
index aebe5de63..1ddaca0eb 100644
--- a/FS/FS/Schema.pm
+++ b/FS/FS/Schema.pm
@@ -862,10 +862,12 @@ sub tables_hashref {
'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 @@ sub tables_hashref {
],
'primary_key' => 'refnum',
'unique' => [],
- 'index' => [ ['disabled'] ],
+ 'index' => [ ['disabled'], ['agentnum'], ],
},
'part_svc' => {
diff --git a/FS/FS/part_event.pm b/FS/FS/part_event.pm
index 09104cd49..d0ab65e3f 100644
--- a/FS/FS/part_event.pm
+++ b/FS/FS/part_event.pm
@@ -138,6 +138,7 @@ sub check {
|| $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;
diff --git a/FS/FS/part_pkg.pm b/FS/FS/part_pkg.pm
index fad7af2f9..84502b745 100644
--- a/FS/FS/part_pkg.pm
+++ b/FS/FS/part_pkg.pm
@@ -13,6 +13,7 @@ use FS::agent_type;
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 @@ inherits from FS::Record. The following fields are currently supported:
=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 @@ sub check {
|| $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 @@ sub classname {
: '';
}
+=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