This commit was generated by cvs2svn to compensate for changes in r2523,
[freeside.git] / FS / FS / part_referral.pm
1 package FS::part_referral;
2
3 use strict;
4 use vars qw( @ISA );
5 use FS::Record;
6
7 @ISA = qw( FS::Record );
8
9 =head1 NAME
10
11 FS::part_referral - Object methods for part_referral objects
12
13 =head1 SYNOPSIS
14
15   use FS::part_referral;
16
17   $record = new FS::part_referral \%hash
18   $record = new FS::part_referral { 'column' => 'value' };
19
20   $error = $record->insert;
21
22   $error = $new_record->replace($old_record);
23
24   $error = $record->delete;
25
26   $error = $record->check;
27
28 =head1 DESCRIPTION
29
30 An FS::part_referral represents a advertising source - where a customer heard
31 of your services.  This can be used to track the effectiveness of a particular
32 piece of advertising, for example.  FS::part_referral inherits from FS::Record.
33 The following fields are currently supported:
34
35 =over 4
36
37 =item refnum - primary key (assigned automatically for new referrals)
38
39 =item referral - Text name of this advertising source
40
41 =back
42
43 =head1 NOTE
44
45 These were called B<referrals> before version 1.4.0 - the name was changed
46 so as not to be confused with the new customer-to-customer referrals.
47
48 =head1 METHODS
49
50 =over 4
51
52 =item new HASHREF
53
54 Creates a new advertising source.  To add the referral to the database, see
55 L<"insert">.
56
57 =cut
58
59 sub table { 'part_referral'; }
60
61 =item insert
62
63 Adds this advertising source to the database.  If there is an error, returns
64 the error, otherwise returns false.
65
66 =item delete
67
68 Currently unimplemented.
69
70 =cut
71
72 sub delete {
73   my $self = shift;
74   return "Can't (yet?) delete part_referral records";
75   #need to make sure no customers have this referral!
76 }
77
78 =item replace OLD_RECORD
79
80 Replaces OLD_RECORD with this one in the database.  If there is an error,
81 returns the error, otherwise returns false.
82
83 =item check
84
85 Checks all fields to make sure this is a valid advertising source.  If there is
86 an error, returns the error, otherwise returns false.  Called by the insert and
87 replace methods.
88
89 =cut
90
91 sub check {
92   my $self = shift;
93
94   $self->ut_numbern('refnum')
95     || $self->ut_text('referral')
96   ;
97 }
98
99 =back
100
101 =head1 BUGS
102
103 The delete method is unimplemented.
104
105 `Advertising source'.  Yes, it's a sucky name.  The only other ones I could
106 come up with were "Marketing channel" and "Heard Abouts" and those are
107 definately both worse.
108
109 =head1 SEE ALSO
110
111 L<FS::Record>, L<FS::cust_main>, schema.html from the base documentation.
112
113 =cut
114
115 1;
116