projects
/
freeside.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
consolidate large numbers of accounts to avoid gigantic line items
[freeside.git]
/
FS
/
FS
/
svc_acct.pm
diff --git
a/FS/FS/svc_acct.pm
b/FS/FS/svc_acct.pm
index
4c943a7
..
3ddd70a
100644
(file)
--- a/
FS/FS/svc_acct.pm
+++ b/
FS/FS/svc_acct.pm
@@
-226,7
+226,7
@@
sub insert {
# 'domsvc' => $self->domsvc,
# } );
# 'domsvc' => $self->domsvc,
# } );
- if ( $self->svcnum ) {
+ if ( $self->svcnum
&& qsearchs('cust_svc',{'svcnum'=>$self->svcnum})
) {
my $cust_svc = qsearchs('cust_svc',{'svcnum'=>$self->svcnum});
unless ( $cust_svc ) {
$dbh->rollback if $oldAutoCommit;
my $cust_svc = qsearchs('cust_svc',{'svcnum'=>$self->svcnum});
unless ( $cust_svc ) {
$dbh->rollback if $oldAutoCommit;
@@
-427,6
+427,8
@@
The corresponding FS::cust_svc record will be deleted as well.
sub delete {
my $self = shift;
sub delete {
my $self = shift;
+ return "can't delete system account" if $self->_check_system;
+
return "Can't delete an account which is a (svc_forward) source!"
if qsearch( 'svc_forward', { 'srcsvc' => $self->svcnum } );
return "Can't delete an account which is a (svc_forward) source!"
if qsearch( 'svc_forward', { 'srcsvc' => $self->svcnum } );
@@
-515,6
+517,8
@@
sub replace {
my $error;
warn "$me replacing $old with $new\n" if $DEBUG;
my $error;
warn "$me replacing $old with $new\n" if $DEBUG;
+ return "can't modify system account" if $old->_check_system;
+
return "Username in use"
if $old->username ne $new->username &&
qsearchs( 'svc_acct', { 'username' => $new->username,
return "Username in use"
if $old->username ne $new->username &&
qsearchs( 'svc_acct', { 'username' => $new->username,
@@
-614,6
+618,7
@@
Called by the suspend method of FS::cust_pkg (see L<FS::cust_pkg>).
sub suspend {
my $self = shift;
sub suspend {
my $self = shift;
+ return "can't suspend system account" if $self->_check_system;
my %hash = $self->hash;
unless ( $hash{_password} =~ /^\*SUSPENDED\* /
|| $hash{_password} eq '*'
my %hash = $self->hash;
unless ( $hash{_password} =~ /^\*SUSPENDED\* /
|| $hash{_password} eq '*'
@@
-839,6
+844,17
@@
sub check {
$self->SUPER::check;
}
$self->SUPER::check;
}
+=item _check_system
+
+=cut
+
+sub _check_system {
+ my $self = shift;
+ scalar( grep { $self->username eq $_ || $self->email eq $_ }
+ $conf->config('system_usernames')
+ );
+}
+
=item radius
Depriciated, use radius_reply instead.
=item radius
Depriciated, use radius_reply instead.