X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=FS%2FFS%2Fpart_svc.pm;h=4d56feef2a1ac33961eb3570a1ea7db1b8d723af;hb=2413a3d43808ea6567bf25215d810bf102c498fd;hp=3ed153e0cc66797d3e0d1ee1bbe7bb4bd5082d3e;hpb=624b2d44625f69d71175c3348cae635d580c890b;p=freeside.git diff --git a/FS/FS/part_svc.pm b/FS/FS/part_svc.pm index 3ed153e0c..4d56feef2 100644 --- a/FS/FS/part_svc.pm +++ b/FS/FS/part_svc.pm @@ -53,6 +53,8 @@ L, and L, among others. =item disabled - Disabled flag, empty or `Y' +=item preserve - Preserve after cancellation, empty or 'Y' + =back =head1 METHODS @@ -80,12 +82,12 @@ the part_svc_column table appropriately (see L). =item I__I - Default or fixed value for I in I. -=item I__I_flag - defines I__I action: null or empty (no default), `D' for default, `F' for fixed (unchangeable), `M' for manual selection from inventory, or `A' for automatic selection from inventory. For virtual fields, can also be 'X' for excluded. +=item I__I_flag - defines I__I action: null or empty (no default), `D' for default, `F' for fixed (unchangeable), , `S' for selectable choice, `M' for manual selection from inventory, or `A' for automatic selection from inventory. For virtual fields, can also be 'X' for excluded. =back If you want to add part_svc_column records for fields that do not exist as -(real or virtual) fields in the I table, make sure to list then in +fields in the I table, make sure to list then in EXTRA_FIELDS_ARRAYREF also. If EXPORTNUMS_HASHREF is specified (keys are exportnums and values are @@ -381,6 +383,7 @@ sub check { || $self->ut_text('svc') || $self->ut_alpha('svcdb') || $self->ut_enum('disabled', [ '', 'Y' ] ) + || $self->ut_enum('preserve', [ '', 'Y' ] ) ; return $error if $error; @@ -459,6 +462,17 @@ sub part_export_did { grep $_->can('get_dids'), $self->part_export; } +=item part_export_dsl_pull + +Returns a list of any exports (see L) for this service that +are capable of pulling/pushing DSL orders. + +=cut + +sub part_export_dsl_pull { + my $self = shift; + grep $_->can('dsl_pull'), $self->part_export; +} =item cust_svc [ PKGPART ] @@ -604,28 +618,6 @@ sub _svc_defs { keys %info, ; - # yuck. maybe this won't be so bad when virtual fields become real fields - my %vfields; - foreach my $svcdb (grep dbdef->table($_), keys %svc_defs ) { - eval "use FS::$svcdb;"; - my $self = "FS::$svcdb"->new; - $vfields{$svcdb} = {}; - foreach my $field ($self->virtual_fields) { # svc_Common::virtual_fields with a null svcpart returns all of them - my $pvf = $self->pvf($field); - my @list = $pvf->list; - if (scalar @list) { - $svc_defs{$svcdb}->{$field} = { desc => $pvf->label, - type => 'select', - select_list => \@list }; - } else { - $svc_defs{$svcdb}->{$field} = $pvf->label; - } #endif - $vfields{$svcdb}->{$field} = $pvf; - warn "\$vfields{$svcdb}->{$field} = $pvf" - if $DEBUG; - } #next $field - } #next $svcdb - $svc_defs = \%svc_defs; #cache } @@ -658,7 +650,8 @@ the following keys: =item def_label - Optional description of the field in the context of service definitions -=item type - Currently "text", "select", "disabled", or "radius_usergroup_selector" +=item type - Currently "text", "select", "checkbox", "textarea", "disabled", +some components specified by "select-.*.html", and a bunch more... =item disable_default - This field should not allow a default value in service definitions @@ -747,7 +740,7 @@ sub process { map { my $f = $svcdb.'__'.$_; - if ( $param->{ $f.'_flag' } =~ /^[MA]$/ ) { + if ( $param->{ $f.'_flag' } =~ /^[MAH]$/ ) { $param->{ $f } = delete( $param->{ $f.'_classnum' } ); } if ( $param->{ $f.'_flag' } =~ /^S$/ ) { @@ -801,6 +794,9 @@ sub process_bulk_cust_svc { my $param = thaw(decode_base64(shift)); warn Dumper($param) if $DEBUG; + local($FS::svc_Common::noexport_hack) = 1 + if $param->{'noexport'}; + my $old_part_svc = qsearchs('part_svc', { 'svcpart' => $param->{'old_svcpart'} } ); @@ -849,6 +845,34 @@ sub process_bulk_cust_svc { } +sub _upgrade_data { #class method + my ($class, %opts) = @_; + + my @part_svc_column = qsearch('part_svc_column', { 'columnname' => 'usergroup' }); + foreach my $col ( @part_svc_column ) { + next if $col->columnvalue =~ /^[\d,]+$/ || !$col->columnvalue; + my @groupnames = split(',',$col->columnvalue); + 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; + } + $col->columnvalue(join(',',@groupnums)); + $error = $col->replace; + die $error if $error; + } + +} + =head1 BUGS Delete is unimplemented.