5 use FS::Record qw(qsearchs); #qsearch);
12 FS::nas - Object methods for nas records
18 $record = new FS::nas \%hash;
19 $record = new FS::nas {
21 'nasip' => '10.4.20.23',
22 'nasfqdn' => 'box1.brc.nv.us.example.net',
25 $error = $record->insert;
27 $error = $new_record->replace($old_record);
29 $error = $record->delete;
31 $error = $record->check;
33 $error = $record->heartbeat($timestamp);
37 An FS::nas object represents an Network Access Server on your network, such as
38 a terminal server or equivalent. FS::nas inherits from FS::Record. The
39 following fields are currently supported:
43 =item nasnum - primary key
47 =item nasip - NAS ip address
49 =item nasfqdn - NAS fully-qualified domain name
51 =item last - timestamp indicating the last instant the NAS was in a known
52 state (used by the session monitoring).
62 Creates a new NAS. To add the NAS to the database, see L<"insert">.
64 Note that this stores the hash reference, not a distinct copy of the hash it
65 points to. You can ask the object for a copy with the I<hash> method.
69 # the new method can be inherited from FS::Record, if a table method is defined
75 Adds this record to the database. If there is an error, returns the error,
76 otherwise returns false.
80 # the insert method can be inherited from FS::Record
84 Delete this record from the database.
88 # the delete method can be inherited from FS::Record
90 =item replace OLD_RECORD
92 Replaces the OLD_RECORD with this one in the database. If there is an error,
93 returns the error, otherwise returns false.
97 # the replace method can be inherited from FS::Record
101 Checks all fields to make sure this is a valid NAS. If there is
102 an error, returns the error, otherwise returns false. Called by the insert
107 # the check method should currently be supplied - FS::Record contains some
108 # data checking routines
113 $self->ut_numbern('nasnum')
114 || $self->ut_text('nas')
115 || $self->ut_ip('nasip')
116 || $self->ut_domain('nasfqdn')
117 || $self->ut_numbern('last')
118 || $self->SUPER::check
122 =item heartbeat TIMESTAMP
124 Updates the timestamp for this nas
129 my($self, $timestamp) = @_;
132 $dbh->prepare("UPDATE nas SET last = ? WHERE nasnum = ? AND last < ?");
133 $sth->execute($timestamp, $self->nasnum, $timestamp) or die $sth->errstr;
134 $self->last($timestamp);
141 heartbeat method uses SQL directly and doesn't update history tables.
145 L<FS::Record>, schema.html from the base documentation.