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

From Freeside
Jump to: navigation, search
m (Edit via perl MediaWiki framework (1.13))
m (Edit via perl MediaWiki framework (1.13))
Line 98: Line 98:
 
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 920:
+
; Around line 927:
 
:You forgot a '=back' before '=head1'
 
:You forgot a '=back' before '=head1'

Revision as of 08:43, 24 March 2015

NAME

FS::part_svc - Object methods for part_svc objects

SYNOPSIS

 use FS::part_svc;

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

 $error = $record->insert;
 $error = $record->insert( [ 'pseudofield' ] );
 $error = $record->insert( [ 'pseudofield' ], \%exportnums );

 $error = $new_record->replace($old_record);
 $error = $new_record->replace($old_record, '1.3-COMPAT', [ 'pseudofield' ] );
 $error = $new_record->replace($old_record, '1.3-COMPAT', [ 'pseudofield' ], \%exportnums );

 $error = $record->delete;

 $error = $record->check;

DESCRIPTION

An FS::part_svc represents a service definition. FS::part_svc inherits from FS::Record. The following fields are currently supported:

svcpart - primary key (assigned automatically for new service definitions); svc - text name of this service definition; svcdb - table used for this service. See FS::svc_acct, FS::svc_domain, and FS::svc_forward, among others.; classnum - Optional service class (see FS::svc_class); disabled - Disabled flag, empty or `Y'; preserve - Preserve after cancellation, empty or 'Y'; selfservice_access - Access allowed to the service via self-service: empty for full access, "readonly" for read-only, "hidden" to hide it entirely; restrict_edit_password - Require the "Provision customer service" access right to change the password field, rather than just "Edit password". Only relevant to svc_acct for now.; has_router - Allow the service to have an FS::router connected through it. Probably only relevant to svc_broadband, svc_acct, and svc_dsl for now.

METHODS

new HASHREF
Creates a new service definition. To add the service definition to the database, see "insert".
insert [ EXTRA_FIELDS_ARRAYREF [ , EXPORTNUMS_HASHREF [ , JOB ] ] ]
Adds this service definition to the database. If there is an error, returns the error, otherwise returns false.
The following pseudo-fields may be defined, and will be maintained in the part_svc_column table appropriately (see FS::part_svc_column).
svcdb__field - Default or fixed value for field in svcdb.
; svcdb__field_flag - defines svcdb__field action: null or empty (no default), `D' for default, `F' for fixed (unchangeable), , `S' for selectable choice, `M' for manual selection from inventory, or `A' for automatic selection from inventory. For virtual fields, can also be 'X' for excluded.
If you want to add part_svc_column records for fields that do not exist as fields in the svcdb table, make sure to list then in EXTRA_FIELDS_ARRAYREF also.
If EXPORTNUMS_HASHREF is specified (keys are exportnums and values are boolean), the appopriate export_svc records will be inserted.
TODOC: JOB
delete
Currently unimplemented. Set the "disabled" field instead.
replace OLD_RECORD [ '1.3-COMPAT' [ , EXTRA_FIELDS_ARRAYREF [ , EXPORTNUMS_HASHREF [ , JOB ] ] ] ]
Replaces OLD_RECORD with this one in the database. If there is an error, returns the error, otherwise returns false.
TODOC: 1.3-COMPAT
TODOC: EXTRA_FIELDS_ARRAYREF (same as insert method)
TODOC: JOB
check
Checks all fields to make sure this is a valid service definition. If there is an error, returns the error, otherwise returns false. Called by the insert and replace methods.
part_svc_column COLUMNNAME
Returns the part_svc_column object (see FS::part_svc_column) for the given COLUMNNAME, or a new part_svc_column object if none exists.
all_part_svc_column; part_export [ EXPORTTYPE ]
Returns a list of all exports (see FS::part_export) for this service, or, if an export type is specified, only returns exports of the given type.
part_export_usage
Returns a list of any exports (see FS::part_export) for this service that are capable of reporting usage information.
part_export_did
Returns a list of any exports (see FS::part_export) for this service that are capable of returing available DID (phone number) information.
part_export_dsl_pull
Returns a list of any exports (see FS::part_export) for this service that are capable of pulling/pushing DSL orders.
cust_svc [ PKGPART ]
Returns a list of associated customer services (FS::cust_svc records).
If a PKGPART is specified, returns the customer services which are contained within packages of that type (see FS::part_pkg). If PKGPARTis specified as 0, returns unlinked customer services.
num_cust_svc [ PKGPART ]
Returns the number of associated customer services (FS::cust_svc records).
If a PKGPART is specified, returns the number of customer services which are contained within packages of that type (see FS::part_pkg). If PKGPART is specified as 0, returns the number of unlinked customer services.
svc_x
Returns a list of associated FS::svc_* records.

CLASS METHODS

svc_tables
Returns a list of all svc_ tables.
svc_table_fields TABLE
Given a table name, returns a hashref of field names. The field names returned are those with additional (service-definition related) information, not necessarily all database fields of the table. Pseudo-fields may also be returned (i.e. svc_acct.usergroup).
Each value of the hashref is another hashref, which can have one or more of the following keys:
label - Description of the field
; def_label - Optional description of the field in the context of service definitions:; type - Currently "text", "select", "checkbox", "textarea", "disabled", some components specified by "select-.*.html", and a bunch more...:; disable_default - This field should not allow a default value in service definitions:; disable_fixed - This field should not allow a fixed value in service definitions:; disable_inventory - This field should not allow inventory values in service definitions:; select_list - If type is "text", this can be a listref of possible values.:; select_table - An alternative to select_list, this defines a database table with the possible choices.:; select_key - Used with select_table, this is the field name of keys:; select_label - Used with select_table, this is the field name of labels:; select_allow_empty - Used with select_table, adds an empty option

SUBROUTINES

process
Job-queue processor for web interface adds/edits
process_bulk_cust_svc
Job-queue processor for web interface bulk customer service changes

BUGS

Delete is unimplemented.

The list of svc_* tables is no longer hardcoded, but svc_acct_pop is skipped as a special case until it is renamed.

all_part_svc_column methods should be documented

SEE ALSO

FS::Record, FS::part_svc_column, FS::part_pkg, FS::pkg_svc, FS::cust_svc, FS::svc_acct, FS::svc_forward, FS::svc_domain, schema.html from the base documentation.

POD ERRORS

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

Around line 927:
You forgot a '=back' before '=head1'