[freeside-commits] branch master updated. 66b55857d43110136cf85d57dbda0960cad29b32

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


The branch, master has been updated
       via  66b55857d43110136cf85d57dbda0960cad29b32 (commit)
      from  b8d26f05c2add703389f9391a8375d7dcb800865 (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 66b55857d43110136cf85d57dbda0960cad29b32
Author: Ivan Kohler <ivan at freeside.biz>
Date:   Wed Aug 15 23:12:58 2012 -0700

    separate ACL for merging customers across agents, RT#18939

diff --git a/FS/FS/AccessRight.pm b/FS/FS/AccessRight.pm
index b41ec2f..e730bde 100644
--- a/FS/FS/AccessRight.pm
+++ b/FS/FS/AccessRight.pm
@@ -117,6 +117,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 3742bfd..fda82e4 100644
--- a/FS/FS/cust_main.pm
+++ b/FS/FS/cust_main.pm
@@ -1245,9 +1245,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