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