X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=FS%2FFS%2Fsvc_acct.pm;h=37c55d67cdfba4c792ee68e4adc411c71d0103f2;hb=8feb21fe1a028fcad188131cd1f1176558095943;hp=1c4b574e952ba07db4e4e94b290eb92222c13abe;hpb=9f2280fbce022ab9bcfc46fe94483730b0aeb0f8;p=freeside.git diff --git a/FS/FS/svc_acct.pm b/FS/FS/svc_acct.pm index 1c4b574e9..37c55d67c 100644 --- a/FS/FS/svc_acct.pm +++ b/FS/FS/svc_acct.pm @@ -993,6 +993,10 @@ sub replace { } + return "can't change username" + if $old->username ne $new->username + && $conf->exists('svc_acct-no_edit_username'); + #change homdir when we change username $new->setfield('dir', '') if $old->username ne $new->username; @@ -2223,20 +2227,19 @@ sub _op_overlimit { my $cust_pkg = $self->cust_svc->cust_pkg; - my $conf_overlimit = + my @conf_overlimit = $cust_pkg ? $conf->config('overlimit_groups', $cust_pkg->cust_main->agentnum ) : $conf->config('overlimit_groups'); foreach my $part_export ( $self->cust_svc->part_svc->part_export ) { - my $groups = $conf_overlimit || $part_export->option('overlimit_groups'); - next unless $groups; - - my $gref = &{ $self->_fieldhandlers->{'usergroup'} }( $self, $groups ); + my @groups = scalar(@conf_overlimit) ? @conf_overlimit + : split(' ',$part_export->option('overlimit_groups')); + next unless scalar(@groups); my $other = new FS::svc_acct $self->hashref; - $other->usergroup( $gref ); + $other->usergroup(\@groups); my($new,$old); if ($action eq 'suspend') { @@ -2559,7 +2562,13 @@ sub radius_groups { unless ref($self->usergroup) eq 'ARRAY'; #when provisioning records, export callback runs in svc_Common.pm before #radius_usergroup records can be inserted... - @{$self->usergroup}; + my $groups = join(',',@{$self->usergroup}); + my @groups; + return @groups unless length($groups); + @groups = qsearch({ 'table' => 'radius_group', + 'extra_sql' => "where groupnum in ($groups)", + }); + map { $_->groupname } @groups; } else { my $format = shift || ''; my @groups = qsearch({ 'table' => 'radius_usergroup', @@ -2924,7 +2933,7 @@ sub search { #agentnum if ( $params->{'agentnum'} =~ /^(\d+)$/ and $1 ) { - push @where, "agentnum = $1"; + push @where, "cust_main.agentnum = $1"; } #custnum