use FS::part_export;
use FS::svc_acct;
use FS::export_svc;
-use Carp qw( cluck );
+use Carp qw( carp cluck );
use NEXT;
use Net::OpenSSH;
type => 'select',
options => [qw( usergroup radusergroup ) ],
},
+ 'skip_provisioning' => {
+ type => 'checkbox',
+ label => 'Skip provisioning records to this database'
+ },
'ignore_accounting' => {
type => 'checkbox',
label => 'Ignore accounting records from this database'
sub _export_insert {
my($self, $svc_x) = (shift, shift);
+ return '' if $self->option('skip_provisioning');
+
foreach my $table (qw(reply check)) {
my $method = "radius_$table";
my %attrib = $self->$method($svc_x);
sub _export_replace {
my( $self, $new, $old ) = (shift, shift, shift);
+ return '' if $self->option('skip_provisioning');
+
local $SIG{HUP} = 'IGNORE';
local $SIG{INT} = 'IGNORE';
local $SIG{QUIT} = 'IGNORE';
sub _export_suspend {
my( $self, $svc_acct ) = (shift, shift);
+ return '' if $self->option('skip_provisioning');
+
my $new = $svc_acct->clone_suspended;
local $SIG{HUP} = 'IGNORE';
sub _export_unsuspend {
my( $self, $svc_x ) = (shift, shift);
+ return '' if $self->option('skip_provisioning');
+
local $SIG{HUP} = 'IGNORE';
local $SIG{INT} = 'IGNORE';
local $SIG{QUIT} = 'IGNORE';
sub _export_delete {
my( $self, $svc_x ) = (shift, shift);
+ return '' if $self->option('skip_provisioning');
+
my $jobnum = '';
my $usergroup = $self->option('usergroup') || 'usergroup';
}
sub sqlradius_insert { #subroutine, not method
+
+ if ( $FS::svc_Common::noexport_hack ) {
+ carp 'sqlradius_insert() suppressed by noexport_hack' if $DEBUG;
+ return;
+ }
+
my $dbh = sqlradius_connect(shift, shift, shift);
my( $table, $username, %attributes ) = @_;
}
sub sqlradius_usergroup_insert { #subroutine, not method
+
+ if ( $FS::svc_Common::noexport_hack ) {
+ carp 'sqlradius_usergroup_insert() suppressed by noexport_hack' if $DEBUG;
+ return;
+ }
+
my $dbh = sqlradius_connect(shift, shift, shift);
my $username = shift;
my $usergroup = ( $_[0] =~ /^(rad)?usergroup/i ) ? shift : 'usergroup';
}
sub sqlradius_usergroup_delete { #subroutine, not method
+
+ if ( $FS::svc_Common::noexport_hack ) {
+ carp 'sqlradius_usergroup_delete() suppressed by noexport_hack' if $DEBUG;
+ return;
+ }
+
my $dbh = sqlradius_connect(shift, shift, shift);
my $username = shift;
my $usergroup = ( $_[0] =~ /^(rad)?usergroup/i ) ? shift : 'usergroup';
}
sub sqlradius_rename { #subroutine, not method
+
+ if ( $FS::svc_Common::noexport_hack ) {
+ carp 'sqlradius_rename() suppressed by noexport_hack' if $DEBUG;
+ return;
+ }
+
my $dbh = sqlradius_connect(shift, shift, shift);
my($new_username, $old_username) = (shift, shift);
my $usergroup = ( $_[0] =~ /^(rad)?usergroup/i ) ? shift : 'usergroup';
}
sub sqlradius_attrib_delete { #subroutine, not method
+
+ if ( $FS::svc_Common::noexport_hack ) {
+ carp 'sqlradius_attrib_delete() suppressed by noexport_hack' if $DEBUG;
+ return;
+ }
+
my $dbh = sqlradius_connect(shift, shift, shift);
my( $table, $username, @attrib ) = @_;
}
sub sqlradius_delete { #subroutine, not method
+
+ if ( $FS::svc_Common::noexport_hack ) {
+ carp 'sqlradius_delete() suppressed by noexport_hack' if $DEBUG;
+ return;
+ }
+
my $dbh = sqlradius_connect(shift, shift, shift);
my $username = shift;
my $usergroup = ( $_[0] =~ /^(rad)?usergroup/i ) ? shift : 'usergroup';
sub update_svc {
my $self = shift;
+ if ( $FS::svc_Common::noexport_hack ) {
+ carp 'update_svc() suppressed by noexport_hack'
+ if $self->option('debug') || $DEBUG;
+ return;
+ }
+
my $conf = new FS::Conf;
my $fdbh = dbh;
sub export_nas_action {
my $self = shift;
my ($action, $new, $old) = @_;
+
+ if ( $FS::svc_Common::noexport_hack ) {
+ carp "export_nas_action($action) suppressed by noexport_hack"
+ if $self->option('debug') || $DEBUG;
+ return;
+ }
+
# find the NAS in the target table by its name
my $nasname = ($action eq 'replace') ? $old->nasname : $new->nasname;
my $nasnum = $new->nasnum;
}
sub sqlradius_nas_insert {
+
+ if ( $FS::svc_Common::noexport_hack ) {
+ carp 'sqlradius_nas_insert() suppressed by noexport_hack' if $DEBUG;
+ return;
+ }
+
my $dbh = sqlradius_connect(shift, shift, shift);
my %opt = @_;
my $nas = qsearchs('nas', { nasnum => $opt{'nasnum'} })
}
sub sqlradius_nas_delete {
+
+ if ( $FS::svc_Common::noexport_hack ) {
+ carp 'sqlradius_nas_delete() suppressed by noexport_hack' if $DEBUG;
+ return;
+ }
+
my $dbh = sqlradius_connect(shift, shift, shift);
my %opt = @_;
my $sth = $dbh->prepare('DELETE FROM nas WHERE nasname = ?');
}
sub sqlradius_nas_replace {
+
+ if ( $FS::svc_Common::noexport_hack ) {
+ carp 'sqlradius_nas_replace() suppressed by noexport_hack' if $DEBUG;
+ return;
+ }
+
my $dbh = sqlradius_connect(shift, shift, shift);
my %opt = @_;
my $nas = qsearchs('nas', { nasnum => $opt{'nasnum'} })
}
sub sqlradius_attr_insert {
+
+ if ( $FS::svc_Common::noexport_hack ) {
+ carp 'sqlradius_attr_insert() suppressed by noexport_hack' if $DEBUG;
+ return;
+ }
+
my $dbh = sqlradius_connect(shift, shift, shift);
my %opt = @_;
}
sub sqlradius_attr_delete {
+
+ if ( $FS::svc_Common::noexport_hack ) {
+ carp 'sqlradius_attr_delete() suppressed by noexport_hack' if $DEBUG;
+ return;
+ }
+
my $dbh = sqlradius_connect(shift, shift, shift);
my %opt = @_;
}
sub sqlradius_group_replace {
+
+ if ( $FS::svc_Common::noexport_hack ) {
+ carp 'sqlradius_group_replace() suppressed by noexport_hack' if $DEBUG;
+ return;
+ }
+
my $dbh = sqlradius_connect(shift, shift, shift);
my $usergroup = shift;
$usergroup =~ /^(rad)?usergroup$/
=cut
sub sqlradius_user_disconnect {
+
+ if ( $FS::svc_Common::noexport_hack ) {
+ carp 'sqlradius_user_disconnect() suppressed by noexport_hack' if $DEBUG;
+ return;
+ }
+
my $dbh = sqlradius_connect(shift, shift, shift);
my %opt = @_;
# get list of nas