1 package FS::svc_External_Common;
7 @ISA = qw( FS::svc_Common );
11 FS::svc_external - Object methods for svc_external records
17 $record = new FS::svc_external \%hash;
18 $record = new FS::svc_external { 'column' => 'value' };
20 $error = $record->insert;
22 $error = $new_record->replace($old_record);
24 $error = $record->delete;
26 $error = $record->check;
28 $error = $record->suspend;
30 $error = $record->unsuspend;
32 $error = $record->cancel;
36 FS::svc_External_Common is intended as a base class for table-specific classes
37 to inherit from. FS::svc_External_Common is used for services which connect
38 to externally tracked services via "id" and "table" fields.
40 FS::svc_External_Common inherits from FS::svc_Common.
42 The following fields are currently supported:
46 =item svcnum - primary key
48 =item id - unique number of external record
50 =item title - for invoice line items
60 Provides a default search_sql method which returns an SQL fragment to search
66 my($class, $string) = @_;
67 $class->search_sql_field('title', $string);
72 Creates a new external service. To add the external service to the database,
75 Note that this stores the hash reference, not a distinct copy of the hash it
76 points to. You can ask the object for a copy with the I<hash> method.
82 Returns a string identifying this external service in the form "id:title"
88 $self->id. ':'. $self->title;
91 =item insert [ , OPTION => VALUE ... ]
93 Adds this external service to the database. If there is an error, returns the
94 error, otherwise returns false.
96 The additional fields pkgnum and svcpart (see L<FS::cust_svc>) should be
97 defined. An FS::cust_svc record will be created and inserted.
99 Currently available options are: I<depend_jobnum>
101 If I<depend_jobnum> is set (to a scalar jobnum or an array reference of
102 jobnums), all provisioning jobs will have a dependancy on the supplied
103 jobnum(s) (they will not run until the specific job(s) complete(s)).
111 # $error = $self->SUPER::insert(@_);
112 # return $error if $error;
119 Delete this record from the database.
127 # $error = $self->SUPER::delete;
128 # return $error if $error;
134 =item replace OLD_RECORD
136 Replaces the OLD_RECORD with this one in the database. If there is an error,
137 returns the error, otherwise returns false.
142 # my ( $new, $old ) = ( shift, shift );
145 # $error = $new->SUPER::replace($old);
146 # return $error if $error;
153 Called by the suspend method of FS::cust_pkg (see L<FS::cust_pkg>).
157 Called by the unsuspend method of FS::cust_pkg (see L<FS::cust_pkg>).
161 Called by the cancel method of FS::cust_pkg (see L<FS::cust_pkg>).
165 Checks all fields to make sure this is a valid external service. If there is
166 an error, returns the error, otherwise returns false. Called by the insert
174 my $x = $self->setfixed;
175 return $x unless ref($x);
179 $self->ut_numbern('svcnum')
180 || $self->ut_numbern('id')
181 || $self->ut_textn('title')
193 L<FS::svc_Common>, L<FS::Record>, L<FS::cust_svc>, L<FS::part_svc>,
194 L<FS::cust_pkg>, schema.html from the base documentation.