From 4eea4e8c5dc178ccd3b478b80361896da027e481 Mon Sep 17 00:00:00 2001 From: ivan Date: Fri, 24 Oct 2008 01:45:24 +0000 Subject: [PATCH] tiny nits for phone RADIUS export: allow freeside-sqlradius-reset to reset a phone_sqlradius export, but only if explicitly specified by exportnum. also fix "Reference found where even-size list expected" warning and junk winding up in radreply table". all this phone_sqlradius stuff is RT#4100 --- FS/FS/svc_phone.pm | 2 +- FS/bin/freeside-sqlradius-reset | 33 ++++++++++++++++----------------- 2 files changed, 17 insertions(+), 18 deletions(-) diff --git a/FS/FS/svc_phone.pm b/FS/FS/svc_phone.pm index 965f3a577..c90339a8b 100644 --- a/FS/FS/svc_phone.pm +++ b/FS/FS/svc_phone.pm @@ -225,7 +225,7 @@ sub check_pin { sub radius_reply { my $self = shift; #XXX Session-Timeout! holy shit, need rlm_perl to ask for this in realtime - {}; + (); } =item radius_check diff --git a/FS/bin/freeside-sqlradius-reset b/FS/bin/freeside-sqlradius-reset index 94fa68a06..7d1d34336 100755 --- a/FS/bin/freeside-sqlradius-reset +++ b/FS/bin/freeside-sqlradius-reset @@ -6,7 +6,7 @@ use Getopt::Std; use FS::UID qw(adminsuidsetup); use FS::Record qw(qsearch qsearchs); use FS::part_export; -use FS::svc_acct; +#use FS::svc_acct; use FS::cust_svc; getopts("n"); @@ -19,7 +19,7 @@ adminsuidsetup $user; my @exports = (); if ( @ARGV ) { foreach my $exportnum ( @ARGV ) { - foreach my $exporttype (qw( sqlradius sqlradius_withdomain )) { + foreach my $exporttype (qw( sqlradius sqlradius_withdomain phone_sqlradius )) { push @exports, qsearch('part_export', { exportnum => $exportnum, exporttype => $exporttype, } ); } @@ -47,25 +47,25 @@ foreach my $export ( @exports ) { #my @svcparts = map { $_->svcpart } $export->export_svc; my $overlimit_groups = $export->option('overlimit_groups'); - my @svc_acct = - map { qsearchs('svc_acct', { 'svcnum' => $_->svcnum } ) } - map { qsearch('cust_svc', { 'svcpart' => $_->svcpart } ) } - grep { qsearch('cust_svc', { 'svcpart' => $_->svcpart } ) } - $export->export_svc; + my @svc_x = + map { $_->svc_x } + map { qsearch('cust_svc', { 'svcpart' => $_->svcpart } ) } + grep { qsearch('cust_svc', { 'svcpart' => $_->svcpart } ) } + $export->export_svc; - foreach my $svc_acct ( @svc_acct ) { + foreach my $svc_x ( @svc_x ) { - $svc_acct->check; #set any fixed usergroup so it'll export even if all - #svc_acct records don't have the group yet + $svc_x->check; #set any fixed usergroup so it'll export even if all + #svc_acct records don't have the group yet - if ($overlimit_groups && $svc_acct->overlimit) { - $svc_acct->usergroup( &{ $svc_acct->_fieldhandlers->{'usergroup'} } - ($svc_acct, $overlimit_groups) - ); + if ($overlimit_groups && $svc_x->overlimit) { + $svc_x->usergroup( &{ $svc_x->_fieldhandlers->{'usergroup'} } + ($svc_x, $overlimit_groups) + ); } #false laziness with FS::svc_acct::insert (like it matters) - my $error = $export->export_insert($svc_acct); + my $error = $export->export_insert($svc_x); die $error if $error; } @@ -100,5 +100,4 @@ L, L, L =cut - - +1; -- 2.11.0