Difference between revisions of "Freeside:3:Documentation:Developer/FS/svc External Common"

From Freeside
Jump to: navigation, search
m (Edit via perl MediaWiki framework (1.13))
m (Edit via perl MediaWiki framework (1.13))
 
Line 1: Line 1:
 
==NAME==
 
==NAME==
FS::svc_External_Common - Base class for svc_X classes which track external databases
+
FS::svc_external - Object methods for svc_external records
  
 
==SYNOPSIS==
 
==SYNOPSIS==
 
<code>
 
<code>
   package FS::svc_newservice;
+
   use FS::svc_external;
   use base qw( FS::svc_External_Common );
+
 +
  $record = new FS::svc_external \%hash;
 +
   $record = new FS::svc_external { 'column' => 'value' };
 +
 +
  $error = $record->insert;
 +
 +
  $error = $new_record->replace($old_record);
 +
 +
  $error = $record->delete;
 +
 +
  $error = $record->check;
 +
 +
  $error = $record->suspend;
 +
 +
  $error = $record->unsuspend;
 +
 +
  $error = $record->cancel;
 
</code>
 
</code>
 
==DESCRIPTION==
 
==DESCRIPTION==

Latest revision as of 11:05, 10 April 2015

NAME

FS::svc_external - Object methods for svc_external records

SYNOPSIS

 use FS::svc_external;

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

 $error = $record->insert;

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

 $error = $record->delete;

 $error = $record->check;

 $error = $record->suspend;

 $error = $record->unsuspend;

 $error = $record->cancel;

DESCRIPTION

FS::svc_External_Common is intended as a base class for table-specific classes to inherit from. FS::svc_External_Common is used for services which connect to externally tracked services via "id" and "table" fields.

FS::svc_External_Common inherits from FS::svc_Common.

The following fields are currently supported:

svcnum - primary key; id - unique number of external record; title - for invoice line items

METHODS

search_sql
Provides a default search_sql method which returns an SQL fragment to search the title field.
new HASHREF
Creates a new external service. To add the external service 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.
label
Returns a string identifying this external service in the form "id:title"
insert [ , OPTION => VALUE ... ]
Adds this external service to the database. If there is an error, returns the error, otherwise returns false.
The additional fields pkgnum and svcpart (see FS::cust_svc) should be defined. An FS::cust_svc record will be created and inserted.
Currently available options are: depend_jobnum
If depend_jobnum is set (to a scalar jobnum or an array reference of jobnums), all provisioning jobs will have a dependancy on the supplied jobnum(s) (they will not run until the specific job(s) complete(s)).
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.
suspend
Called by the suspend method of FS::cust_pkg (see FS::cust_pkg).
unsuspend
Called by the unsuspend method of FS::cust_pkg (see FS::cust_pkg).
cancel
Called by the cancel method of FS::cust_pkg (see FS::cust_pkg).
check
Checks all fields to make sure this is a valid external service. If there is an error, returns the error, otherwise returns false. Called by the insert and replace methods.

BUGS

SEE ALSO

FS::svc_Common, FS::Record, FS::cust_svc, FS::part_svc, FS::cust_pkg, schema.html from the base documentation.