2 FS::cust_main - Object methods for cust_main records
7 $record = new FS::cust_main \%hash;
8 $record = new FS::cust_main { 'column' => 'value' };
10 $error = $record->insert;
12 $error = $new_record->replace($old_record);
14 $error = $record->delete;
16 $error = $record->check;
18 @cust_pkg = $record->all_pkgs;
20 @cust_pkg = $record->ncancelled_pkgs;
22 $error = $record->bill;
23 $error = $record->bill %options;
24 $error = $record->bill 'time' => $time;
26 $error = $record->collect;
27 $error = $record->collect %options;
28 $error = $record->collect 'invoice_time' => $time,
29 'batch_card' => 'yes',
30 'report_badcard' => 'yes',
34 An FS::cust_main object represents a customer. FS::cust_main
35 inherits from FS::Record. The following fields are currently
38 custnum - primary key (assigned automatically for new customers)
39 agentnum - agent (see the FS::agent manpage)
40 refnum - referral (see the FS::part_referral manpage)
43 ss - social security number (optional)
48 county - (optional, see the FS::cust_main_county manpage)
49 state - (see the FS::cust_main_county manpage)
51 country - (see the FS::cust_main_county manpage)
52 daytime - phone (optional)
53 night - phone (optional)
54 payby - `CARD' (credit cards), `BILL' (billing), or `COMP' (free)
55 payinfo - card number, P.O.#, or comp issuer (4-8 lowercase alphanumerics; think username)
56 paydate - expiration date, mm/yyyy, m/yyyy, mm/yy or m/yy
57 payname - name on card or billing name
58 tax - tax exempt, empty or `Y'
59 otaker - order taker (assigned automatically, see the FS::UID manpage)
62 Creates a new customer. To add the customer to the database,
63 see the section on "insert".
65 Note that this stores the hash reference, not a distinct
66 copy of the hash it points to. You can ask the object for a
67 copy with the *hash* method.
70 Adds this customer to the database. If there is an error,
71 returns the error, otherwise returns false.
74 Currently unimplemented. Maybe cancel all of this customer's
77 I don't remove the customer record in the database because
78 there would then be no record the customer ever existed
82 Replaces the OLD_RECORD with this one in the database. If
83 there is an error, returns the error, otherwise returns
87 Checks all fields to make sure this is a valid customer
88 record. If there is an error, returns the error, otherwise
89 returns false. Called by the insert and repalce methods.
92 Returns all packages (see the FS::cust_pkg manpage) for this
96 Returns all non-cancelled packages (see the FS::cust_pkg
97 manpage) for this customer.
100 Generates invoices (see the FS::cust_bill manpage) for this
101 customer. Usually used in conjunction with the collect
104 The only currently available option is `time', which bills
105 the customer as if it were that time. It is specified as a
106 UNIX timestamp; see the section on "time" in the perlfunc
107 manpage). Also see the Time::Local manpage and the
108 Date::Parse manpage for conversion functions.
110 If there is an error, returns the error, otherwise returns
114 (Attempt to) collect money for this customer's outstanding
115 invoices (see the FS::cust_bill manpage). Usually used after
118 Depending on the value of `payby', this may print an invoice
119 (`BILL'), charge a credit card (`CARD'), or just add any
120 necessary (pseudo-)payment (`COMP').
122 If there is an error, returns the error, otherwise returns
125 Currently available options are:
127 invoice_time - Use this time when deciding when to print
128 invoices and late notices on those invoices. The default is
129 now. It is specified as a UNIX timestamp; see the section on
130 "time" in the perlfunc manpage). Also see the Time::Local
131 manpage and the Date::Parse manpage for conversion
134 batch_card - Set this true to batch cards (see the
135 cust_pay_batch manpage). By default, cards are processed
136 immediately, which will generate an error if CyberCash is
139 report_badcard - Set this true if you want bad card
140 transactions to return an error. By default, they don't.
143 Returns the total owed for this customer on all invoices
144 (see the FS::cust_bill manpage).
147 Returns the total credits (see the FS::cust_credit manpage)
151 Returns the balance for this customer (total owed minus
154 invoicing_list [ ARRAYREF ]
155 If an arguement is given, sets these email addresses as
156 invoice recipients (see the FS::cust_main_invoice manpage).
157 Errors are not fatal and are not reported (except as
158 warnings), so use check_invoicing_list first.
160 Returns a list of email addresses (with svcnum entries
163 Note: You can clear the invoicing list by passing an empty
164 ARRAYREF. You can check it without disturbing anything by
167 This interface may change in the future.
169 check_invoicing_list ARRAYREF
170 Checks these arguements as valid input for the
171 invoicing_list method. If there is an error, returns the
172 error, otherwise returns false.
175 $Id: cust_main.txt,v 1.3 1999-02-09 09:37:58 ivan Exp $
180 Bill and collect options should probably be passed as references
183 CyberCash v2 forces us to define some variables in package main.
185 There should probably be a configuration file with a list of
186 allowed credit card types.
188 CyberCash is the only processor.
190 No multiple currency support (probably a larger project than
194 the FS::Record manpage, the FS::cust_pkg manpage, the
195 FS::cust_bill manpage, the FS::cust_credit manpage the
196 FS::cust_pay_batch manpage, the FS::agent manpage, the
197 FS::part_referral manpage, the FS::cust_main_county manpage, the
198 FS::cust_main_invoice manpage, the FS::UID manpage, schema.html
199 from the base documentation.
202 ivan@voicenet.com 97-jul-28
204 Changed to standard Business::CreditCard no more TableUtil
205 EXPORT_OK FS::Record's hfields removed unique calls and locking
206 (not needed here now) wrapped the (now) optional fields in if
207 statements in sub check (notyetdone!) ivan@sisd.com 97-nov-12
209 updated paydate with SQL-type date info ivan@sisd.com 98-mar-5
211 Added export of datasrc from UID.pm for Pg6.3 changed 'day' to
212 'daytime' because Pg6.3 reserves the day word
213 bmccane@maxbaud.net 98-apr-3
215 in ->create, s/svc_acct/cust_main/, now it should actually
216 eliminate the warnings it was meant to ivan@sisd.com 98-jul-16
218 don't require a phone number and allow '/' in company names
219 ivan@sisd.com 98-jul-18
221 use ut_ and rewrite &check, &*_pkgs ivan@sisd.com 98-sep-5
223 pod, merge with FS::Bill (about time!), total_owed,
224 total_credited and balance methods, cleaned collect method,
225 source modifications no longer necessary to enable cybercash,
226 cybercash v3 support, don't need to import
227 FS::UID::{datasrc,checkruid} ivan@sisd.com 98-sep-19-21
229 $Log: cust_main.txt,v $
230 Revision 1.3 1999-02-09 09:37:58 ivan
231 regenerated perl api docs from embedded pod
232 Revision 1.10 1999/01/25 12:26:09 ivan
233 yet more mod_perl stuff
235 Revision 1.9 1999/01/18 09:22:41 ivan changes to track email
236 addresses for email invoicing
238 Revision 1.8 1998/12/29 11:59:39 ivan mostly properly OO, some
239 work still to be done with svc_ stuff
241 Revision 1.7 1998/12/16 09:58:52 ivan library support for
242 editing email invoice destinations (not in sub collect yet)
244 Revision 1.6 1998/11/18 09:01:42 ivan i18n! i18n!
246 Revision 1.5 1998/11/15 11:23:14 ivan use FS::table_name for all
247 searches to eliminate warnings, emit state/county when they
250 Revision 1.4 1998/11/15 05:30:48 ivan bugfix for new config
253 Revision 1.3 1998/11/13 09:56:54 ivan change configuration file
254 layout to support multiple distinct databases (with own set of
255 config files, export, etc.)
257 Revision 1.2 1998/11/07 10:24:25 ivan don't use depriciated
258 FS::Bill and FS::Invoice, other miscellania