Freeside:4:Documentation:Developer/FS/cust credit bill pkg
Contents
NAME
FS::cust_credit_bill_pkg - Object methods for cust_credit_bill_pkg records
SYNOPSIS
use FS::cust_credit_bill_pkg; $record = new FS::cust_credit_bill_pkg \%hash; $record = new FS::cust_credit_bill_pkg { 'column' => 'value' }; $error = $record->insert; $error = $new_record->replace($old_record); $error = $record->delete; $error = $record->check;
DESCRIPTION
An FS::cust_credit_bill_pkg object represents application of a credit (see FS::cust_credit_bill) to a specific line item within an invoice (see FS::cust_bill_pkg). FS::cust_credit_bill_pkg inherits from FS::Record. The following fields are currently supported:
- creditbillpkgnum - primary key; creditbillnum - Credit application to the overall invoice (see FS::cust_credit::bill); billpkgnum - Line item to which credit is applied (see FS::cust_bill_pkg); amount - Amount of the credit applied to this line item.; setuprecur - 'setup' or 'recur', designates whether the payment was applied to the setup or recurring portion of the line item.; sdate - starting date of recurring fee; edate - ending date of recurring fee
sdate and edate are specified as UNIX timestamps; see "time" in perlfunc. Also see Time::Local and Date::Parse for conversion functions.
METHODS
- new HASHREF
- Creates a new example. To add the example to the database, see "insert".
- Note that this stores the hash reference, not a distinct copy of the hash it points to. You can ask the object for a copy with the hash method.
- insert
- Adds this record to the database. If there is an error, returns the error, otherwise returns false.
- delete
- Delete this record from the database.
- replace OLD_RECORD
- Replaces the OLD_RECORD with this one in the database. If there is an error, returns the error, otherwise returns false.
- check
- Checks all fields to make sure this is a valid credit applicaiton. If there is an error, returns the error, otherwise returns false. Called by the insert and replace methods.
BUGS
setuprecur field is a kludge to compensate for cust_bill_pkg having separate setup and recur fields. It should be removed once that's fixed.
insert method used to assume that the frequency of the package associated with the associated line item remained unchanged during the lifetime of the system. That is still used as a fallback. It may get the tax exemption adjustments wrong if package definitions change frequency. The presense of delete methods in FS::cust_main_county and FS::tax_rate makes crediting of old "texas tax" unreliable in the presense of changing taxes. Explicit tax credit requests? Carry 'taxable' onto line items?
SEE ALSO
FS::Record, schema.html from the base documentation.