4 use base qw( FS::svc_Common );
5 #use FS::Record qw( qsearch qsearchs );
10 FS::table_name - Object methods for table_name records
16 $record = new FS::table_name \%hash;
17 $record = new FS::table_name { '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::table_name object represents an example. FS::table_name inherits from
36 FS::svc_Common. The following fields are currently supported:
40 =item field - description
50 Creates a new example. To add the example to the database, see L<"insert">.
52 Note that this stores the hash reference, not a distinct copy of the hash it
53 points to. You can ask the object for a copy with the I<hash> method.
57 sub table { 'table_name'; }
62 'name_plural' => 'Example services', #optional,
63 'longname_plural' => 'Example services', #optional
64 'sorts' => 'svcnum', # optional sort field (or arrayref of sort fields, main first)
65 'display_weight' => 100,
66 'cancel_weight' => 100,
68 'field' => 'Description',
70 'label' => 'Description',
71 'def_label' => 'Description for service definitions',
73 'disable_default' => 1, #disable switches
74 'disable_fixed' => 1, #
75 'disable_inventory' => 1, #
76 'disable_select' => 1, #
79 'label' => 'Description',
80 'def_label' => 'Description for service defs',
82 'select_table' => 'foreign_table',
83 'select_key' => 'key_field_in_table',
84 'select_label' => 'label_field_in_table',
91 =item search_sql STRING
93 Class method which returns an SQL fragment to search for the given string.
97 #or something more complicated if necessary
99 my($class, $string) = @_;
100 $class->search_sql_field('search_field', $string);
105 Returns a meaningful identifier for this example
111 $self->label_field; #or something more complicated if necessary
116 Adds this record to the database. If there is an error, returns the error,
117 otherwise returns false.
119 The additional fields pkgnum and svcpart (see L<FS::cust_svc>) should be
120 defined. An FS::cust_svc record will be created and inserted.
128 $error = $self->SUPER::insert;
129 return $error if $error;
136 Delete this record from the database.
144 $error = $self->SUPER::delete;
145 return $error if $error;
151 =item replace OLD_RECORD
153 Replaces the OLD_RECORD with this one in the database. If there is an error,
154 returns the error, otherwise returns false.
159 my ( $new, $old ) = ( shift, shift );
162 $error = $new->SUPER::replace($old);
163 return $error if $error;
170 Called by the suspend method of FS::cust_pkg (see L<FS::cust_pkg>).
174 Called by the unsuspend method of FS::cust_pkg (see L<FS::cust_pkg>).
178 Called by the cancel method of FS::cust_pkg (see L<FS::cust_pkg>).
182 Checks all fields to make sure this is a valid example. If there is
183 an error, returns the error, otherwise returns false. Called by the insert
191 my $x = $self->setfixed;
192 return $x unless ref($x);
203 The author forgot to customize this manpage.
207 L<FS::svc_Common>, L<FS::Record>, L<FS::cust_svc>, L<FS::part_svc>,
208 L<FS::cust_pkg>, schema.html from the base documentation.