1 package FS::part_referral;
4 use vars qw(@ISA @EXPORT_OK);
6 use FS::Record qw(fields qsearchs);
8 @ISA = qw(FS::Record Exporter);
9 @EXPORT_OK = qw(fields);
13 FS::part_referral - Object methods for part_referral objects
17 use FS::part_referral;
19 $record = create FS::part_referral \%hash
20 $record = create FS::part_referral { 'column' => 'value' };
22 $error = $record->insert;
24 $error = $new_record->replace($old_record);
26 $error = $record->delete;
28 $error = $record->check;
32 An FS::part_referral represents a referral - where a customer heard of your
33 services. This can be used to track the effectiveness of a particular piece of
34 advertising, for example. FS::part_referral inherits from FS::Record. The
35 following fields are currently supported:
39 =item refnum - primary key (assigned automatically for new referrals)
41 =item referral - Text name of this referral
51 Creates a new referral. To add the referral to the database, see L<"insert">.
56 my($proto,$hashref)=@_;
58 #now in FS::Record::new
60 #foreach $field (fields('part_referral')) {
61 # $hashref->{$field}='' unless defined $hashref->{$field};
64 $proto->new('part_referral',$hashref);
69 Adds this referral to the database. If there is an error, returns the error,
70 otherwise returns false.
83 Currently unimplemented.
89 return "Can't (yet?) delete part_referral records";
93 =item replace OLD_RECORD
95 Replaces OLD_RECORD with this one in the database. If there is an error,
96 returns the error, otherwise returns false.
102 return "(Old) Not an part_referral record!"
103 unless $old->table eq "part_referral";
104 return "Can't change refnum!"
105 unless $old->getfield('refnum') eq $new->getfield('refnum');
112 Checks all fields to make sure this is a valid referral. If there is an error,
113 returns the error, otherwise returns false. Called by the insert and replace
120 return "Not a part_referral record!" unless $self->table eq "part_referral";
123 $self->ut_numbern('refnum')
124 or $self->ut_text('referral')
126 return $error if $error;
136 It doesn't properly override FS::Record yet.
138 The delete method is unimplemented.
142 L<FS::Record>, L<FS::cust_main>, schema.html from the base documentation.
146 Class dealing with referrals
148 ivan@sisd.com 98-feb-23
150 pod ivan@sisd.com 98-sep-21