add pkey to batch payments and fix a doc typo
[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 referral - where a customer heard of your
31 services.  This can be used to track the effectiveness of a particular piece of
32 advertising, for example.  FS::part_referral inherits from FS::Record.  The
33 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 referral
40
41 =back
42
43 =head1 METHODS
44
45 =over 4
46
47 =item new HASHREF
48
49 Creates a new referral.  To add the referral to the database, see L<"insert">.
50
51 =cut
52
53 sub table { 'part_referral'; }
54
55 =item insert
56
57 Adds this referral to the database.  If there is an error, returns the error,
58 otherwise returns false.
59
60 =item delete
61
62 Currently unimplemented.
63
64 =cut
65
66 sub delete {
67   my $self = shift;
68   return "Can't (yet?) delete part_referral records";
69   #need to make sure no customers have this referral!
70 }
71
72 =item replace OLD_RECORD
73
74 Replaces OLD_RECORD with this one in the database.  If there is an error,
75 returns the error, otherwise returns false.
76
77 =item check
78
79 Checks all fields to make sure this is a valid referral.  If there is an error,
80 returns the error, otherwise returns false.  Called by the insert and replace
81 methods.
82
83 =cut
84
85 sub check {
86   my $self = shift;
87
88   $self->ut_numbern('refnum')
89     || $self->ut_text('referral')
90   ;
91 }
92
93 =back
94
95 =head1 VERSION
96
97 $Id: part_referral.pm,v 1.1 1999-08-04 09:03:53 ivan Exp $
98
99 =head1 BUGS
100
101 The delete method is unimplemented.
102
103 =head1 SEE ALSO
104
105 L<FS::Record>, L<FS::cust_main>, schema.html from the base documentation.
106
107 =cut
108
109 1;
110