This commit was generated by cvs2svn to compensate for changes in r4407,
[freeside.git] / FS / FS / cancel_reason.pm
1 package FS::cancel_reason;
2
3 use strict;
4 use vars qw( @ISA );
5 use FS::Record qw( qsearch qsearchs );
6
7 @ISA = qw(FS::Record);
8
9 =head1 NAME
10
11 FS::cancel_reason - Object methods for cancel_reason records
12
13 =head1 SYNOPSIS
14
15   use FS::cancel_reason;
16
17   $record = new FS::cancel_reason \%hash;
18   $record = new FS::cancel_reason { 'column' => 'value' };
19
20   $error = $record->insert;
21
22   $error = $new_record->replace($old_record);
23
24   $error = $record->delete;
25
26   $error = $record->check;
27
28 =head1 DESCRIPTION
29
30 An FS::cancel_reason object represents an cancellation reason.
31 FS::cancel_reason inherits from FS::Record.  The following fields are
32 currently supported:
33
34 =over 4
35
36 =item reasonnum - primary key
37
38 =item reason - 
39
40 =item disabled - empty or "Y"
41
42 =back
43
44 =head1 METHODS
45
46 =over 4
47
48 =item new HASHREF
49
50 Creates a new cancellation reason.  To add the reason to the database, see
51 L<"insert">.
52
53 Note that this stores the hash reference, not a distinct copy of the hash it
54 points to.  You can ask the object for a copy with the I<hash> method.
55
56 =cut
57
58 # the new method can be inherited from FS::Record, if a table method is defined
59
60 sub table { 'cancel_reason'; }
61
62 =item insert
63
64 Adds this record to the database.  If there is an error, returns the error,
65 otherwise returns false.
66
67 =cut
68
69 # the insert method can be inherited from FS::Record
70
71 =item delete
72
73 Delete this record from the database.
74
75 =cut
76
77 # the delete method can be inherited from FS::Record
78
79 =item replace OLD_RECORD
80
81 Replaces the OLD_RECORD with this one in the database.  If there is an error,
82 returns the error, otherwise returns false.
83
84 =cut
85
86 # the replace method can be inherited from FS::Record
87
88 =item check
89
90 Checks all fields to make sure this is a valid reason.  If there is
91 an error, returns the error, otherwise returns false.  Called by the insert
92 and replace methods.
93
94 =cut
95
96 # the check method should currently be supplied - FS::Record contains some
97 # data checking routines
98
99 sub check {
100   my $self = shift;
101
102   my $error = 
103     $self->ut_numbern('reasonnum')
104     || $self->ut_text('reason')
105     || $self->ut_enum('disabled', [ '', 'Y' ] )
106   ;
107   return $error if $error;
108
109   $self->SUPER::check;
110 }
111
112 =back
113
114 =head1 BUGS
115
116 =head1 SEE ALSO
117
118 L<FS::Record>, schema.html from the base documentation.
119
120 =cut
121
122 1;
123