diff options
| author | Ivan Kohler <ivan@freeside.biz> | 2012-08-15 23:12:59 -0700 |
|---|---|---|
| committer | Ivan Kohler <ivan@freeside.biz> | 2012-08-15 23:12:59 -0700 |
| commit | 43b107634433d8ced7b557ffb9fb82743553db1d (patch) | |
| tree | 650416098ba8d9bfee04b0ebf6f63e3eaa98f0a4 | |
| parent | 991e4adae95a0c4a2fe3c6f6516ecaba4b0873c6 (diff) | |
separate ACL for merging customers across agents, RT#18939
| -rw-r--r-- | FS/FS/AccessRight.pm | 1 | ||||
| -rw-r--r-- | FS/FS/cust_main.pm | 9 |
2 files changed, 7 insertions, 3 deletions
diff --git a/FS/FS/AccessRight.pm b/FS/FS/AccessRight.pm index eb9974adf..b051ebdbe 100644 --- a/FS/FS/AccessRight.pm +++ b/FS/FS/AccessRight.pm @@ -116,6 +116,7 @@ tie my %rights, 'Tie::IxHash', 'Cancel customer', 'Complimentary customer', #aka users-allow_comp 'Merge customer', + 'Merge customer across agents', { rightname=>'Delete customer', desc=>"Enable customer deletions. Be very careful! Deleting a customer will remove all traces that this customer ever existed! It should probably only be used when auditing a legacy database. Normally, you cancel all of a customer's packages if they cancel service." }, #aka. deletecustomers 'Bill customer now', #NEW 'Bulk send customer notices', #NEW diff --git a/FS/FS/cust_main.pm b/FS/FS/cust_main.pm index b00cd9285..5e9fe6136 100644 --- a/FS/FS/cust_main.pm +++ b/FS/FS/cust_main.pm @@ -1259,9 +1259,12 @@ sub merge { return "Can't merge a customer into self" if $self->custnum == $new_custnum; - unless ( qsearchs( 'cust_main', { 'custnum' => $new_custnum } ) ) { - return "Invalid new customer number: $new_custnum"; - } + my $new_cust_main = qsearchs( 'cust_main', { 'custnum' => $new_custnum } ) + or return "Invalid new customer number: $new_custnum"; + + return 'Access denied: "Merge customer across agents" access right required to merge into a customer of a different agent' + if $self->agentnum != $new_cust_main->agentnum + && ! $FS::CurrentUser::CurrentUser->access_right('Merge customer across agents'); local $SIG{HUP} = 'IGNORE'; local $SIG{INT} = 'IGNORE'; |
