Difference between revisions of "Freeside:1.7:Documentation:Developer/FS/cust refund"

From Freeside
Jump to: navigation, search
(import from POD)
 
m (Edit via perl MediaWiki framework (1.13))
 
(2 intermediate revisions by the same user not shown)
Line 20: Line 20:
 
An FS::cust_refund represents a refund: the transfer of money to a customer; equivalent to a negative payment (see [[Freeside:1.7:Documentation:Developer/FS/cust pay|FS::cust_pay]]). FS::cust_refund inherits from FS::Record. The following fields are currently supported:
 
An FS::cust_refund represents a refund: the transfer of money to a customer; equivalent to a negative payment (see [[Freeside:1.7:Documentation:Developer/FS/cust pay|FS::cust_pay]]). FS::cust_refund inherits from FS::Record. The following fields are currently supported:
  
; refundnum - primary key (assigned automatically for new refunds); custnum - customer (see [[Freeside:1.7:Documentation:Developer/FS/cust main|FS::cust_main]]); refund - Amount of the refund; reason - Reason for the refund; _date - specified as a UNIX timestamp; see [[Freeside:1.7:Documentation:Developer/perlfunc#time|"time" in perlfunc|perlfunc#time|"time" in perlfunc]]. Also see [[Freeside:1.7:Documentation:Developer/Time/Local|Time::Local]] and [[Freeside:1.7:Documentation:Developer/Date/Parse|Date::Parse]] for conversion functions.; payby - Payment Type (See [[Freeside:1.7:Documentation:Developer/FS/payinfo Mixin|FS::payinfo_Mixin]] for valid payby values); payinfo - Payment Information (See [[Freeside:1.7:Documentation:Developer/FS/payinfo Mixin|FS::payinfo_Mixin]] for data format); paymask - Masked payinfo (See [[Freeside:1.7:Documentation:Developer/FS/payinfo Mixin|FS::payinfo_Mixin]] for how this works); paybatch - text field for tracking card processing; otaker - order taker (assigned automatically, see [[Freeside:1.7:Documentation:Developer/FS/UID|FS::UID]]); closed - books closed flag, empty or `Y'
+
; refundnum - primary key (assigned automatically for new refunds); custnum - customer (see [[Freeside:1.7:Documentation:Developer/FS/cust main|FS::cust_main]]); refund - Amount of the refund; reason - Reason for the refund; _date - specified as a UNIX timestamp; see [[perlfunc#time|"time" in perlfunc]]. Also see [[Freeside:1.7:Documentation:Developer/Time/Local|Time::Local]] and [[Freeside:1.7:Documentation:Developer/Date/Parse|Date::Parse]] for conversion functions.; payby - Payment Type (See [[Freeside:1.7:Documentation:Developer/FS/payinfo Mixin|FS::payinfo_Mixin]] for valid payby values); payinfo - Payment Information (See [[Freeside:1.7:Documentation:Developer/FS/payinfo Mixin|FS::payinfo_Mixin]] for data format); paymask - Masked payinfo (See [[Freeside:1.7:Documentation:Developer/FS/payinfo Mixin|FS::payinfo_Mixin]] for how this works); paybatch - text field for tracking card processing; otaker - order taker (assigned automatically, see [[Freeside:1.7:Documentation:Developer/FS/UID|FS::UID]]); closed - books closed flag, empty or `Y'
 
==METHODS==
 
==METHODS==
 
; new HASHREF
 
; new HASHREF
Line 31: Line 31:
 
:Unless the closed flag is set, deletes this refund and all associated applications (see [[Freeside:1.7:Documentation:Developer/FS/cust credit refund|FS::cust_credit_refund]] and [[Freeside:1.7:Documentation:Developer/FS/cust pay refund|FS::cust_pay_refund]]).
 
:Unless the closed flag is set, deletes this refund and all associated applications (see [[Freeside:1.7:Documentation:Developer/FS/cust credit refund|FS::cust_credit_refund]] and [[Freeside:1.7:Documentation:Developer/FS/cust pay refund|FS::cust_pay_refund]]).
 
; replace OLD_RECORD
 
; replace OLD_RECORD
:Currently unimplemented (accounting reasons).
+
:Modifying a refund? Well, don't say I didn't warn you.
 
; check
 
; check
 
:Checks all fields to make sure this is a valid refund. If there is an error, returns the error, otherwise returns false. Called by the insert method.
 
:Checks all fields to make sure this is a valid refund. If there is an error, returns the error, otherwise returns false. Called by the insert method.
Line 40: Line 40:
 
; unapplied
 
; unapplied
 
:Returns the amount of this refund that is still unapplied; which is amount minus all credit applications (see [[Freeside:1.7:Documentation:Developer/FS/cust credit refund|FS::cust_credit_refund]]) and payment applications (see [[Freeside:1.7:Documentation:Developer/FS/cust pay refund|FS::cust_pay_refund]]).
 
:Returns the amount of this refund that is still unapplied; which is amount minus all credit applications (see [[Freeside:1.7:Documentation:Developer/FS/cust credit refund|FS::cust_credit_refund]]) and payment applications (see [[Freeside:1.7:Documentation:Developer/FS/cust pay refund|FS::cust_pay_refund]]).
 +
 +
==CLASS METHODS==
 +
; unapplied_sql
 +
:Returns an SQL fragment to retreive the unapplied amount.
  
 
==BUGS==
 
==BUGS==

Latest revision as of 13:01, 23 July 2009

NAME

FS::cust_refund - Object method for cust_refund objects

SYNOPSIS

 use FS::cust_refund;

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

 $error = $record->insert;

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

 $error = $record->delete;

 $error = $record->check;

DESCRIPTION

An FS::cust_refund represents a refund: the transfer of money to a customer; equivalent to a negative payment (see FS::cust_pay). FS::cust_refund inherits from FS::Record. The following fields are currently supported:

refundnum - primary key (assigned automatically for new refunds); custnum - customer (see FS::cust_main); refund - Amount of the refund; reason - Reason for the refund; _date - specified as a UNIX timestamp; see "time" in perlfunc. Also see Time::Local and Date::Parse for conversion functions.; payby - Payment Type (See FS::payinfo_Mixin for valid payby values); payinfo - Payment Information (See FS::payinfo_Mixin for data format); paymask - Masked payinfo (See FS::payinfo_Mixin for how this works); paybatch - text field for tracking card processing; otaker - order taker (assigned automatically, see FS::UID); closed - books closed flag, empty or `Y'

METHODS

new HASHREF
Creates a new refund. To add the refund to the database, see "insert".
insert
Adds this refund to the database.
For backwards-compatibility and convenience, if the additional field crednum is defined, an FS::cust_credit_refund record for the full amount of the refund will be created. Or (this time for convenience and consistancy), if the additional field paynum is defined, an FS::cust_pay_refund record for the full amount of the refund will be created. In both cases, custnum is optional.
delete
Unless the closed flag is set, deletes this refund and all associated applications (see FS::cust_credit_refund and FS::cust_pay_refund).
replace OLD_RECORD
Modifying a refund? Well, don't say I didn't warn you.
check
Checks all fields to make sure this is a valid refund. If there is an error, returns the error, otherwise returns false. Called by the insert method.
cust_credit_refund
Returns all applications to credits (see FS::cust_credit_refund) for this refund.
cust_pay_refund
Returns all applications to payments (see FS::cust_pay_refund) for this refund.
unapplied
Returns the amount of this refund that is still unapplied; which is amount minus all credit applications (see FS::cust_credit_refund) and payment applications (see FS::cust_pay_refund).

CLASS METHODS

unapplied_sql
Returns an SQL fragment to retreive the unapplied amount.

BUGS

Delete and replace methods.

SEE ALSO

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