delete fees, RT#81713
[freeside.git] / FS / FS / prospect_contact.pm
1 package FS::prospect_contact;
2 use base qw( FS::Record );
3
4 use strict;
5 use FS::Record qw( qsearch qsearchs );
6
7 =head1 NAME
8
9 FS::prospect_contact - Object methods for prospect_contact records
10
11 =head1 SYNOPSIS
12
13   use FS::prospect_contact;
14
15   $record = new FS::prospect_contact \%hash;
16   $record = new FS::prospect_contact { 'column' => 'value' };
17
18   $error = $record->insert;
19
20   $error = $new_record->replace($old_record);
21
22   $error = $record->delete;
23
24   $error = $record->check;
25
26 =head1 DESCRIPTION
27
28 An FS::prospect_contact object represents a contact's attachment to a specific
29 prospect.  FS::prospect_contact inherits from FS::Record.  The following fields
30 are currently supported:
31
32 =over 4
33
34 =item prospectcontactnum
35
36 primary key
37
38 =item prospectnum
39
40 prospectnum
41
42 =item contactnum
43
44 contactnum
45
46 =item classnum
47
48 classnum
49
50 =item comment
51
52 comment
53
54
55 =back
56
57 =head1 METHODS
58
59 =over 4
60
61 =item new HASHREF
62
63 Creates a new record.  To add the record to the database, see L<"insert">.
64
65 Note that this stores the hash reference, not a distinct copy of the hash it
66 points to.  You can ask the object for a copy with the I<hash> method.
67
68 =cut
69
70 # the new method can be inherited from FS::Record, if a table method is defined
71
72 sub table { 'prospect_contact'; }
73
74 =item insert
75
76 Adds this record to the database.  If there is an error, returns the error,
77 otherwise returns false.
78
79 =item delete
80
81 Delete this record from the database.
82
83 =item replace OLD_RECORD
84
85 Replaces the OLD_RECORD with this one in the database.  If there is an error,
86 returns the error, otherwise returns false.
87
88 =item check
89
90 Checks all fields to make sure this is a valid record.  If there is
91 an error, returns the error, otherwise returns false.  Called by the insert
92 and replace methods.
93
94 =cut
95
96 # the check method should currently be supplied - FS::Record contains some
97 # data checking routines
98
99 sub check {
100   my $self = shift;
101
102   my $error = 
103     $self->ut_numbern('prospectcontactnum')
104     || $self->ut_number('prospectnum')
105     || $self->ut_number('contactnum')
106     || $self->ut_numbern('classnum')
107     || $self->ut_textn('comment')
108   ;
109   return $error if $error;
110
111   $self->SUPER::check;
112 }
113
114 =back
115
116 =head1 BUGS
117
118 =head1 SEE ALSO
119
120 L<FS::contact>, L<FS::prospect_main>, L<FS::Record>
121
122 =cut
123
124 1;
125