This commit was generated by cvs2svn to compensate for changes in r6252,
[freeside.git] / FS / FS / cust_pkg_reason.pm
1 package FS::cust_pkg_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::cust_pkg_reason - Object methods for cust_pkg_reason records
12
13 =head1 SYNOPSIS
14
15   use FS::cust_pkg_reason;
16
17   $record = new FS::cust_pkg_reason \%hash;
18   $record = new FS::cust_pkg_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::cust_pkg_reason object represents a relationship between a cust_pkg
31 and a reason, for example cancellation or suspension reasons. 
32 FS::cust_pkg_reason inherits from FS::Record.  The following fields are
33 currently supported:
34
35 =over 4
36
37 =item num - primary key
38
39 =item pkgnum - 
40
41 =item reasonnum - 
42
43 =item otaker - 
44
45 =item date - 
46
47
48 =back
49
50 =head1 METHODS
51
52 =over 4
53
54 =item new HASHREF
55
56 Creates a new cust_pkg_reason.  To add the example to the database, see
57 L<"insert">.
58
59 Note that this stores the hash reference, not a distinct copy of the hash it
60 points to.  You can ask the object for a copy with the I<hash> method.
61
62 =cut
63
64 sub table { 'cust_pkg_reason'; }
65
66 =item insert
67
68 Adds this record to the database.  If there is an error, returns the error,
69 otherwise returns false.
70
71 =cut
72
73 =item delete
74
75 Delete this record from the database.
76
77 =cut
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 =item check
87
88 Checks all fields to make sure this is a valid cust_pkg_reason.  If there is
89 an error, returns the error, otherwise returns false.  Called by the insert
90 and replace methods.
91
92 =cut
93
94 sub check {
95   my $self = shift;
96
97   my $error = 
98     $self->ut_numbern('num')
99     || $self->ut_number('pkgnum')
100     || $self->ut_number('reasonnum')
101     || $self->ut_text('otaker')
102     || $self->ut_numbern('date')
103   ;
104   return $error if $error;
105
106   $self->SUPER::check;
107 }
108
109 =back
110
111 =head1 BUGS
112
113 Here be termites.  Don't use on wooden computers.
114
115 =head1 SEE ALSO
116
117 L<FS::Record>, schema.html from the base documentation.
118
119 =cut
120
121 1;
122