if enabled, show taxclass on package definition browse
[freeside.git] / eg / table_template-svc.pm
1 package FS::svc_table;
2
3 use strict;
4 use vars qw(@ISA);
5 #use FS::Record qw( qsearch qsearchs );
6 use FS::svc_Common;
7 use FS::cust_svc;
8
9 @ISA = qw(FS::svc_Common);
10
11 =head1 NAME
12
13 FS::table_name - Object methods for table_name records
14
15 =head1 SYNOPSIS
16
17   use FS::table_name;
18
19   $record = new FS::table_name \%hash;
20   $record = new FS::table_name { 'column' => 'value' };
21
22   $error = $record->insert;
23
24   $error = $new_record->replace($old_record);
25
26   $error = $record->delete;
27
28   $error = $record->check;
29
30   $error = $record->suspend;
31
32   $error = $record->unsuspend;
33
34   $error = $record->cancel;
35
36 =head1 DESCRIPTION
37
38 An FS::table_name object represents an example.  FS::table_name inherits from
39 FS::svc_Common.  The following fields are currently supported:
40
41 =over 4
42
43 =item field - description
44
45 =back
46
47 =head1 METHODS
48
49 =over 4
50
51 =item new HASHREF
52
53 Creates a new example.  To add the example to the database, see L<"insert">.
54
55 Note that this stores the hash reference, not a distinct copy of the hash it
56 points to.  You can ask the object for a copy with the I<hash> method.
57
58 =cut
59
60 sub table { 'table_name'; }
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 The additional fields pkgnum and svcpart (see L<FS::cust_svc>) should be 
68 defined.  An FS::cust_svc record will be created and inserted.
69
70 =cut
71
72 sub insert {
73   my $self = shift;
74   my $error;
75
76   $error = $self->SUPER::insert;
77   return $error if $error;
78
79   '';
80 }
81
82 =item delete
83
84 Delete this record from the database.
85
86 =cut
87
88 sub delete {
89   my $self = shift;
90   my $error;
91
92   $error = $self->SUPER::delete;
93   return $error if $error;
94
95   '';
96 }
97
98
99 =item replace OLD_RECORD
100
101 Replaces the OLD_RECORD with this one in the database.  If there is an error,
102 returns the error, otherwise returns false.
103
104 =cut
105
106 sub replace {
107   my ( $new, $old ) = ( shift, shift );
108   my $error;
109
110   $error = $new->SUPER::replace($old);
111   return $error if $error;
112
113   '';
114 }
115
116 =item suspend
117
118 Called by the suspend method of FS::cust_pkg (see L<FS::cust_pkg>).
119
120 =item unsuspend
121
122 Called by the unsuspend method of FS::cust_pkg (see L<FS::cust_pkg>).
123
124 =item cancel
125
126 Called by the cancel method of FS::cust_pkg (see L<FS::cust_pkg>).
127
128 =item check
129
130 Checks all fields to make sure this is a valid example.  If there is
131 an error, returns the error, otherwise returns false.  Called by the insert
132 and repalce methods.
133
134 =cut
135
136 sub check {
137   my $self = shift;
138
139   my $x = $self->setfixed;
140   return $x unless ref($x);
141   my $part_svc = $x;
142
143
144   $self->SUPER::check;
145 }
146
147 =back
148
149 =head1 BUGS
150
151 The author forgot to customize this manpage.
152
153 =head1 SEE ALSO
154
155 L<FS::svc_Common>, L<FS::Record>, L<FS::cust_svc>, L<FS::part_svc>,
156 L<FS::cust_pkg>, schema.html from the base documentation.
157
158 =cut
159
160 1;
161