Difference between revisions of "Freeside:4:Documentation:Developer/FS/reason"

From Freeside
Jump to: navigation, search
(Edit via perl MediaWiki framework (1.13))
 
(No difference)

Latest revision as of 07:28, 18 November 2015

NAME

FS::reason - Object methods for reason records

SYNOPSIS

 use FS::reason;

 $record = new FS::reason \%hash;
 $record = new FS::reason { 'column' => 'value' };

 $error = $record->insert;

 $error = $new_record->replace($old_record);

 $error = $record->delete;

 $error = $record->check;

DESCRIPTION

An FS::reason object represents a reason message. FS::reason inherits from FS::Record. The following fields are currently supported:

reasonnum - primary key; reason_type - index into FS::reason_type; reason - text of the reason; disabled - 'Y' or ''; unsuspend_pkgpart - for suspension reasons only, the pkgpart (see FS::part_pkg) of a package to be ordered when the package is unsuspended. Typically this will be some kind of reactivation fee. Attaching it to a suspension reason allows the reactivation fee to be charged for some suspensions but not others. DEPRECATED.; unsuspend_hold - 'Y' or ''. If unsuspend_pkgpart is set, this tells whether to bill the unsuspend package immediately ('') or to wait until the customer's next invoice ('Y').; unused_credit - 'Y' or ''. For suspension reasons only (for now). If enabled, the customer will be credited for their remaining time on suspension.; feepart - for suspension reasons, the feepart of a fee to be charged when a package is suspended for this reason.; fee_hold - 'Y' or ''. If feepart is set, tells whether to bill the fee immediately ('') or wait until the customer's next invoice ('Y').; fee_on_unsuspend - If feepart is set, tells whether to charge the fee on suspension ('') or unsuspension ('Y').

METHODS

new HASHREF
Creates a new reason. 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 reason. If there is an error, returns the error, otherwise returns false. Called by the insert and replace methods.
reasontype
Returns the reason_type (see FS::reason_type) associated with this reason.
merge
Accepts an arrayref of reason objects, to be merged into this reason. Reasons must all have the same reason_type class as this one. Matching reasonnums will be replaced in the following tables:

 cust_bill_void
 cust_bill_pkg_void
 cust_credit
 cust_credit_void
 cust_pay_void
 cust_pkg_reason
 cust_refund

CLASS METHODS

new_or_existing reason => REASON, type => TYPE, class => CLASS
Fetches the reason matching these parameters if there is one. If not, inserts one. Will also insert the reason type if necessary. CLASS must be one of 'C' (cancel reasons), 'R' (credit reasons), 'S' (suspend reasons), or 'F' (refund reasons).
This will die if anything fails.

BUGS

SEE ALSO

FS::Record, schema.html from the base documentation.

POD ERRORS

Hey! The above document had some coding errors, which are explained below:

Around line 282:
You forgot a '=back' before '=head1'