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