separate ACL for editing customer invoice terms, RT#75759
authorIvan Kohler <ivan@freeside.biz>
Fri, 2 Jun 2017 21:22:22 +0000 (14:22 -0700)
committerIvan Kohler <ivan@freeside.biz>
Fri, 2 Jun 2017 21:22:22 +0000 (14:22 -0700)
FS/FS/cust_main.pm

index 640eee3..23d54b6 100644 (file)
@@ -377,6 +377,10 @@ sub insert {
        join(', ', map { "$_: $options{$_}" } keys %options ). "\n"
     if $DEBUG;
 
+  return "You are not permitted to change customer invoicing terms."
+    if $self->invoice_terms #i.e. not the default
+    && ! $FS::CurrentUser::CurrentUser->access_right('Edit customer invoice terms');
+
   local $SIG{HUP} = 'IGNORE';
   local $SIG{INT} = 'IGNORE';
   local $SIG{QUIT} = 'IGNORE';
@@ -1385,6 +1389,10 @@ sub replace {
     && ! $self->locale
     && $conf->exists('cust_main-require_locale');
 
+  return "You are not permitted to change customer invoicing terms."
+    if $old->invoice_terms ne $self->invoice_terms
+    && ! $curuser->access_right('Edit customer invoice terms');
+
   local $SIG{HUP} = 'IGNORE';
   local $SIG{INT} = 'IGNORE';
   local $SIG{QUIT} = 'IGNORE';