[freeside-commits] branch FREESIDE_2_3_BRANCH updated. 43b107634433d8ced7b557ffb9fb82743553db1d

Ivan ivan at 420.am
Wed Aug 15 23:12:59 PDT 2012


The branch, FREESIDE_2_3_BRANCH has been updated
       via  43b107634433d8ced7b557ffb9fb82743553db1d (commit)
      from  991e4adae95a0c4a2fe3c6f6516ecaba4b0873c6 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 43b107634433d8ced7b557ffb9fb82743553db1d
Author: Ivan Kohler <ivan at freeside.biz>
Date:   Wed Aug 15 23:12:59 2012 -0700

    separate ACL for merging customers across agents, RT#18939

diff --git a/FS/FS/AccessRight.pm b/FS/FS/AccessRight.pm
index eb9974a..b051ebd 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 b00cd92..5e9fe61 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';

-----------------------------------------------------------------------

Summary of changes:
 FS/FS/AccessRight.pm |    1 +
 FS/FS/cust_main.pm   |    9 ++++++---
 2 files changed, 7 insertions(+), 3 deletions(-)




More information about the freeside-commits mailing list