backup the schema for tables we don't need the data from. RT#85959
[freeside.git] / FS / FS / legacy_cust_bill.pm
1 package FS::legacy_cust_bill;
2 use base qw( FS::Record );
3
4 use strict;
5
6 =head1 NAME
7
8 FS::legacy_cust_bill - Object methods for legacy_cust_bill records
9
10 =head1 SYNOPSIS
11
12   use FS::legacy_cust_bill;
13
14   $record = new FS::legacy_cust_bill \%hash;
15   $record = new FS::legacy_cust_bill { '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::legacy_cust_bill object represents an invoice from a previous billing
28 system, about which full details are not availble.  Instead, the rendered
29 content is stored in HTML or PDF format.  FS::legacy_cust_bill invoices are
30 stored for informational and display purposes only; they have no effect upon
31 customer balances.
32
33 FS::legacy_cust_bill inherits from FS::Record.  The following fields are
34 currently supported:
35
36 =over 4
37
38 =item legacyinvnum
39
40 primary key
41
42 =item legacyid
43
44 Invoice number or identifier from previous system
45
46 =item custnum
47
48 Customer (see L<FS::cust_main>)
49
50 =item _date
51
52 Date, as a UNIX timestamp
53
54 =item charged
55
56 Amount charged
57
58 =item content_pdf
59
60 PDF content
61
62 =item content_html
63
64 HTML content
65
66
67 =back
68
69 =head1 METHODS
70
71 =over 4
72
73 =item new HASHREF
74
75 Creates a new legacy invoice.  To add the example to the database, see
76 L<"insert">.
77
78 Note that this stores the hash reference, not a distinct copy of the hash it
79 points to.  You can ask the object for a copy with the I<hash> method.
80
81 =cut
82
83 # the new method can be inherited from FS::Record, if a table method is defined
84
85 sub table { 'legacy_cust_bill'; }
86
87 =item insert
88
89 Adds this record to the database.  If there is an error, returns the error,
90 otherwise returns false.
91
92 =cut
93
94 # the insert method can be inherited from FS::Record
95
96 =item delete
97
98 Delete this record from the database.
99
100 =cut
101
102 # the delete method can be inherited from FS::Record
103
104 =item replace OLD_RECORD
105
106 Replaces the OLD_RECORD with this one in the database.  If there is an error,
107 returns the error, otherwise returns false.
108
109 =cut
110
111 # the replace method can be inherited from FS::Record
112
113 =item check
114
115 Checks all fields to make sure this is a valid legacy invoice.  If there is
116 an error, returns the error, otherwise returns false.  Called by the insert
117 and replace methods.
118
119 =cut
120
121 # the check method should currently be supplied - FS::Record contains some
122 # data checking routines
123
124 sub check {
125   my $self = shift;
126
127   my $error = 
128     $self->ut_numbern('legacyinvnum')
129     || $self->ut_textn('legacyid')
130     || $self->ut_foreign_keyn('custnum', 'cust_main', 'custnum')
131     || $self->ut_number('_date')
132     || $self->ut_money('charged')
133     || $self->ut_anything('content_pdf')
134     || $self->ut_anything('content_html')
135   ;
136   return $error if $error;
137
138   $self->SUPER::check;
139 }
140
141 =item cust_main
142
143 Returns the customer (see L<FS::cust_main>) for this invoice.
144
145 =back
146
147 =head1 BUGS
148
149 =head1 SEE ALSO
150
151 L<FS::Record>, schema.html from the base documentation.
152
153 =cut
154
155 1;
156