Difference between revisions of "Freeside:4:Documentation:Developer/FS/part export"

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

Latest revision as of 07:25, 18 November 2015

NAME

FS::part_export - Object methods for part_export records

SYNOPSIS

 use FS::part_export;

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

 #($new_record, $options) = $template_recored->clone( $svcpart );

 $error = $record->insert( { 'option' => 'value' } );
 $error = $record->insert( \%options );

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

 $error = $record->delete;

 $error = $record->check;

DESCRIPTION

An FS::part_export object represents an export of Freeside data to an external provisioning system. FS::part_export inherits from FS::Record. The following fields are currently supported:

exportnum - primary key; exportname - Descriptive name; machine - Machine name; exporttype - Export type; nodomain - blank or "Y" : usernames are exported to this service with no domain

METHODS

new HASHREF
Creates a new export. To add the export 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 HASHREF
Adds this record to the database. If there is an error, returns the error, otherwise returns false.
If a hash reference of options is supplied, part_export_option records are created (see FS::part_export_option).
delete
Delete this record from the database.
replace [ OLD_RECORD ] [ HASHREF | OPTION => VALUE ... ]
Replaces the OLD_RECORD with this one in the database. If there is an error, returns the error, otherwise returns false.
If a list or hash reference of options is supplied, option records are created or modified.
check
Checks all fields to make sure this is a valid export. If there is an error, returns the error, otherwise returns false. Called by the insert and replace methods.
label
Returns a label for this export, "exportname||exportype (machine)".
label_html
Returns a label for this export, "exportname: exporttype to machine".
svc_x
Returns a list of associated FS::svc_* records.
cust_svc
Returns a list of associated FS::cust_svc records.
part_export_machine
Returns all machines as FS::part_export_machine objects (see FS::part_export_machine).
export_svc
Returns a list of associated FS::export_svc records.
export_device
Returns a list of associated FS::export_device records.
part_export_option
Returns all options as FS::part_export_option objects (see FS::part_export_option).
options
Returns a list of option names and values suitable for assigning to a hash.
option OPTIONNAME
Returns the option value for the given name, or the empty string.
_rebless
Reblesses the object into the FS::part_export::EXPORTTYPE class, where EXPORTTYPE is the object's exporttype field. There should be better docs on how to create new exports, but until then, see "NEW EXPORT CLASSES".
svc_machine SVC_X
Return the export hostname for SVC_X.
default_export_machine
Return the default export hostname for this export.
export_insert SVC_OBJECT; export_replace NEW OLD; export_delete; export_suspend; export_unsuspend; export_links SVC_OBJECT ARRAYREF
Adds a list of web elements to ARRAYREF specific to this export and SVC_OBJECT. The elements are displayed in the UI to lead the the operator to external configuration, monitoring, and similar tools.
export_getsettings SVC_OBJECT SETTINGS_HASHREF DEFAUTS_HASHREF
Adds a hashref of settings to SETTINGSREF specific to this export and SVC_OBJECT. The elements can be displayed in the UI on the service view.
DEFAULTSREF is a hashref with the same keys where true values indicate the setting is a default (and thus can be displayed in the UI with less emphasis, or hidden by default).
actions
Adds one or more "action" links to the export's display in browse/part_export.cgi. Should return pairs of values. The first is the link label; the second is the Mason path to a document to load. The document will show in a popup.
weight
Returns the 'weight' element from the export's %info hash, or 0 if there is no weight defined.
info
Returns a reference to (a copy of) the export's %info hash.
get_dids SELECTION
Does several things, which is unfortunate. DID phone numbers are organized in a sort-of hierarchy: state, areacode, exchange, number. Or, for some vendors: state, region, number. But not always that, either.
SELECTION is one or more field/value pairs specifying parts of the hierarchy that have already been selected. get_dids will then return an arrayref of the possible values for the next selection level. Note that these are not actual DIDs except at the lowest level.
Generally, 'state' alone will return an array of area codes or region names in the state.
'state' and 'areacode' together will return an array of exchanges (NXX prefixes), or for some exports, an array of ratecenter names.
'areacode' and 'exchange', or 'state' and 'ratecenter', or 'region' by itself will return an array of actual DID numbers.
Passing 'tollfree' with a true value will override the whole hierarchy and return an array of tollfree numbers.
svc_role SVC
Returns the role that SVC occupies with respect to this export, if any. This is part of the part_svc's export configuration.
svc_with_role { SVC | PKGNUM }, ROLE
Given a svc_* object SVC or pkgnum PKG, and a role name ROLE, finds the service(s) in the same package that are linked to this export with ROLE.

SUBROUTINES

export_info [ SVCDB ]
Returns a hash reference of the exports for the given svcdb, or if no svcdb is specified, for all exports. The keys of the hash are exporttypes and the values are again hash references containing information on the export:

 'desc'     => 'Description',
 'options'  => {
                 'option'  => { label=>'Option Label' },
                 'option2' => { label=>'Another label' },
               },
 'nodomain' => 'Y', #or ''
 'notes'    => 'Additional notes',

NEW EXPORT CLASSES

A module should be added in FS/FS/part_export/ (an example may be found in eg/export_template.pm)

BUGS

Hmm... cust_export class (not necessarily a database table...) ... ?

deprecated column...

SEE ALSO

FS::part_export_option, FS::export_svc, FS::svc_acct, FS::svc_domain, FS::svc_forward, FS::Record, schema.html from the base documentation.

POD ERRORS

Hey! The above document had some coding errors, which are explained below:

Around line 80:
=cut found outside a pod block. Skipping to next block.
Around line 659:
=cut found outside a pod block. Skipping to next block.