4 use base qw( FS::svc_Common );
6 use FS::Record qw( qsearchs ); # qw( qsearch qsearchs );
13 FS::svc_alarm - Object methods for svc_alarm records
19 $record = new FS::svc_alarm \%hash;
20 $record = new FS::svc_alarm { 'column' => 'value' };
22 $error = $record->insert;
24 $error = $new_record->replace($old_record);
26 $error = $record->delete;
28 $error = $record->check;
32 An FS::svc_alarm object represents an alarm service. FS::svc_alarm inherits
35 The following fields are currently supported:
39 =item svcnum - Primary key
41 =item alarmsystemnum - Alarm System Vendor (see L<FS::alarm_system>)
43 =item alarmtypenum - Alarm System Type (inputs/outputs) (see L<FS::alarm_type>)
45 =item alarmstationnum - Alarm central station (see L<FS::alarm_station>)
47 =item acctnum - Account number
49 =item _password - Password
51 =item location - Location on property
61 Creates a new svc_dish object.
65 sub table { 'svc_alarm'; }
68 my %opts = ( 'type' => 'text',
69 #'disable_select' => 1,
70 'disable_inventory' => 1,
73 tie my %fields, 'Tie::IxHash',
74 'svcnum' => { label => 'Service' },
75 'acctnum' => { label => 'Account #', %opts },
76 '_password' => { label => 'Password' , %opts },
77 'location' => { label => 'Location', %opts },
78 'alarmsystemnum' => { label => 'Alarm System Vendor',
79 type => 'select-alarm_system',
80 disable_inventory => 1,
81 value_callback => sub {
82 shift->alarm_system->systemname
85 'alarmtypenum' => { label => 'Alarm System Type',
86 type => 'select-alarm_type',
87 disable_inventory => 1,
88 value_callback => sub {
89 shift->alarm_type->typename
92 'alarmstationnum' => { label => 'Alarm Central Station',
93 type => 'select-alarm_station',
94 disable_inventory => 1,
95 value_callback => sub {
96 shift->alarm_station->stationname
102 'name' => 'Alarm service',
103 'sorts' => 'acctnum',
104 'display_weight' => 80,
105 'cancel_weight' => 85,
106 'fields' => \%fields,
113 $self->acctnum . '@'. $self->alarm_station->stationname. #?
114 ' ('. $self->alarm_system->systemname. ' '. $self->alarm_type->typename. ')'
119 my($class, $string) = @_;
120 $class->search_sql_field('acctnum', $string);
125 Adds this record to the database. If there is an error, returns the error,
126 otherwise returns false.
130 Delete this record from the database.
132 =item replace OLD_RECORD
134 Replaces the OLD_RECORD with this one in the database. If there is an error,
135 returns the error, otherwise returns false.
139 Checks all fields to make sure this is a valid service. If there is
140 an error, returns the error, otherwise returns false. Called by the insert
148 my $x = $self->setfixed;
149 return $x unless ref $x;
152 $self->ut_numbern('svcnum')
153 || $self->ut_text('acctnum')
154 || $self->ut_alphan('_password')
155 || $self->ut_textn('location')
156 || $self->ut_foreign_key('alarmsystemnum', 'alarm_system', 'systemnum')
157 || $self->ut_foreign_key('alarmtypenum', 'alarm_type', 'typenum')
158 || $self->ut_foreign_key('alarmstationnum', 'alarm_station', 'stationnum')
160 return $error if $error;
165 sub alarm_system { qsearchs('alarm_system', {systemnum =>shift->systemnum } ) }
166 sub alarm_type { qsearchs('alarm_type', {typenum =>shift->systemnum } ) }
167 sub alarm_station { qsearchs('alarm_station',{stationnum=>shift->stationnum} ) }
173 L<FS::Record>, L<FS::svc_Common>, schema.html from the base documentation.