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

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

Latest revision as of 07:16, 18 November 2015

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 applied from tickets
support
The amount of time applied to support services

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.
creator
Returns the creator of the RT transaction associated with this object.
ticketid
Returns the number of the RT ticket associated with this object.
subject
Returns the subject of the RT ticket associated with this object.
status
Returns the status of the RT ticket associated with this object.
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.