X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=FS%2FFS%2Fnas.pm;h=3495339e0241ce062b3019d663fb6af7ac12f926;hb=e96a3fd1c8ee8c711a7e119c0937da6866bbd4f0;hp=5ed95f92e5db92d4a4fa8d57e107cddec0b2324e;hpb=eea322178c024e57730831556d28a78524df7450;p=freeside.git diff --git a/FS/FS/nas.pm b/FS/FS/nas.pm index 5ed95f92e..3495339e0 100644 --- a/FS/FS/nas.pm +++ b/FS/FS/nas.pm @@ -2,8 +2,8 @@ package FS::nas; use strict; use vars qw( @ISA ); -use FS::Record qw(); -#use FS::Record qw( qsearch qsearchs ); +use FS::Record qw(qsearchs); #qsearch); +use FS::UID qw( dbh ); @ISA = qw(FS::Record); @@ -114,18 +114,31 @@ sub check { || $self->ut_text('nas') || $self->ut_ip('nasip') || $self->ut_domain('nasfqdn') - || $self->ut_numbern('last'); + || $self->ut_numbern('last') + || $self->SUPER::check + ; } -=back +=item heartbeat TIMESTAMP + +Updates the timestamp for this nas + +=cut -=head1 VERSION +sub heartbeat { + my($self, $timestamp) = @_; + my $dbh = dbh; + my $sth = + $dbh->prepare("UPDATE nas SET last = ? WHERE nasnum = ? AND last < ?"); + $sth->execute($timestamp, $self->nasnum, $timestamp) or die $sth->errstr; + $self->last($timestamp); +} -$Id: nas.pm,v 1.1 2000-10-27 20:18:32 ivan Exp $ +=back =head1 BUGS -The author forgot to customize this manpage. +heartbeat method uses SQL directly and doesn't update history tables. =head1 SEE ALSO