report value passed for illegal action pseudo-field
[freeside.git] / FS / FS / svc_external.pm
1 package FS::svc_external;
2
3 use strict;
4 use vars qw(@ISA); # $conf
5 use FS::UID;
6 #use FS::Record qw( qsearch qsearchs dbh);
7 use FS::svc_Common;
8
9 @ISA = qw( FS::svc_Common );
10
11 #FS::UID::install_callback( sub {
12 #  $conf = new FS::Conf;
13 #};
14
15 =head1 NAME
16
17 FS::svc_external - Object methods for svc_external records
18
19 =head1 SYNOPSIS
20
21   use FS::svc_external;
22
23   $record = new FS::svc_external \%hash;
24   $record = new FS::svc_external { 'column' => 'value' };
25
26   $error = $record->insert;
27
28   $error = $new_record->replace($old_record);
29
30   $error = $record->delete;
31
32   $error = $record->check;
33
34   $error = $record->suspend;
35
36   $error = $record->unsuspend;
37
38   $error = $record->cancel;
39
40 =head1 DESCRIPTION
41
42 An FS::svc_external object represents a externally tracked service.
43 FS::svc_external inherits from FS::svc_Common.  The following fields are
44 currently supported:
45
46 =over 4
47
48 =item svcnum - primary key
49
50 =item id - unique number of external record
51
52 =item title - for invoice line items
53
54 =back
55
56 =head1 METHODS
57
58 =over 4
59
60 =item new HASHREF
61
62 Creates a new external service.  To add the external service to the database,
63 see L<"insert">.  
64
65 Note that this stores the hash reference, not a distinct copy of the hash it
66 points to.  You can ask the object for a copy with the I<hash> method.
67
68 =cut
69
70 sub table { 'svc_external'; }
71
72 =item insert [ , OPTION => VALUE ... ]
73
74 Adds this external service to the database.  If there is an error, returns the
75 error, otherwise returns false.
76
77 The additional fields pkgnum and svcpart (see L<FS::cust_svc>) should be 
78 defined.  An FS::cust_svc record will be created and inserted.
79
80 Currently available options are: I<depend_jobnum>
81
82 If I<depend_jobnum> is set (to a scalar jobnum or an array reference of
83 jobnums), all provisioning jobs will have a dependancy on the supplied
84 jobnum(s) (they will not run until the specific job(s) complete(s)).
85
86 =cut
87
88 #sub insert {
89 #  my $self = shift;
90 #  my $error;
91 #
92 #  $error = $self->SUPER::insert(@_);
93 #  return $error if $error;
94 #
95 #  '';
96 #}
97
98 =item delete
99
100 Delete this record from the database.
101
102 =cut
103
104 #sub delete {
105 #  my $self = shift;
106 #  my $error;
107 #
108 #  $error = $self->SUPER::delete;
109 #  return $error if $error;
110 #
111 #  '';
112 #}
113
114
115 =item replace OLD_RECORD
116
117 Replaces the OLD_RECORD with this one in the database.  If there is an error,
118 returns the error, otherwise returns false.
119
120 =cut
121
122 #sub replace {
123 #  my ( $new, $old ) = ( shift, shift );
124 #  my $error;
125 #
126 #  $error = $new->SUPER::replace($old);
127 #  return $error if $error;
128 #
129 #  '';
130 #}
131
132 =item suspend
133
134 Called by the suspend method of FS::cust_pkg (see L<FS::cust_pkg>).
135
136 =item unsuspend
137
138 Called by the unsuspend method of FS::cust_pkg (see L<FS::cust_pkg>).
139
140 =item cancel
141
142 Called by the cancel method of FS::cust_pkg (see L<FS::cust_pkg>).
143
144 =item check
145
146 Checks all fields to make sure this is a valid external service.  If there is
147 an error, returns the error, otherwise returns false.  Called by the insert
148 and repalce methods.
149
150 =cut
151
152 sub check {
153   my $self = shift;
154
155   my $x = $self->setfixed;
156   return $x unless ref($x);
157   my $part_svc = $x;
158
159   my $error = 
160     $self->ut_numbern('svcnum')
161     || $self->ut_number('id')
162     || $self->ut_textn('title')
163   ;
164
165   $self->SUPER::check;
166 }
167
168 =back
169
170 =head1 BUGS
171
172 =head1 SEE ALSO
173
174 L<FS::svc_Common>, L<FS::Record>, L<FS::cust_svc>, L<FS::part_svc>,
175 L<FS::cust_pkg>, schema.html from the base documentation.
176
177 =cut
178
179 1;
180