summaryrefslogtreecommitdiff
path: root/FS/FS/part_referral.pm
diff options
context:
space:
mode:
authorivan <ivan>2006-08-10 11:55:50 +0000
committerivan <ivan>2006-08-10 11:55:50 +0000
commit264ad081e68057c7bc30a8b2ad741b783e1342ff (patch)
treeee1376c0552c6a40f3c3d6cf05a4a25e6b16fcf8 /FS/FS/part_referral.pm
parent6495ab5fb29dcdb8233f004b5d60d3d97db058b9 (diff)
agent-virtualize advertising sources
Diffstat (limited to 'FS/FS/part_referral.pm')
-rw-r--r--FS/FS/part_referral.pm24
1 files changed, 18 insertions, 6 deletions
diff --git a/FS/FS/part_referral.pm b/FS/FS/part_referral.pm
index c0858c0ed..b12cd628e 100644
--- a/FS/FS/part_referral.pm
+++ b/FS/FS/part_referral.pm
@@ -2,7 +2,8 @@ package FS::part_referral;
use strict;
use vars qw( @ISA );
-use FS::Record;
+use FS::Record qw(qsearchs);
+use FS::agent;
@ISA = qw( FS::Record );
@@ -40,6 +41,8 @@ The following fields are currently supported:
=item disabled - Disabled flag, empty or 'Y'
+=item agentnum - Optional agentnum (see L<FS::agent>)
+
=back
=head1 NOTE
@@ -95,17 +98,26 @@ sub check {
my $error = $self->ut_numbern('refnum')
|| $self->ut_text('referral')
+ || $self->ut_enum('disabled', [ '', 'Y' ] )
+ #|| $self->ut_foreign_keyn('agentnum', 'agent', 'agentnum')
+ || $self->ut_agentnum_acl('agentnum', 'Edit global advertising sources')
;
return $error if $error;
- if ( $self->dbdef_table->column('disabled') ) {
- $error = $self->ut_enum('disabled', [ '', 'Y' ] );
- return $error if $error;
- }
-
$self->SUPER::check;
}
+=item agent
+
+Returns the associated agent for this referral, if any, as an FS::agent object.
+
+=cut
+
+sub agent {
+ my $self = shift;
+ qsearchs('agent', { 'agentnum' => $self->agentnum } );
+}
+
=back
=head1 BUGS