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