Initial revision
[freeside.git] / htdocs / docs / man / cust_credit.txt
1 NAME
2     FS::cust_credit - Object methods for cust_credit records
3
4 SYNOPSIS
5       use FS::cust_credit;
6
7       $record = create FS::cust_credit \%hash;
8       $record = create FS::cust_credit { 'column' => 'value' };
9
10       $error = $record->insert;
11
12       $error = $new_record->replace($old_record);
13
14       $error = $record->delete;
15
16       $error = $record->check;
17
18 DESCRIPTION
19     An FS::cust_credit object represents a credit. FS::cust_credit
20     inherits from FS::Record. The following fields are currently
21     supported:
22
23     crednum - primary key (assigned automatically for new credits)
24     custnum - customer (see the FS::cust_main manpage)
25     amount - amount of the credit
26     credited - how much of this credit that is still outstanding, which is
27     amount minus all refunds (see the FS::cust_refund manpage).
28     _date - specified as a UNIX timestamp; see the section on "time" in the perlfunc manpage.  Also see
29     the Time::Local manpage and the Date::Parse manpage for conversion functions.
30     otaker - order taker (assigned automatically, see the FS::UID manpage)
31     reason - text
32 METHODS
33     create HASHREF
34         Creates a new credit. To add the credit to the database, see
35         the section on "insert".
36
37     insert
38         Adds this credit to the database ("Posts" the credit). If
39         there is an error, returns the error, otherwise returns
40         false.
41
42         When adding new invoices, credited must be amount (or null,
43         in which case it is automatically set to amount).
44
45     delete
46         Currently unimplemented.
47
48     replace OLD_RECORD
49         Replaces the OLD_RECORD with this one in the database. If
50         there is an error, returns the error, otherwise returns
51         false.
52
53         Only credited may be changed. Credited is normally updated
54         by creating and inserting a refund (see the FS::cust_refund
55         manpage).
56
57     check
58         Checks all fields to make sure this is a valid credit. If
59         there is an error, returns the error, otherwise returns
60         false. Called by the insert and replace methods.
61
62 BUGS
63     The delete method.
64
65     It doesn't properly override FS::Record yet.
66
67 SEE ALSO
68     the FS::Record manpage, the FS::cust_refund manpage, the
69     FS::cust_bill manpage, schema.html from the base documentation.
70
71 HISTORY
72     ivan@sisd.com 98-mar-17
73
74     pod, otaker from FS::UID ivan@sisd.com 98-sep-21
75