diff options
author | Ivan Kohler <ivan@freeside.biz> | 2012-05-08 15:34:25 -0700 |
---|---|---|
committer | Ivan Kohler <ivan@freeside.biz> | 2012-05-08 15:34:25 -0700 |
commit | a68564e6856a7ea63763eeaf7962a5cb2df649af (patch) | |
tree | 45022b1dc0208ac6c3fdc5f413e25598c815dab7 /httemplate/edit | |
parent | 52cf6949df47667d9864f5807549aa68789ef2fa (diff) |
separate tax exemption numbers for individual exemptions w/tax-cust_exempt-groups, RT#17658
Diffstat (limited to 'httemplate/edit')
-rwxr-xr-x | httemplate/edit/cust_main.cgi | 2 | ||||
-rw-r--r-- | httemplate/edit/cust_main/billing.html | 21 | ||||
-rwxr-xr-x | httemplate/edit/process/cust_main.cgi | 5 |
3 files changed, 22 insertions, 6 deletions
diff --git a/httemplate/edit/cust_main.cgi b/httemplate/edit/cust_main.cgi index 119572a11..b97fb16bf 100755 --- a/httemplate/edit/cust_main.cgi +++ b/httemplate/edit/cust_main.cgi @@ -367,7 +367,7 @@ if ( $cgi->param('error') ) { } my %keep = map { $_=>1 } qw( error tagnum lock_agentnum lock_pkgpart ); -$cgi->delete( grep !$keep{$_}, $cgi->param ); +$cgi->delete( grep { !$keep{$_} && $_ !~ /^tax_/ } $cgi->param ); my $title = $custnum ? 'Edit Customer' : 'Add Customer'; $title = mt($title); diff --git a/httemplate/edit/cust_main/billing.html b/httemplate/edit/cust_main/billing.html index 0194d31a6..3f873174f 100644 --- a/httemplate/edit/cust_main/billing.html +++ b/httemplate/edit/cust_main/billing.html @@ -117,6 +117,15 @@ //why? select.selectedIndex = 0; } } + + function tax_changed(what) { + var num = document.getElementById(what.id + '_num'); + if ( what.checked ) { + num.disabled = false; + } else { + num.disabled = true; + } + } </SCRIPT> @@ -437,7 +446,10 @@ % my @exempt_groups = grep /\S/, $conf->config('tax-cust_exempt-groups'); -% if ( $conf->exists('cust_class-tax_exempt') ) { +% if ( $conf->exists('cust_class-tax_exempt') +% || $conf->exists('tax-cust_exempt-groups-require_individual_nums') +% ) +% { <INPUT TYPE="hidden" NAME="tax" VALUE="<% $cust_main->tax eq 'Y' ? 'Y' : '' %>"> @@ -450,9 +462,12 @@ % } % foreach my $exempt_group ( @exempt_groups ) { -% #escape $exempt_group for NAME +% 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 WIDTH="608" COLSPAN="2"> <INPUT TYPE="checkbox" NAME="tax_<% $exempt_group %>" VALUE="Y" <% $cust_main->tax_exemption($exempt_group) ? 'CHECKED' : '' %>> Tax Exempt (<% $exempt_group %> taxes)<TD> + <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> % } diff --git a/httemplate/edit/process/cust_main.cgi b/httemplate/edit/process/cust_main.cgi index 793426cc3..1cf7a3eb4 100755 --- a/httemplate/edit/process/cust_main.cgi +++ b/httemplate/edit/process/cust_main.cgi @@ -132,6 +132,7 @@ $new->setfield('paid', $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; #perhaps this stuff should go to cust_main.pm if ( $new->custnum eq '' or $duplicate_of ) { @@ -239,7 +240,7 @@ if ( $new->custnum eq '' or $duplicate_of ) { else { # create the customer $error ||= $new->insert( \%hash, \@invoicing_list, - 'tax_exemption'=> \@tax_exempt, + 'tax_exemption'=> \%tax_exempt, 'prospectnum' => scalar($cgi->param('prospectnum')), ); @@ -297,7 +298,7 @@ if ( $new->custnum eq '' or $duplicate_of ) { local($FS::Record::DEBUG) = $DEBUG if $DEBUG; $error ||= $new->replace( $old, \@invoicing_list, - 'tax_exemption' => \@tax_exempt, + 'tax_exemption' => \%tax_exempt, ); warn "$me returned from replace" if $DEBUG; |