5 #use FS::Record qw( qsearch qsearchs );
9 @ISA = qw(FS::svc_Common);
13 FS::table_name - Object methods for table_name records
19 $record = new FS::table_name \%hash;
20 $record = new FS::table_name { 'column' => 'value' };
22 $error = $record->insert;
24 $error = $new_record->replace($old_record);
26 $error = $record->delete;
28 $error = $record->check;
30 $error = $record->suspend;
32 $error = $record->unsuspend;
34 $error = $record->cancel;
38 An FS::table_name object represents an example. FS::table_name inherits from
39 FS::svc_Common. The following fields are currently supported:
43 =item field - description
53 Creates a new example. To add the example to the database, see L<"insert">.
55 Note that this stores the hash reference, not a distinct copy of the hash it
56 points to. You can ask the object for a copy with the I<hash> method.
60 sub table { 'table_name'; }
65 'name_plural' => 'Example services', #optional,
66 'longname_plural' => 'Example services', #optional
67 'sorts' => 'svcnum', # optional sort field (or arrayref of sort fields, main first)
68 'display_weight' => 100,
69 'cancel_weight' => 100,
71 'field' => 'Description',
73 'label' => 'Description',
74 'def_label' => 'Description for service definitions',
76 'disable_default' => 1, #disable switches
77 'disable_fixed' => 1, #
78 'disable_inventory' => 1, #
81 'label' => 'Description',
82 'def_label' => 'Description for service defs',
84 'select_table' => 'foreign_table',
85 'select_key' => 'key_field_in_table',
86 'select_label' => 'label_field_in_table',
93 =item search_sql STRING
95 Class method which returns an SQL fragment to search for the given string.
99 #or something more complicated if necessary
101 my($class, $string) = @_;
102 $class->search_sql_field('search_field', $string);
107 Returns a meaningful identifier for this example
113 $self->label_field; #or something more complicated if necessary
118 Adds this record to the database. If there is an error, returns the error,
119 otherwise returns false.
121 The additional fields pkgnum and svcpart (see L<FS::cust_svc>) should be
122 defined. An FS::cust_svc record will be created and inserted.
130 $error = $self->SUPER::insert;
131 return $error if $error;
138 Delete this record from the database.
146 $error = $self->SUPER::delete;
147 return $error if $error;
153 =item replace OLD_RECORD
155 Replaces the OLD_RECORD with this one in the database. If there is an error,
156 returns the error, otherwise returns false.
161 my ( $new, $old ) = ( shift, shift );
164 $error = $new->SUPER::replace($old);
165 return $error if $error;
172 Called by the suspend method of FS::cust_pkg (see L<FS::cust_pkg>).
176 Called by the unsuspend method of FS::cust_pkg (see L<FS::cust_pkg>).
180 Called by the cancel method of FS::cust_pkg (see L<FS::cust_pkg>).
184 Checks all fields to make sure this is a valid example. If there is
185 an error, returns the error, otherwise returns false. Called by the insert
193 my $x = $self->setfixed;
194 return $x unless ref($x);
205 The author forgot to customize this manpage.
209 L<FS::svc_Common>, L<FS::Record>, L<FS::cust_svc>, L<FS::part_svc>,
210 L<FS::cust_pkg>, schema.html from the base documentation.