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