7f74ac3423f6fc85fed4d55b53fe1ca3516970b3
[freeside.git] / eg / table_template.pm
1 package FS::table_name;
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::table_name - Object methods for table_name records
12
13 =head1 SYNOPSIS
14
15   use FS::table_name;
16
17   $record = new FS::table_name \%hash;
18   $record = new FS::table_name { '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::table_name object represents an example.  FS::table_name inherits from
31 FS::Record.  The following fields are currently supported:
32
33 =over 4
34
35 =item field - description
36
37 =back
38
39 =head1 METHODS
40
41 =over 4
42
43 =item new HASHREF
44
45 Creates a new example.  To add the example to the database, see L<"insert">.
46
47 Note that this stores the hash reference, not a distinct copy of the hash it
48 points to.  You can ask the object for a copy with the I<hash> method.
49
50 =cut
51
52 # the new method can be inherited from FS::Record, if a table method is defined
53
54 sub table { 'table_name'; }
55
56 =item insert
57
58 Adds this record to the database.  If there is an error, returns the error,
59 otherwise returns false.
60
61 =cut
62
63 # the insert method can be inherited from FS::Record
64
65 =item delete
66
67 Delete this record from the database.
68
69 =cut
70
71 # the delete method can be inherited from FS::Record
72
73 =item replace OLD_RECORD
74
75 Replaces the OLD_RECORD with this one in the database.  If there is an error,
76 returns the error, otherwise returns false.
77
78 =cut
79
80 # the replace method can be inherited from FS::Record
81
82 =item check
83
84 Checks all fields to make sure this is a valid example.  If there is
85 an error, returns the error, otherwise returns false.  Called by the insert
86 and replace methods.
87
88 =cut
89
90 # the check method should currently be supplied - FS::Record contains some
91 # data checking routines
92
93 sub check {
94   my $self = shift;
95
96   ''; #no error
97 }
98
99 =back
100
101 =head1 VERSION
102
103 $Id: table_template.pm,v 1.1 1999-08-04 08:03:03 ivan Exp $
104
105 =head1 BUGS
106
107 The author forgot to customize this manpage.
108
109 =head1 SEE ALSO
110
111 L<FS::Record>, schema.html from the base documentation.
112
113 =head1 HISTORY
114
115 ivan@voicenet.com 97-jul-1
116
117 added hfields
118 ivan@sisd.com 97-nov-13
119
120 $Log: table_template.pm,v $
121 Revision 1.1  1999-08-04 08:03:03  ivan
122 move table subclass examples out of production directory
123
124 Revision 1.4  1998/12/29 11:59:57  ivan
125 mostly properly OO, some work still to be done with svc_ stuff
126
127 Revision 1.3  1998/11/15 04:33:00  ivan
128 updates for newest versoin
129
130 Revision 1.2  1998/11/15 03:48:49  ivan
131 update for current version
132
133
134 =cut
135
136 1;
137