1 package FS::svc_external;
6 use FS::svc_External_Common;
8 @ISA = qw( FS::svc_External_Common );
12 FS::svc_external - Object methods for svc_external records
18 $record = new FS::svc_external \%hash;
19 $record = new FS::svc_external { 'column' => 'value' };
21 $error = $record->insert;
23 $error = $new_record->replace($old_record);
25 $error = $record->delete;
27 $error = $record->check;
29 $error = $record->suspend;
31 $error = $record->unsuspend;
33 $error = $record->cancel;
37 An FS::svc_external object represents a generic externally tracked service.
38 FS::svc_external inherits from FS::svc_External_Common (and FS::svc_Common).
39 The following fields are currently supported:
43 =item svcnum - primary key
45 =item id - unique number of external record
47 =item title - for invoice line items
57 Creates a new external service. To add the external service to the database,
60 Note that this stores the hash reference, not a distinct copy of the hash it
61 points to. You can ask the object for a copy with the I<hash> method.
67 'name' => 'External service',
69 'display_weight' => 90,
70 'cancel_weight' => 10,
72 'id' => { label => 'Unique number of external record',
77 'title' => { label => 'Printed on invoice line items',
79 #disable_inventory => 1,
85 sub table { 'svc_external'; }
87 # oh! this should be moved to svc_artera_turbo or something now
90 my $conf = new FS::Conf;
91 if ( $conf->exists('svc_external-display_type')
92 && $conf->config('svc_external-display_type') eq 'artera_turbo' )
94 sprintf('%010d', $self->id). '-'.
95 substr('0000000000'.uc($self->title), -10);
98 return $self->id unless $self->title =~ /\S/;
99 $self->id. ' - '. $self->title;
103 =item insert [ , OPTION => VALUE ... ]
105 Adds this external service to the database. If there is an error, returns the
106 error, otherwise returns false.
108 The additional fields pkgnum and svcpart (see L<FS::cust_svc>) should be
109 defined. An FS::cust_svc record will be created and inserted.
111 Currently available options are: I<depend_jobnum>
113 If I<depend_jobnum> is set (to a scalar jobnum or an array reference of
114 jobnums), all provisioning jobs will have a dependancy on the supplied
115 jobnum(s) (they will not run until the specific job(s) complete(s)).
123 # $error = $self->SUPER::insert(@_);
124 # return $error if $error;
131 Delete this record from the database.
139 # $error = $self->SUPER::delete;
140 # return $error if $error;
146 =item replace OLD_RECORD
148 Replaces the OLD_RECORD with this one in the database. If there is an error,
149 returns the error, otherwise returns false.
154 # my ( $new, $old ) = ( shift, shift );
157 # $error = $new->SUPER::replace($old);
158 # return $error if $error;
165 Called by the suspend method of FS::cust_pkg (see L<FS::cust_pkg>).
169 Called by the unsuspend method of FS::cust_pkg (see L<FS::cust_pkg>).
173 Called by the cancel method of FS::cust_pkg (see L<FS::cust_pkg>).
177 Checks all fields to make sure this is a valid external service. If there is
178 an error, returns the error, otherwise returns false. Called by the insert
187 # $error = $self->SUPER::delete;
188 # return $error if $error;
199 L<FS::svc_External_Common>, L<FS::svc_Common>, L<FS::Record>, L<FS::cust_svc>,
200 L<FS::part_svc>, L<FS::cust_pkg>, schema.html from the base documentation.