6 use FS::Record qw( qsearch qsearchs );
12 FS::reason - Object methods for reason records
18 $record = new FS::reason \%hash;
19 $record = new FS::reason { 'column' => 'value' };
21 $error = $record->insert;
23 $error = $new_record->replace($old_record);
25 $error = $record->delete;
27 $error = $record->check;
31 An FS::reason object represents a reason message. FS::reason inherits from
32 FS::Record. The following fields are currently supported:
36 =item reasonnum - primary key
38 =item reason_type - index into FS::reason_type
40 =item reason - text of the reason
42 =item disabled - 'Y' or ''
53 Creates a new reason. 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 { 'reason'; }
64 Adds this record to the database. If there is an error, returns the error,
65 otherwise returns false.
71 Delete this record from the database.
75 =item replace OLD_RECORD
77 Replaces the OLD_RECORD with this one in the database. If there is an error,
78 returns the error, otherwise returns false.
84 Checks all fields to make sure this is a valid reason. If there is
85 an error, returns the error, otherwise returns false. Called by the insert
94 $self->ut_numbern('reasonnum')
95 || $self->ut_text('reason')
97 return $error if $error;
104 Returns the reason_type (see <I>FS::reason_type</I>) associated with this reason.
109 qsearchs( 'reason_type', { 'typenum' => shift->reason_type } );
116 Here be termintes. Don't use on wooden computers.
120 L<FS::Record>, schema.html from the base documentation.