4 use base qw( FS::svc_External_Common );
5 #use FS::Record qw( qsearch qsearchs );
10 FS::svc_pbx - Object methods for svc_pbx records
16 $record = new FS::svc_pbx \%hash;
17 $record = new FS::svc_pbx { 'column' => 'value' };
19 $error = $record->insert;
21 $error = $new_record->replace($old_record);
23 $error = $record->delete;
25 $error = $record->check;
27 $error = $record->suspend;
29 $error = $record->unsuspend;
31 $error = $record->cancel;
35 An FS::svc_pbx object represents a PBX tenant. FS::svc_pbx inherits from
36 FS::svc_Common. The following fields are currently supported:
40 =item field - description
50 Creates a new PBX tenant. To add the PBX tenant to the database, see
53 Note that this stores the hash reference, not a distinct copy of the hash it
54 points to. You can ask the object for a copy with the I<hash> method.
58 sub table { 'svc_pbx'; }
63 'name_plural' => 'PBXs', #optional,
64 'longname_plural' => 'PBXs', #optional
65 'sorts' => 'svcnum', # optional sort field (or arrayref of sort fields, main first)
66 'display_weight' => 70,
67 'cancel_weight' => 90,
69 'id' => 'Thirdlane ID',
70 'title' => 'Description',
71 'max_extensions' => 'Maximum number of User Extensions',
72 # 'field' => 'Description',
73 # 'another_field' => {
74 # 'label' => 'Description',
75 # 'def_label' => 'Description for service definitions',
77 # 'disable_default' => 1, #disable switches
78 # 'disable_fixed' => 1, #
79 # 'disable_inventory' => 1, #
82 # 'label' => 'Description',
83 # 'def_label' => 'Description for service defs',
85 # 'select_table' => 'foreign_table',
86 # 'select_key' => 'key_field_in_table',
87 # 'select_label' => 'label_field_in_table',
94 =item search_sql STRING
96 Class method which returns an SQL fragment to search for the given string.
101 #or something more complicated if necessary
103 # my($class, $string) = @_;
104 # $class->search_sql_field('title', $string);
109 Returns a meaningful identifier for this PBX tenant.
115 $self->label_field; #or something more complicated if necessary
120 Adds this record to the database. If there is an error, returns the error,
121 otherwise returns false.
123 The additional fields pkgnum and svcpart (see L<FS::cust_svc>) should be
124 defined. An FS::cust_svc record will be created and inserted.
132 $error = $self->SUPER::insert;
133 return $error if $error;
140 Delete this record from the database.
148 $error = $self->SUPER::delete;
149 return $error if $error;
155 =item replace OLD_RECORD
157 Replaces the OLD_RECORD with this one in the database. If there is an error,
158 returns the error, otherwise returns false.
163 my ( $new, $old ) = ( shift, shift );
166 $error = $new->SUPER::replace($old);
167 return $error if $error;
174 Called by the suspend method of FS::cust_pkg (see L<FS::cust_pkg>).
178 Called by the unsuspend method of FS::cust_pkg (see L<FS::cust_pkg>).
182 Called by the cancel method of FS::cust_pkg (see L<FS::cust_pkg>).
186 Checks all fields to make sure this is a valid PBX tenant. If there is
187 an error, returns the error, otherwise returns false. Called by the insert
195 my $x = $self->setfixed;
196 return $x unless ref($x);
209 L<FS::svc_Common>, L<FS::Record>, L<FS::cust_svc>, L<FS::part_svc>,
210 L<FS::cust_pkg>, schema.html from the base documentation.