ACL for hardware class config, RT#85057
[freeside.git] / FS / FS / alarm_system.pm
1 package FS::alarm_system;
2
3 use strict;
4 use base qw( FS::Record );
5 use FS::Record; # qw( qsearch qsearchs );
6 use FS::agent;
7
8 =head1 NAME
9
10 FS::alarm_system - Object methods for alarm_system records
11
12 =head1 SYNOPSIS
13
14   use FS::alarm_system;
15
16   $record = new FS::alarm_system \%hash;
17   $record = new FS::alarm_system { '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::alarm_system object represents an alarm system vendor.  FS::alarm_system
30 inherits from FS::Record.  The following fields are currently supported:
31
32 =over 4
33
34 =item alarmsystemnum
35
36 primary key
37
38 =item agentnum
39
40 agentnum
41
42 =item systemname
43
44 systemname
45
46 =item disabled
47
48 disabled
49
50
51 =back
52
53 =head1 METHODS
54
55 =over 4
56
57 =item new HASHREF
58
59 Creates a new vendor.  To add the vendor to the database, see L<"insert">.
60
61 Note that this stores the hash reference, not a distinct copy of the hash it
62 points to.  You can ask the object for a copy with the I<hash> method.
63
64 =cut
65
66 # the new method can be inherited from FS::Record, if a table method is defined
67
68 sub table { 'alarm_system'; }
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 vendor.  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('alarmsystemnum')
97     || $self->ut_foreign_keyn('agentnum', 'agent', 'agentnum')
98     || $self->ut_text('systemname')
99     || $self->ut_enum('disabled', ['', 'Y'])
100   ;
101   return $error if $error;
102
103   $self->SUPER::check;
104 }
105
106 =back
107
108 =head1 BUGS
109
110 =head1 SEE ALSO
111
112 L<FS::svc_alarm>, L<FS::Record>
113
114 =cut
115
116 1;
117