Difference between revisions of "Freeside:3:Documentation:Developer/FS/part export"
From Freeside
m (Edit via perl MediaWiki framework (1.13)) |
m (Edit via perl MediaWiki framework (1.13)) |
||
Line 35: | Line 35: | ||
; delete | ; delete | ||
:Delete this record from the database. | :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 | ; 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. | :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 | ; label | ||
:Returns a label for this export, "exportname||exportype (machine)". | :Returns a label for this export, "exportname||exportype (machine)". | ||
+ | ; label_html | ||
+ | :Returns a label for this export, "exportname: exporttype to machine". | ||
; svc_x | ; svc_x | ||
:Returns a list of associated FS::svc_* records. | :Returns a list of associated FS::svc_* records. | ||
; cust_svc | ; cust_svc | ||
:Returns a list of associated FS::cust_svc records. | :Returns a list of associated FS::cust_svc records. | ||
+ | ; part_export_machine | ||
+ | :Returns all machines as FS::part_export_machine objects (see [[Freeside:3:Documentation:Developer/FS/part export machine|FS::part_export_machine]]). | ||
; export_svc | ; export_svc | ||
:Returns a list of associated FS::export_svc records. | :Returns a list of associated FS::export_svc records. | ||
Line 55: | Line 63: | ||
; _rebless | ; _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|"NEW EXPORT CLASSES"]]. | :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|"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 | ; 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. | :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. | ||
Line 61: | Line 73: | ||
: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). | :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 | ; weight | ||
:Returns the 'weight' element from the export's %info hash, or 0 if there is no weight defined. | :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. | ||
==SUBROUTINES== | ==SUBROUTINES== | ||
Line 91: | Line 107: | ||
Hey! '''The above document had some coding errors, which are explained below:''' | Hey! '''The above document had some coding errors, which are explained below:''' | ||
− | ; Around line | + | ; Around line 81: |
+ | :=cut found outside a pod block. Skipping to next block. | ||
+ | ; Around line 670: | ||
:=cut found outside a pod block. Skipping to next block. | :=cut found outside a pod block. Skipping to next block. |
Revision as of 13:36, 27 June 2014
Contents
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.
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 81:
- =cut found outside a pod block. Skipping to next block.
- Around line 670:
- =cut found outside a pod block. Skipping to next block.