2 use base qw( FS::svc_Common );
5 #use FS::Record qw( qsearch qsearchs );
10 FS::svc_group - Object methods for svc_group records
16 $record = new FS::svc_group \%hash;
17 $record = new FS::svc_group { '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::svc_group object represents a group. FS::svc_group inherits from
36 FS::svc_Common. The following fields are currently supported:
40 =item max_accounts - Maximum number of group members
50 Creates a new group. To add the group 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 { 'svc_group'; }
62 'name_plural' => 'Groups', #optional,
63 'longname_plural' => 'Groups', #optional
64 'sorts' => 'svcnum', # optional sort field (or arrayref of sort fields, main first)
65 'display_weight' => 100,
66 'cancel_weight' => 100,
68 'svcnum' => { label => 'Service' },
70 'label' => 'Maximum number of accounts',
72 'disable_inventory' => 1,
79 =item search_sql STRING
81 Class method which returns an SQL fragment to search for the given string.
85 #if we only have a quantity, then there's nothing to search on
87 # my($class, $string) = @_;
88 # $class->search_sql_field('somefield', $string);
94 Returns a meaningful identifier for this group
100 $self->svcnum; #i guess?
105 Adds this record to the database. If there is an error, returns the error,
106 otherwise returns false.
108 The additional fields pkgnum and svcpart (see L<FS::cust_svc>) should be
109 defined. An FS::cust_svc record will be created and inserted.
117 # $error = $self->SUPER::insert;
118 # return $error if $error;
125 Delete this record from the database.
133 # $error = $self->SUPER::delete;
134 # return $error if $error;
140 =item replace OLD_RECORD
142 Replaces the OLD_RECORD with this one in the database. If there is an error,
143 returns the error, otherwise returns false.
148 # my ( $new, $old ) = ( shift, shift );
151 # $error = $new->SUPER::replace($old);
152 # return $error if $error;
159 Called by the suspend method of FS::cust_pkg (see L<FS::cust_pkg>).
163 Called by the unsuspend method of FS::cust_pkg (see L<FS::cust_pkg>).
167 Called by the cancel method of FS::cust_pkg (see L<FS::cust_pkg>).
171 Checks all fields to make sure this is a valid group. If there is
172 an error, returns the error, otherwise returns false. Called by the insert
180 my $x = $self->setfixed;
181 return $x unless ref($x);
184 my $error = $self->ut_numbern('svcnum')
185 || $self->ut_number('max_accounts');
186 return $error if $error;
197 L<FS::svc_Common>, L<FS::Record>, L<FS::cust_svc>, L<FS::part_svc>,
198 L<FS::cust_pkg>, schema.html from the base documentation.