@ISA = qw(FS::Record);
-$DEBUG = 1;
+$DEBUG = 0;
=head1 NAME
=item preserve - Preserve after cancellation, empty or 'Y'
+=item selfservice_access - Access allowed to the service via self-service:
+empty for full access, "readonly" for read-only, "hidden" to hide it entirely
+
+=item restrict_edit_password - Require the "Provision customer service" access
+right to change the password field, rather than just "Edit password". Only
+relevant to svc_acct for now.
+
=back
=head1 METHODS
}
}
+ # XXX shouldn't this update fixed values?
+
$dbh->commit or die $dbh->errstr if $oldAutoCommit;
'';
|| $self->ut_alpha('svcdb')
|| $self->ut_enum('disabled', [ '', 'Y' ] )
|| $self->ut_enum('preserve', [ '', 'Y' ] )
+ || $self->ut_enum('selfservice_access', [ '', 'hidden', 'readonly' ] )
+ || $self->ut_enum('restrict_edit_password', [ '', 'Y' ] )
;
return $error if $error;
my $self = shift;
my %search;
$search{'exporttype'} = shift if @_;
- map { qsearchs('part_export', { 'exportnum' => $_->exportnum, %search } ) }
- qsearch('export_svc', { 'svcpart' => $self->svcpart } );
+ map { $_ } #behavior of sort undefined in scalar context
+ sort { $a->weight <=> $b->weight }
+ map { qsearchs('part_export', { 'exportnum'=>$_->exportnum, %search } ) }
+ qsearch('export_svc', { 'svcpart'=>$self->svcpart } );
}
=item part_export_usage
my $old = qsearchs('part_svc', { 'svcpart' => $param->{'svcpart'} })
if $param->{'svcpart'};
- $param->{'svc_acct__usergroup'} =
- ref($param->{'svc_acct__usergroup'})
- ? join(',', @{$param->{'svc_acct__usergroup'}} )
- : $param->{'svc_acct__usergroup'};
-
#unmunge cgp_accessmodes (falze laziness-ish w/edit/process/svc_acct.cgi)
$param->{'svc_acct__cgp_accessmodes'} ||=
join(' ', sort
} ( fields('part_svc'),
map { my $svcdb = $_;
my @fields = fields($svcdb);
- push @fields, 'usergroup' if $svcdb eq 'svc_acct'; #kludge
+ push @fields, 'usergroup' if $svcdb eq 'svc_acct'
+ or $svcdb eq 'svc_broadband'; #kludge
map {
my $f = $svcdb.'__'.$_;
- if ( $param->{ $f.'_flag' } =~ /^[MAH]$/ ) {
+ my $flag = $param->{ $f.'_flag' } || ''; #silence warnings
+ if ( $flag =~ /^[MAH]$/ ) {
$param->{ $f } = delete( $param->{ $f.'_classnum' } );
}
- if ( $param->{ $f.'_flag' } =~ /^S$/ ) {
+ if ( $flag =~ /^S$/
+ or $_ eq 'usergroup' ) {
$param->{ $f } = ref($param->{ $f })
? join(',', @{$param->{ $f }} )
: $param->{ $f };
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 } )
- || die "invalid group ".$groupname;
+ my $g = qsearchs('radius_group', { 'groupname' => $groupname } );
+ unless ( $g ) {
+ $g = new FS::radius_group {
+ 'groupname' => $groupname,
+ 'description' => $groupname,
+ };
+ $error = $g->insert;
+ die "Error inserting new radius_group for service definition group \"$groupname\": $error"
+ if $error;
+ }
push @groupnums, $g->groupnum;
}
$col->columnvalue(join(',',@groupnums));
+ $error = $col->replace;
+ die $error if $error;
+ }
+
+ my @badlabels = qsearch({
+ 'table' => 'part_svc_column',
+ 'hashref' => {},
+ 'extra_sql' => 'WHERE columnlabel IN ('.
+ "'Descriptive label for this particular device.',".
+ "'IP address. Leave blank for automatic assignment.',".
+ "'Maximum upload speed for this service in Kbps. 0 denotes unlimited.',".
+ "'Maximum download speed for this service in Kbps. 0 denotes unlimited.')"
+ });
+ foreach my $col ( @badlabels ) {
+ $col->columnlabel('');
my $error = $col->replace;
die $error if $error;
}