1 package FS::reason_type;
5 use FS::Record qw( qsearch qsearchs );
11 FS::reason_type - Object methods for reason_type records
17 $record = new FS::reason_type \%hash;
18 $record = new FS::reason_type { 'column' => 'value' };
20 $error = $record->insert;
22 $error = $new_record->replace($old_record);
24 $error = $record->delete;
26 $error = $record->check;
30 An FS::reason_type object represents a grouping of reasons. FS::reason_type
31 inherits from FS::Record. The following fields are currently supported:
35 =item typenum - primary key
37 =item class - currently 'C' or 'S' for cancel or suspend
39 =item type - name of the type of reason
50 Creates a new reason_type. 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 { 'reason_type'; }
61 Adds this record to the database. If there is an error, returns the error,
62 otherwise returns false.
68 Delete this record from the database.
72 =item replace OLD_RECORD
74 Replaces the OLD_RECORD with this one in the database. If there is an error,
75 returns the error, otherwise returns false.
81 Checks all fields to make sure this is a valid reason_type. If there is
82 an error, returns the error, otherwise returns false. Called by the insert
91 $self->ut_numbern('typenum')
92 || $self->ut_enum('class', [ 'C', 'S' ] )
93 || $self->ut_text('type')
95 return $error if $error;
102 Returns a list of all reasons associated with this type.
107 qsearch( 'reason', { 'reason_type' => shift->typenum } );
110 =item enabled_reasons
112 Returns a list of enabled reasons associated with this type.
116 sub enabled_reasons {
117 qsearch( 'reason', { 'reason_type' => shift->typenum,
126 Here be termintes. Don't use on wooden computers.
130 L<FS::Record>, schema.html from the base documentation.