diff options
author | ivan <ivan> | 2009-06-22 07:50:18 +0000 |
---|---|---|
committer | ivan <ivan> | 2009-06-22 07:50:18 +0000 |
commit | 73e382b838f031512684138fedb7d813684ddd28 (patch) | |
tree | abe5fd8f8f14f82dcaa880dfefcab14d0a5df33e /httemplate/edit | |
parent | 2f62e9125f1eb98db97a6ddff5b47bb258e6fc60 (diff) |
tax exemption by tax name, RT#5127
Diffstat (limited to 'httemplate/edit')
-rw-r--r-- | httemplate/edit/cust_main/billing.html | 11 | ||||
-rwxr-xr-x | httemplate/edit/process/cust_main.cgi | 14 |
2 files changed, 21 insertions, 4 deletions
diff --git a/httemplate/edit/cust_main/billing.html b/httemplate/edit/cust_main/billing.html index 353f2b9a0..f0d9b853a 100644 --- a/httemplate/edit/cust_main/billing.html +++ b/httemplate/edit/cust_main/billing.html @@ -359,10 +359,19 @@ <TR><TD> </TD></TR> +% my @exempt_groups = grep /\S/, $conf->config('tax-cust_exempt-groups'); + <TR> - <TD WIDTH="608" COLSPAN="2"><INPUT TYPE="checkbox" NAME="tax" VALUE="Y" <% $cust_main->tax eq "Y" ? 'CHECKED' : '' %>> Tax Exempt</TD> + <TD WIDTH="608" COLSPAN="2"><INPUT TYPE="checkbox" NAME="tax" VALUE="Y" <% $cust_main->tax eq "Y" ? 'CHECKED' : '' %>> Tax Exempt<% @exempt_groups ? ' (all taxes)' : '' %></TD> </TR> +% foreach my $exempt_group ( @exempt_groups ) { +% #escape $exempt_group for NAME + <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> + </TR> +% } + % unless ( $conf->exists('emailinvoiceonly') ) { <TR> diff --git a/httemplate/edit/process/cust_main.cgi b/httemplate/edit/process/cust_main.cgi index 7a0c67b4a..1709752fb 100755 --- a/httemplate/edit/process/cust_main.cgi +++ b/httemplate/edit/process/cust_main.cgi @@ -19,6 +19,8 @@ my $DEBUG = 0; die "access denied" unless $FS::CurrentUser::CurrentUser->access_right('Edit customer'); +my $conf = new FS::Conf; + my $error = ''; #unmunge stuff @@ -72,7 +74,6 @@ if ( defined($cgi->param('same')) && $cgi->param('same') eq "Y" ) { } if ( $cgi->param('birthdate') && $cgi->param('birthdate') =~ /^([ 0-9\-\/]{0,10})$/) { - my $conf = new FS::Conf; my $format = $conf->config('date_format') || "%m/%d/%Y"; my $parser = DateTime::Format::Strptime->new(pattern => $format, time_zone => 'floating', @@ -91,6 +92,9 @@ if ( $cgi->param('birthdate') && $cgi->param('birthdate') =~ /^([ 0-9\-\/]{0,10} $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; + #perhaps this stuff should go to cust_main.pm if ( $new->custnum eq '' ) { @@ -179,7 +183,9 @@ if ( $new->custnum eq '' ) { use Tie::RefHash; tie my %hash, 'Tie::RefHash'; %hash = ( $cust_pkg => [ $svc ] ) if $cust_pkg; - $error ||= $new->insert( \%hash, \@invoicing_list ); + $error ||= $new->insert( \%hash, \@invoicing_list, + 'tax_exemption' => \@tax_exempt, + ); my $conf = new FS::Conf; if ( $conf->exists('backend-realtime') && ! $error ) { @@ -222,7 +228,9 @@ if ( $new->custnum eq '' ) { local($FS::cust_main::DEBUG) = $DEBUG if $DEBUG; local($FS::Record::DEBUG) = $DEBUG if $DEBUG; - $error ||= $new->replace($old, \@invoicing_list); + $error ||= $new->replace( $old, \@invoicing_list, + 'tax_exemption' => \@tax_exempt, + ); warn "$me returned from replace" if $DEBUG; |