4 use vars qw( @ISA $DEBUG $me );
6 use DBIx::DBSchema::Table;
7 use DBIx::DBSchema::Column;
8 use FS::Record qw( qsearch qsearchs dbh dbdef );
11 @ISA = qw(FS::Record);
17 FS::reason - Object methods for reason records
23 $record = new FS::reason \%hash;
24 $record = new FS::reason { 'column' => 'value' };
26 $error = $record->insert;
28 $error = $new_record->replace($old_record);
30 $error = $record->delete;
32 $error = $record->check;
36 An FS::reason object represents a reason message. FS::reason inherits from
37 FS::Record. The following fields are currently supported:
41 =item reasonnum - primary key
43 =item reason_type - index into FS::reason_type
45 =item reason - text of the reason
47 =item disabled - 'Y' or ''
58 Creates a new reason. To add the example to the database, see L<"insert">.
60 Note that this stores the hash reference, not a distinct copy of the hash it
61 points to. You can ask the object for a copy with the I<hash> method.
65 sub table { 'reason'; }
69 Adds this record to the database. If there is an error, returns the error,
70 otherwise returns false.
76 Delete this record from the database.
80 =item replace OLD_RECORD
82 Replaces the OLD_RECORD with this one in the database. If there is an error,
83 returns the error, otherwise returns false.
89 Checks all fields to make sure this is a valid reason. If there is
90 an error, returns the error, otherwise returns false. Called by the insert
99 $self->ut_numbern('reasonnum')
100 || $self->ut_text('reason')
102 return $error if $error;
109 Returns the reason_type (see <I>FS::reason_type</I>) associated with this reason.
114 qsearchs( 'reason_type', { 'typenum' => shift->reason_type } );
121 Here be termintes. Don't use on wooden computers.
125 L<FS::Record>, schema.html from the base documentation.