Difference between revisions of "Freeside:1.9:Documentation:Developer/FS/acct rt transaction"

From Freeside
Jump to: navigation, search
(import from POD)
(import from POD)
Line 23: Line 23:
 
==METHODS==
 
==METHODS==
 
; new HASHREF
 
; new HASHREF
:Creates a new acct_rt_transaction. To add the example to the database, see [[Freeside:1.9:Documentation:Developer/#insert|"insert"|#insert|"insert"]].
+
:Creates a new acct_rt_transaction. To add the example to the database, see [[#insert|"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.
 
: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.

Revision as of 16:22, 3 October 2007

NAME

FS::acct_rt_transaction - Object methods for acct_rt_transaction records

SYNOPSIS

 use FS::acct_rt_transaction;

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

 $error = $record->insert;

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

 $error = $record->delete;

 $error = $record->check;

DESCRIPTION

An FS::acct_rt_transaction object represents an application of time from a rt transaction to a svc_acct. FS::acct_rt_transaction inherits from FS::Record. The following fields are currently supported:

svcrtid - primary key; svcnum - the svcnum of the svc_acct to which the time applies; transaction_id - the id of the rt transtaction from which the time applies; seconds - the amount of time which applies

METHODS

new HASHREF
Creates a new acct_rt_transaction. 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 acct_rt_transaction. If there is an error, returns the error, otherwise returns false. Called by the insert and replace methods.
batch_insert SVC_ACCT_RT_TRANSACTION_OBJECT, ...
Class method which inserts multiple time applications. Takes a list of FS::acct_rt_transaction objects. If there is an error inserting any application, the entire transaction is rolled back, i.e. all time is applied or none is.
For example:

 my $errors = FS::acct_rt_transaction->batch_insert(@transactions);
 if ( $error ) {
   #success; all payments were inserted
 } else {
   #failure; no payments were inserted.
 }

BUGS

Possibly the delete method or others.

SEE ALSO

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