X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=FS%2FFS%2Fpart_export.pm;h=890c522f66646fd902ac44dd567a177b461d62de;hb=b79a8cb932946c849328a3c117c35821d9d21e66;hp=d533db88b516abb32f3399c2d46252d76f35f09c;hpb=d0221fabd4656b3a04251ca6168cc45f54d23574;p=freeside.git diff --git a/FS/FS/part_export.pm b/FS/FS/part_export.pm index d533db88b..890c522f6 100644 --- a/FS/FS/part_export.pm +++ b/FS/FS/part_export.pm @@ -50,6 +50,8 @@ fields are currently supported: =item exportnum - primary key +=item exportname - Descriptive name + =item machine - Machine name =item exporttype - Export type @@ -159,6 +161,7 @@ sub check { my $self = shift; my $error = $self->ut_numbern('exportnum') + || $self->ut_textn('exportname') || $self->ut_domain('machine') || $self->ut_alpha('exporttype') ; @@ -174,6 +177,17 @@ sub check { $self->SUPER::check; } +=item label + +Returns a label for this export, "exportname||exportype (machine)". + +=cut + +sub label { + my $self = shift; + ($self->exportname || $self->exporttype ). ' ('. $self->machine. ')'; +} + #=item part_svc # #Returns the service definition (see L) for this export. @@ -376,6 +390,15 @@ Adds a list of web elements to ARRAYREF specific to this export and SVC_OBJECT. The elements are displayed in the UI to lead the the operator to external configuration, monitoring, and similar tools. +=item export_getsettings SVC_OBJECT SETTINGS_HASHREF DEFAUTS_HASHREF + +Adds a hashref of settings to SETTINGSREF specific to this export and +SVC_OBJECT. The elements can be displayed in the UI on the service view. + +DEFAULTSREF is a hashref with the same keys where true values indicate the +setting is a default (and thus can be displayed in the UI with less emphasis, +or hidden by default). + =cut =back @@ -408,6 +431,34 @@ sub export_info { my $r = { map { %{$exports{$_}} } keys %exports }; } + +sub _upgrade_data { #class method + my ($class, %opts) = @_; + + my @part_export_option = qsearch('part_export_option', { 'optionname' => 'overlimit_groups' }); + foreach my $opt ( @part_export_option ) { + next if $opt->optionvalue =~ /^[\d\s]+$/ || !$opt->optionvalue; + my @groupnames = split(' ',$opt->optionvalue); + my @groupnums; + my $error = ''; + foreach my $groupname ( @groupnames ) { + my $g = qsearchs('radius_group', { 'groupname' => $groupname } ); + unless ( $g ) { + $g = new FS::radius_group { + 'groupname' => $groupname, + 'description' => $groupname, + }; + $error = $g->insert; + die $error if $error; + } + push @groupnums, $g->groupnum; + } + $opt->optionvalue(join(' ',@groupnums)); + $error = $opt->replace; + die $error if $error; + } +} + #=item exporttype2svcdb EXPORTTYPE # #Returns the applicable I for an I. @@ -439,7 +490,7 @@ foreach my $INC ( @INC ) { } unless ( keys %$info ) { warn "no %info hash found in FS::part_export::$mod, skipping\n" - unless $mod =~ /^(passwdfile|null)$/; #hack but what the heck + unless $mod =~ /^(passwdfile|null|.+_Common)$/; #hack but what the heck next; } warn "got export info from FS::part_export::$mod: $info\n" if $DEBUG;