[freeside-commits] branch master updated. c13c6407510f6fd1783ce0fbd97800afa27c30b5

Ivan ivan at 420.am
Sun Feb 17 14:22:02 PST 2013


The branch, master has been updated
       via  c13c6407510f6fd1783ce0fbd97800afa27c30b5 (commit)
       via  4e619bb76046bc35f0d7d29ae743b629f2a34030 (commit)
       via  f75a2c2916d103cabea9a89e251f1ed53c77eed9 (commit)
       via  6efb0ed81f4649a99e83d397691c126c94398039 (commit)
      from  8b590098fbd78765f97d44f5500a967b4afdbbe1 (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 c13c6407510f6fd1783ce0fbd97800afa27c30b5
Merge: 4e619bb 8b59009
Author: Ivan Kohler <ivan at freeside.biz>
Date:   Sun Feb 17 14:21:53 2013 -0800

    Merge branch 'master' of git.freeside.biz:/home/git/freeside


commit 4e619bb76046bc35f0d7d29ae743b629f2a34030
Author: Ivan Kohler <ivan at freeside.biz>
Date:   Sun Feb 17 14:21:39 2013 -0800

    add separate "Edit customer tax exemptions" access right, RT#21416

diff --git a/FS/FS/AccessRight.pm b/FS/FS/AccessRight.pm
index c0bd8d1..bd8a889 100644
--- a/FS/FS/AccessRight.pm
+++ b/FS/FS/AccessRight.pm
@@ -182,6 +182,7 @@ tie my %rights, 'Tie::IxHash',
     'Unvoid invoices',
     'Delete invoices',
     'View customer tax exemptions', #yow
+    'Edit customer tax exemptions', #NEWNEW
     'Add customer tax adjustment', #new, but no need to phase in
     'View customer batched payments', #NEW
     'View customer pending payments', #NEW
diff --git a/FS/FS/access_right.pm b/FS/FS/access_right.pm
index 3dd59b9..18d2695 100644
--- a/FS/FS/access_right.pm
+++ b/FS/FS/access_right.pm
@@ -199,6 +199,8 @@ sub _upgrade_data { # class method
     'Delete invoices'                     => 'Void invoices',
     'List invoices'                       => 'List quotations',
     'Post credit'                         => 'Credit line items',
+    #'View customer tax exemptions'        => 'Edit customer tax exemptions',
+    'Edit customer'                       => 'Edit customer tax exemptions',
 
     'List services'    => [ 'Services: Accounts',
                             'Services: Domains',
diff --git a/httemplate/edit/cust_main/billing.html b/httemplate/edit/cust_main/billing.html
index 2925ca8..6ba73ad 100644
--- a/httemplate/edit/cust_main/billing.html
+++ b/httemplate/edit/cust_main/billing.html
@@ -444,10 +444,11 @@
 
     <TR><TD> </TD></TR>
 
+%   my $curuser = $FS::CurrentUser::CurrentUser;
 %   my @exempt_groups = grep /\S/, $conf->config('tax-cust_exempt-groups');
-
 %   if (    $conf->exists('cust_class-tax_exempt')
 %        || $conf->exists('tax-cust_exempt-groups-require_individual_nums')
+%        || ! $curuser->access_right('Edit customer tax exemptions')
 %      )
 %   {
 
@@ -461,14 +462,16 @@
 
 %   }
 
-%   foreach my $exempt_group ( @exempt_groups ) {
-%     my $cust_main_exemption = $cust_main->tax_exemption($exempt_group);
-%     #escape $exempt_group for NAME etc.
-%     my $checked = ($cust_main_exemption || $cgi->param("tax_$exempt_group"));
-      <TR>
-        <TD>  <INPUT TYPE="checkbox" NAME="tax_<% $exempt_group %>" ID="tax_<% $exempt_group %>" VALUE="Y" <% $checked ? 'CHECKED' : '' %> onChange="tax_changed(this)"> Tax Exempt (<% $exempt_group %> taxes)</TD>
-        <TD> - Exemption number <INPUT TYPE="text" NAME="tax_<% $exempt_group %>_num" ID="tax_<% $exempt_group %>_num" VALUE="<% $cgi->param("tax_$exempt_group".'_num') || ( $cust_main_exemption ? $cust_main_exemption->exempt_number : '' ) |h %>" <% $checked ? '' : 'DISABLED' %>></TD>
-      </TR>
+%   if ( $curuser->access_right('Edit customer tax exemptions') ) {
+%     foreach my $exempt_group ( @exempt_groups ) {
+%       my $cust_main_exemption = $cust_main->tax_exemption($exempt_group);
+%       #escape $exempt_group for NAME etc.
+%       my $checked = ($cust_main_exemption || $cgi->param("tax_$exempt_group"));
+        <TR>
+          <TD>  <INPUT TYPE="checkbox" NAME="tax_<% $exempt_group %>" ID="tax_<% $exempt_group %>" VALUE="Y" <% $checked ? 'CHECKED' : '' %> onChange="tax_changed(this)"> Tax Exempt (<% $exempt_group %> taxes)</TD>
+          <TD> - Exemption number <INPUT TYPE="text" NAME="tax_<% $exempt_group %>_num" ID="tax_<% $exempt_group %>_num" VALUE="<% $cgi->param("tax_$exempt_group".'_num') || ( $cust_main_exemption ? $cust_main_exemption->exempt_number : '' ) |h %>" <% $checked ? '' : 'DISABLED' %>></TD>
+        </TR>
+%     }
 %   }
 
 % unless ( $conf->exists('emailinvoiceonly') ) {
diff --git a/httemplate/edit/process/cust_main.cgi b/httemplate/edit/process/cust_main.cgi
index 31ec4ab..584462c 100755
--- a/httemplate/edit/process/cust_main.cgi
+++ b/httemplate/edit/process/cust_main.cgi
@@ -16,8 +16,8 @@ my $DEBUG = 0;
 </%once>
 <%init>
 
-die "access denied"
-  unless $FS::CurrentUser::CurrentUser->access_right('Edit customer');
+my $curuser = $FS::CurrentUser::CurrentUser;
+die "access denied" unless $curuser->access_right('Edit customer');
 
 my $conf = new FS::Conf;
 
@@ -156,9 +156,14 @@ foreach my $dfield (qw(
 $new->setfield('paid', $cgi->param('paid') )
   if $cgi->param('paid');
 
-my @exempt_groups = grep /\S/, $conf->config('tax-cust_exempt-groups');
-my @tax_exempt = grep { $cgi->param("tax_$_") eq 'Y' } @exempt_groups;
-my %tax_exempt = map { $_ => scalar($cgi->param("tax_$_".'_num')) } @tax_exempt;
+my %options = ();
+if ( $curuser->access_right('Edit customer tax exemptions') ) { 
+  my @exempt_groups = grep /\S/, $conf->config('tax-cust_exempt-groups');
+  my @tax_exempt = grep { $cgi->param("tax_$_") eq 'Y' } @exempt_groups;
+  $options{'tax_exemption'} = {
+    map { $_ => scalar($cgi->param("tax_$_".'_num')) } @tax_exempt
+  };
+}
 
 #perhaps this stuff should go to cust_main.pm
 if ( $new->custnum eq '' or $duplicate_of ) {
@@ -266,8 +271,8 @@ if ( $new->custnum eq '' or $duplicate_of ) {
   else {
     # create the customer
     $error ||= $new->insert( \%hash, \@invoicing_list,
-                           'tax_exemption'=> \%tax_exempt,
-                           'prospectnum'  => scalar($cgi->param('prospectnum')),
+                             %options,
+                             prospectnum => scalar($cgi->param('prospectnum')),
                            );
 
     my $conf = new FS::Conf;
@@ -328,7 +333,7 @@ if ( $new->custnum eq '' or $duplicate_of ) {
   warn Dumper({ new => $new, old => $old }) if $DEBUG;
 
   $error ||= $new->replace( $old, \@invoicing_list,
-                            'tax_exemption' => \%tax_exempt,
+                            %options,
                           );
 
   warn "$me returned from replace" if $DEBUG;

commit f75a2c2916d103cabea9a89e251f1ed53c77eed9
Author: Ivan Kohler <ivan at freeside.biz>
Date:   Sun Feb 17 13:38:09 2013 -0800

    remove obsolete marketgear skeleton

diff --git a/FS/FS/cust_main.pm b/FS/FS/cust_main.pm
index bcb8fc0..68c2bd7 100644
--- a/FS/FS/cust_main.pm
+++ b/FS/FS/cust_main.pm
@@ -550,14 +550,6 @@ sub insert {
     }
   }
 
-  if ( $self->can('start_copy_skel') ) {
-    my $error = $self->start_copy_skel;
-    if ( $error ) {
-      $dbh->rollback if $oldAutoCommit;
-      return $error;
-    }
-  }
-
   warn "  ordering packages\n"
     if $DEBUG > 1;
 

commit 6efb0ed81f4649a99e83d397691c126c94398039
Author: Ivan Kohler <ivan at freeside.biz>
Date:   Sun Feb 17 12:54:04 2013 -0800

    remove obsolete marketgear skeleton config settings

diff --git a/FS/FS/Conf.pm b/FS/FS/Conf.pm
index 25d4727..af2fcf5 100644
--- a/FS/FS/Conf.pm
+++ b/FS/FS/Conf.pm
@@ -3752,20 +3752,6 @@ and customer address. Include units.',
   },
 
   {
-    'key'         => 'cust_main-skeleton_tables',
-    'section'     => '',
-    'description' => 'Tables which will have skeleton records inserted into them for each customer.  Syntax for specifying tables is unfortunately a tricky perl data structure for now.',
-    'type'        => 'textarea',
-  },
-
-  {
-    'key'         => 'cust_main-skeleton_custnum',
-    'section'     => '',
-    'description' => 'Customer number specifying the source data to copy into skeleton tables for new customers.',
-    'type'        => 'text',
-  },
-
-  {
     'key'         => 'cust_main-enable_birthdate',
     'section'     => 'UI',
     'description' => 'Enable tracking of a birth date with each customer record',

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

Summary of changes:
 FS/FS/AccessRight.pm                   |    1 +
 FS/FS/Conf.pm                          |   14 --------------
 FS/FS/access_right.pm                  |    2 ++
 FS/FS/cust_main.pm                     |    8 --------
 httemplate/edit/cust_main/billing.html |   21 ++++++++++++---------
 httemplate/edit/process/cust_main.cgi  |   21 +++++++++++++--------
 6 files changed, 28 insertions(+), 39 deletions(-)




More information about the freeside-commits mailing list