X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=blobdiff_plain;f=FS%2FFS%2Fsvc_Radius_Mixin.pm;h=66741620ccfc9293242935ecc06806a27f418089;hp=544c7e958eecf80ab87b91a5fbd65587160f80d4;hb=5372897f367498972c96f5494e142e6e11b29eb8;hpb=3d0a1bb06b895c5be6e3f0517d355442a6b1e125 diff --git a/FS/FS/svc_Radius_Mixin.pm b/FS/FS/svc_Radius_Mixin.pm index 544c7e958..66741620c 100644 --- a/FS/FS/svc_Radius_Mixin.pm +++ b/FS/FS/svc_Radius_Mixin.pm @@ -99,12 +99,12 @@ sub delete { local $FS::UID::AutoCommit = 0; my $dbh = dbh; - my $error = $self->SUPER::delete(@_) - || $self->process_m2m( + my $error = $self->process_m2m( 'link_table' => 'radius_usergroup', 'target_table' => 'radius_group', 'params' => [], - ); + ) + || $self->SUPER::delete; if ( $error ) { $dbh->rollback if $oldAutoCommit; @@ -159,6 +159,71 @@ sub radius_groups { return map {$_->$method} @groups; } +=item seconds_since_sqlradacct TIMESTAMP_START TIMESTAMP_END + +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, specified via sqlradius export. Sessions which +started in the specified range but are still open are counted from session +start to the end of the range (unless they are over 1 day old, in which case +they are presumed missing their stop record and not counted). 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 are counted for the entire range. + +TIMESTAMP_START and TIMESTAMP_END are specified as UNIX timestamps; see +L. Also see L and L 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 attribute_since_sqlradacct TIMESTAMP_START TIMESTAMP_END ATTRIBUTE + +For this service, returns the sum of the given attribute for sessions ending +between TIMESTAMP_START (inclusive) and TIMESTAMP_END (exclusive). + +TIMESTAMP_START and TIMESTAMP_END are specified as UNIX timestamps; see +L. Also see L and L for conversion +functions. + +=cut + +#note: POD here, implementation in FS::cust_svc +sub attribute_since_sqlradacct { + my $self = shift; + $self->cust_svc->attribute_since_sqlradacct(@_); +} + +=item attribute_last_sqlradacct ATTRIBUTE + +For this service, returns the most recent value of the given attribute. + +=cut + +#note: POD here, implementation in FS::cust_svc +sub attribute_last_sqlradacct { + my $self = shift; + $self->cust_svc->attribute_last_sqlradacct(@_); +} +=item get_session_history TIMESTAMP_START TIMESTAMP_END + +Returns an array of hash references of this customers login history for the +given time range. (document this better) + +=cut + +sub get_session_history { + my $self = shift; + $self->cust_svc->get_session_history(@_); +} + + =back =cut