- web interface for hourly account charges!
[freeside.git] / FS / FS / svc_acct.pm
index 3f97189..16270f9 100644 (file)
@@ -134,6 +134,14 @@ FS::svc_acct - Object methods for svc_acct records
 
   %hash = $record->radius_check;
 
+  $domain = $record->domain;
+
+  $svc_domain = $record->svc_domain;
+
+  $email = $record->email;
+
+  $seconds_since = $record->seconds_since($timestamp);
+
 =head1 DESCRIPTION
 
 An FS::svc_acct object represents an account.  FS::svc_acct inherits from
@@ -511,15 +519,17 @@ sub delete {
   }
   if ( $icradius_dbh ) {
 
-    my $queue = new FS::queue { 'job' => 'FS::svc_acct::icradius_rc_delete' };
-    $error = $queue->insert( $self->username );
+    my $radcheck_queue =
+      new FS::queue { 'job' => 'FS::svc_acct::icradius_rc_delete' };
+    $error = $radcheck_queue->insert( $self->username );
     if ( $error ) {
       $dbh->rollback if $oldAutoCommit;
       return "queueing job (transaction rolled back): $error";
     }
 
-    my $queue = new FS::queue { 'job' => 'FS::svc_acct::icradius_rr_delete' };
-    $error = $queue->insert( $self->username );
+    my $radreply_queue =
+      new FS::queue { 'job' => 'FS::svc_acct::icradius_rr_delete' };
+    $error = $radreply_queue->insert( $self->username );
     if ( $error ) {
       $dbh->rollback if $oldAutoCommit;
       return "queueing job (transaction rolled back): $error";
@@ -931,7 +941,7 @@ sub radius_reply {
       ( $FS::raddb::attrib{lc($attrib)}, $self->getfield($column) );
     } grep { /^radius_/ && $self->getfield($_) } fields( $self->table );
   if ( $self->ip && $self->ip ne '0e0' ) {
-    $reply{Framed-IP-Address} = $self->ip;
+    $reply{'Framed-IP-Address'} = $self->ip;
   }
   %reply;
 }
@@ -988,6 +998,15 @@ sub svc_domain {
     : qsearchs( 'svc_domain', { 'svcnum' => $self->domsvc } );
 }
 
+=item cust_svc
+
+Returns the FS::cust_svc record for this account (see L<FS::cust_svc>).
+
+sub cust_svc {
+  my $self = shift;
+  qsearchs( 'cust_svc', { 'svcnum' => $self->svcnum } );
+}
+
 =item email
 
 Returns an email address associated with the account.
@@ -999,6 +1018,22 @@ sub email {
   $self->username. '@'. $self->domain;
 }
 
+=item seconds_since TIMESTAMP
+
+Returns the number of seconds this account has been online since TIMESTAMP.
+See L<FS::session>
+
+TIMESTAMP is specified as a UNIX timestamp; see L<perlfunc/"time">.  Also see
+L<Time::Local> and L<Date::Parse> for conversion functions.
+
+=cut
+
+#note: POD here, implementation in FS::cust_svc
+sub seconds_since {
+  my $self = shift;
+  $self->cust_svc->seconds_since(@_);
+}
+
 =item ssh
 
 =cut
@@ -1031,7 +1066,7 @@ sub ssh {
 
 =head1 VERSION
 
-$Id: svc_acct.pm,v 1.62 2002-01-16 15:37:42 ivan Exp $
+$Id: svc_acct.pm,v 1.64 2002-01-29 16:33:15 ivan Exp $
 
 =head1 BUGS