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

From Freeside
Jump to: navigation, search
m (Edit via perl MediaWiki framework (1.13))
 
m (Edit via perl MediaWiki framework (1.13))
Line 20: Line 20:
 
An FS::reason object represents a reason message. FS::reason inherits from FS::Record. The following fields are currently supported:
 
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 ''
+
; 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 [[Freeside:3:Documentation:Developer/FS/part pkg|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.; 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').
 
==METHODS==
 
==METHODS==
 
; new HASHREF
 
; new HASHREF
Line 35: Line 35:
 
: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.
 
: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
 
; reasontype
:Returns the reason_type (see <I>FS::reason_type</I>) associated with this reason.
+
:Returns the reason_type (see [[Freeside:3:Documentation:Developer/FS/reason type|FS::reason_type]]) associated with this reason.
 +
 
 +
==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), or 'S' (suspend reasons).
 +
 
 +
:This will die if anything fails.
  
 
==BUGS==
 
==BUGS==
Here be termintes. Don't use on wooden computers.
+
Here by termintes. Don't use on wooden computers.
  
 
==SEE ALSO==
 
==SEE ALSO==
 
[[Freeside:3:Documentation:Developer/FS/Record|FS::Record]], schema.html from the base documentation.
 
[[Freeside:3:Documentation:Developer/FS/Record|FS::Record]], schema.html from the base documentation.
 +
 +
==POD ERRORS==
 +
Hey! '''The above document had some coding errors, which are explained below:'''
 +
 +
; Around line 179&#58;
 +
:You forgot a '=back' before '=head1'

Revision as of 14:38, 27 June 2014

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.; 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').

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.

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), or 'S' (suspend reasons).
This will die if anything fails.

BUGS

Here by termintes. Don't use on wooden computers.

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 179:
You forgot a '=back' before '=head1'