5 use FS::Record qw( qsearch qsearchs );
11 FS::reason - Object methods for reason records
17 $record = new FS::reason \%hash;
18 $record = new FS::reason { '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 object represents a reason message. FS::reason inherits from
31 FS::Record. The following fields are currently supported:
35 =item reasonnum - primary key
37 =item reason_type - index into FS::reason_type
39 =item reason - text of the reason
41 =item disabled - 'Y' or ''
52 Creates a new reason. To add the example to the database, see L<"insert">.
54 Note that this stores the hash reference, not a distinct copy of the hash it
55 points to. You can ask the object for a copy with the I<hash> method.
59 sub table { 'reason'; }
63 Adds this record to the database. If there is an error, returns the error,
64 otherwise returns false.
70 Delete this record from the database.
74 =item replace OLD_RECORD
76 Replaces the OLD_RECORD with this one in the database. If there is an error,
77 returns the error, otherwise returns false.
83 Checks all fields to make sure this is a valid reason. If there is
84 an error, returns the error, otherwise returns false. Called by the insert
93 $self->ut_numbern('reasonnum')
94 || $self->ut_text('reason')
96 return $error if $error;
103 Returns the reason_type (see <I>FS::reason_type</I>) associated with this reason.
108 qsearchs( 'reason_type', { 'typenum' => shift->reason_type } );
115 Here be termintes. Don't use on wooden computers.
119 L<FS::Record>, schema.html from the base documentation.