1 package FS::part_referral;
5 use FS::Record qw(qsearchs);
8 @ISA = qw( FS::Record );
12 FS::part_referral - Object methods for part_referral objects
16 use FS::part_referral;
18 $record = new FS::part_referral \%hash
19 $record = new FS::part_referral { 'column' => 'value' };
21 $error = $record->insert;
23 $error = $new_record->replace($old_record);
25 $error = $record->delete;
27 $error = $record->check;
31 An FS::part_referral represents a advertising source - where a customer heard
32 of your services. This can be used to track the effectiveness of a particular
33 piece of advertising, for example. FS::part_referral inherits from FS::Record.
34 The following fields are currently supported:
38 =item refnum - primary key (assigned automatically for new referrals)
40 =item referral - Text name of this advertising source
42 =item disabled - Disabled flag, empty or 'Y'
44 =item agentnum - Optional agentnum (see L<FS::agent>)
50 These were called B<referrals> before version 1.4.0 - the name was changed
51 so as not to be confused with the new customer-to-customer referrals.
59 Creates a new advertising source. To add the referral to the database, see
64 sub table { 'part_referral'; }
68 Adds this advertising source to the database. If there is an error, returns
69 the error, otherwise returns false.
73 Currently unimplemented.
79 return "Can't (yet?) delete part_referral records";
80 #need to make sure no customers have this referral!
83 =item replace OLD_RECORD
85 Replaces OLD_RECORD with this one in the database. If there is an error,
86 returns the error, otherwise returns false.
90 Checks all fields to make sure this is a valid advertising source. If there is
91 an error, returns the error, otherwise returns false. Called by the insert and
99 my $error = $self->ut_numbern('refnum')
100 || $self->ut_text('referral')
101 || $self->ut_enum('disabled', [ '', 'Y' ] )
102 #|| $self->ut_foreign_keyn('agentnum', 'agent', 'agentnum')
103 || $self->ut_agentnum_acl('agentnum', 'Edit global advertising sources')
105 return $error if $error;
112 Returns the associated agent for this referral, if any, as an FS::agent object.
118 qsearchs('agent', { 'agentnum' => $self->agentnum } );
125 The delete method is unimplemented.
127 `Advertising source'. Yes, it's a sucky name. The only other ones I could
128 come up with were "Marketing channel" and "Heard Abouts" and those are
129 definately both worse.
133 L<FS::Record>, L<FS::cust_main>, schema.html from the base documentation.