sqlradacct_hour price plan to charge per-hour against an external radacct table
[freeside.git] / FS / FS / svc_acct.pm
index b5ade6f..3afee7f 100644 (file)
@@ -921,8 +921,8 @@ sub email {
 
 =item seconds_since TIMESTAMP
 
-Returns the number of seconds this account has been online since TIMESTAMP.
-See L<FS::session>
+Returns the number of seconds this account has been online since TIMESTAMP,
+according to the session monitor (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.
@@ -935,6 +935,29 @@ sub seconds_since {
   $self->cust_svc->seconds_since(@_);
 }
 
+=item seconds_since_sqlradacct TIMESTAMP_START TIMESTAMP_END DATASRC DB_USERNAME DB_PASSWORD
+
+Returns the numbers of seconds this account has been online between
+TIMESTAMP_START (inclusive) and TIMESTAMP_END (exclusive), according to an
+external SQL radacct table, such as those generated by ICRADIUS or FreeRADIUS.
+Sessions which started in the specified range but are still open are counted
+from session start to the end of the range.  Also, sessions which end in the
+range but started earlier are counted from the start of the range to session
+end.  Finally, sessions which start before the range but end after (or are
+still open) are counted for the entire range.
+
+TIMESTAMP_START and TIMESTAMP_END are specified as UNIX timestamps; 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_sqlradacct {
+  my $self = shift;
+  $self->cust_svc->seconds_since_sqlradacct(@_);
+}
+
 =item radius_groups
 
 Returns all RADIUS groups for this account (see L<FS::radius_usergroup>).