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