1 package FS::svc_External_Common;
7 @ISA = qw( FS::svc_Common );
11 FS::svc_External_Common - Base class for svc_X classes which track external databases
15 package FS::svc_newservice;
16 use base qw( FS::svc_External_Common );
20 FS::svc_External_Common is intended as a base class for table-specific classes
21 to inherit from. FS::svc_External_Common is used for services which connect
22 to externally tracked services via "id" and "table" fields.
24 FS::svc_External_Common inherits from FS::svc_Common.
26 The following fields are currently supported:
30 =item svcnum - primary key
32 =item id - unique number of external record
34 =item title - for invoice line items
44 Provides a default search_sql method which returns an SQL fragment to search
50 my($class, $string) = @_;
51 $class->search_sql_field('title', $string);
56 Creates a new external service. To add the external service to the database,
59 Note that this stores the hash reference, not a distinct copy of the hash it
60 points to. You can ask the object for a copy with the I<hash> method.
66 Returns a string identifying this external service in the form "id:title"
72 $self->id. ':'. $self->title;
75 =item insert [ , OPTION => VALUE ... ]
77 Adds this external service to the database. If there is an error, returns the
78 error, otherwise returns false.
80 The additional fields pkgnum and svcpart (see L<FS::cust_svc>) should be
81 defined. An FS::cust_svc record will be created and inserted.
83 Currently available options are: I<depend_jobnum>
85 If I<depend_jobnum> is set (to a scalar jobnum or an array reference of
86 jobnums), all provisioning jobs will have a dependancy on the supplied
87 jobnum(s) (they will not run until the specific job(s) complete(s)).
95 # $error = $self->SUPER::insert(@_);
96 # return $error if $error;
103 Delete this record from the database.
111 # $error = $self->SUPER::delete;
112 # return $error if $error;
118 =item replace OLD_RECORD
120 Replaces the OLD_RECORD with this one in the database. If there is an error,
121 returns the error, otherwise returns false.
126 # my ( $new, $old ) = ( shift, shift );
129 # $error = $new->SUPER::replace($old);
130 # return $error if $error;
137 Called by the suspend method of FS::cust_pkg (see L<FS::cust_pkg>).
141 Called by the unsuspend method of FS::cust_pkg (see L<FS::cust_pkg>).
145 Called by the cancel method of FS::cust_pkg (see L<FS::cust_pkg>).
149 Checks all fields to make sure this is a valid external service. If there is
150 an error, returns the error, otherwise returns false. Called by the insert
158 my $x = $self->setfixed;
159 return $x unless ref($x);
163 $self->ut_numbern('svcnum')
164 || $self->ut_numbern('id')
165 || $self->ut_textn('title')
177 L<FS::svc_Common>, L<FS::Record>, L<FS::cust_svc>, L<FS::part_svc>,
178 L<FS::cust_pkg>, schema.html from the base documentation.