4.x+ self-service API: list and remove cards on file, RT#38919
[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 billpkgnum
38
39 named thusly for quick compatability with L<FS::TemplateItem_Mixin>,
40 actually the quotationpkgnum for the relevant L<FS::quotation_pkg>
41
42 =item detail
43
44 detail text
45
46 =cut
47
48 # 'format' field isn't used, there for TemplateItem_Mixin
49
50 =back
51
52 =head1 METHODS
53
54 =over 4
55
56 =item new HASHREF
57
58 Creates a new record.  To add the record to the database, see L<"insert">.
59
60 Note that this stores the hash reference, not a distinct copy of the hash it
61 points to.  You can ask the object for a copy with the I<hash> method.
62
63 =cut
64
65 # the new method can be inherited from FS::Record, if a table method is defined
66
67 sub table { 'quotation_pkg_detail'; }
68
69 =item insert
70
71 Adds this record to the database.  If there is an error, returns the error,
72 otherwise returns false.
73
74 =cut
75
76 # the insert method can be inherited from FS::Record
77
78 =item delete
79
80 Delete this record from the database.
81
82 =cut
83
84 # the delete method can be inherited from FS::Record
85
86 =item replace OLD_RECORD
87
88 Replaces the OLD_RECORD with this one in the database.  If there is an error,
89 returns the error, otherwise returns false.
90
91 =cut
92
93 # the replace method can be inherited from FS::Record
94
95 =item check
96
97 Checks all fields to make sure this is a valid record.  If there is
98 an error, returns the error, otherwise returns false.  Called by the insert
99 and replace methods.
100
101 =cut
102
103 # the check method should currently be supplied - FS::Record contains some
104 # data checking routines
105
106 sub check {
107   my $self = shift;
108
109   my $error = 
110     $self->ut_numbern('detailnum')
111     || $self->ut_foreign_key('billpkgnum', 'quotation_pkg', 'quotationpkgnum')
112     || $self->ut_text('detail')
113   ;
114   return $error if $error;
115
116   $self->SUPER::check;
117 }
118
119 =back
120
121 =head1 BUGS
122
123 =head1 SEE ALSO
124
125 L<FS::quotation_pkg>, L<FS::Record>
126
127 =cut
128
129 1;
130