<% include( '/elements/header.html', 'Developer Documentation' ) %> <& /elements/menubar.html, 'Freeside Perl Modules' => $fsurl.'docs/library/FS.html', 'Complete Index' => $fsurl.'docs/library/index.html', &>

FS::part_svc

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::part_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_label
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.
svcdb__field_required - field should always have a true value

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.

part_export_partsvc

Returns a list of any exports (see FS::part_export) for this service that are capable of pushing a change after part svc is changed.

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.

num_cust_svc_cancelled

Returns the number of associated customer services that are attached to cancelled packages.

svc_x

Returns a list of associated FS::svc_* records.

svc_locale LOCALE

Returns a customer-viewable service definition label in the chosen LOCALE. If there is no entry for that locale or if LOCALE is empty, returns part_svc.svc.

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
required - This field should always have a true value (do not use with type checkbox or disabled)
svc_table_info TABLE

Returns table_info for TABLE from cache, or empty hashref if none is found.

Caution: caches table_info for ALL services when run; access a service's table_info directly unless you know you're loading them all.

Caution: does not standardize fields into hashrefs; use "svc_table_fields" to access fields.

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 1055:

You forgot a '=back' before '=head1'

<% include ('/elements/footer.html' ) %>