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, #
78 'label' => 'Description',
79 'def_label' => 'Description for service defs',
81 'select_table' => 'foreign_table',
82 'select_key' => 'key_field_in_table',
83 'select_label' => 'label_field_in_table',
90 =item search_sql STRING
92 Class method which returns an SQL fragment to search for the given string.
96 #or something more complicated if necessary
98 my($class, $string) = @_;
99 $class->search_sql_field('search_field', $string);
104 Returns a meaningful identifier for this example
110 $self->label_field; #or something more complicated if necessary
115 Adds this record to the database. If there is an error, returns the error,
116 otherwise returns false.
118 The additional fields pkgnum and svcpart (see L<FS::cust_svc>) should be
119 defined. An FS::cust_svc record will be created and inserted.
127 $error = $self->SUPER::insert;
128 return $error if $error;
135 Delete this record from the database.
143 $error = $self->SUPER::delete;
144 return $error if $error;
150 =item replace OLD_RECORD
152 Replaces the OLD_RECORD with this one in the database. If there is an error,
153 returns the error, otherwise returns false.
158 my ( $new, $old ) = ( shift, shift );
161 $error = $new->SUPER::replace($old);
162 return $error if $error;
169 Called by the suspend method of FS::cust_pkg (see L<FS::cust_pkg>).
173 Called by the unsuspend method of FS::cust_pkg (see L<FS::cust_pkg>).
177 Called by the cancel method of FS::cust_pkg (see L<FS::cust_pkg>).
181 Checks all fields to make sure this is a valid example. If there is
182 an error, returns the error, otherwise returns false. Called by the insert
190 my $x = $self->setfixed;
191 return $x unless ref($x);
202 The author forgot to customize this manpage.
206 L<FS::svc_Common>, L<FS::Record>, L<FS::cust_svc>, L<FS::part_svc>,
207 L<FS::cust_pkg>, schema.html from the base documentation.