add pkey to batch payments and fix a doc typo
[freeside.git] / FS / FS / nas.pm
index 5ed95f9..cb0c1b9 100644 (file)
@@ -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);
 
@@ -117,16 +117,29 @@ sub check {
     || $self->ut_numbern('last');
 }
 
+=item heartbeat TIMESTAMP
+
+Updates the timestamp for this nas
+
+=cut
+
+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);
+}
+
 =back
 
 =head1 VERSION
 
-$Id: nas.pm,v 1.1 2000-10-27 20:18:32 ivan Exp $
+$Id: nas.pm,v 1.5 2001-04-15 13:35:12 ivan Exp $
 
 =head1 BUGS
 
-The author forgot to customize this manpage.
-
 =head1 SEE ALSO
 
 L<FS::Record>, schema.html from the base documentation.