svc_cable, RT#22009
[freeside.git] / FS / FS / svc_cable.pm
1 package FS::svc_cable;
2 use base qw( FS::device_Common FS::svc_Common );
3
4 use strict;
5 use base qw( FS::Record );
6 use FS::Record; # qw( qsearch qsearchs );
7
8 =head1 NAME
9
10 FS::svc_cable - Object methods for svc_cable records
11
12 =head1 SYNOPSIS
13
14   use FS::svc_cable;
15
16   $record = new FS::svc_cable \%hash;
17   $record = new FS::svc_cable { 'column' => 'value' };
18
19   $error = $record->insert;
20
21   $error = $new_record->replace($old_record);
22
23   $error = $record->delete;
24
25   $error = $record->check;
26
27 =head1 DESCRIPTION
28
29 An FS::svc_cable object represents a cable subscriber.  FS::svc_cable inherits
30 from FS::Record.  The following fields are currently supported:
31
32 =over 4
33
34 =item svcnum
35
36 primary key
37
38 =back
39
40 =head1 METHODS
41
42 =over 4
43
44 =item new HASHREF
45
46 Creates a new record.  To add the record to the database, see L<"insert">.
47
48 Note that this stores the hash reference, not a distinct copy of the hash it
49 points to.  You can ask the object for a copy with the I<hash> method.
50
51 =cut
52
53 sub table { 'svc_cable'; }
54
55 sub table_info {
56   {
57     'name' => 'Cable Subscriber',
58     #'name_plural' => '', #optional,
59     #'longname_plural' => '', #optional
60     'sorts' => [ 'svcnum', ], #, 'serviceid' ], # optional sort field (or arrayref of sort fields, main first)
61     'display_weight' => 54,
62     'cancel_weight'  => 70, #?  no deps, so
63     'fields' => {
64       'svcnum'     => 'Service',
65       'identifier' => 'Identifier',
66     },
67   };
68 }
69
70 =item insert
71
72 Adds this record to the database.  If there is an error, returns the error,
73 otherwise returns false.
74
75 =item delete
76
77 Delete this record from the database.
78
79 =item replace OLD_RECORD
80
81 Replaces the OLD_RECORD with this one in the database.  If there is an error,
82 returns the error, otherwise returns false.
83
84 =item check
85
86 Checks all fields to make sure this is a valid record.  If there is
87 an error, returns the error, otherwise returns false.  Called by the insert
88 and replace methods.
89
90 =cut
91
92 sub check {
93   my $self = shift;
94
95   my $error = 
96     $self->ut_numbern('svcnum')
97   ;
98   return $error if $error;
99
100   $self->SUPER::check;
101 }
102
103 =back
104
105 =head1 BUGS
106
107 =head1 SEE ALSO
108
109 L<FS::Record>, schema.html from the base documentation.
110
111 =cut
112
113 1;
114