[freeside-commits] freeside/httemplate/edit/process cust_main.cgi, 1.40, 1.41

Ivan,,, ivan at wavetail.420.am
Mon Jun 22 00:50:20 PDT 2009


Update of /home/cvs/cvsroot/freeside/httemplate/edit/process
In directory wavetail.420.am:/tmp/cvs-serv11986/httemplate/edit/process

Modified Files:
	cust_main.cgi 
Log Message:
tax exemption by tax name, RT#5127

Index: cust_main.cgi
===================================================================
RCS file: /home/cvs/cvsroot/freeside/httemplate/edit/process/cust_main.cgi,v
retrieving revision 1.40
retrieving revision 1.41
diff -u -d -r1.40 -r1.41
--- cust_main.cgi	22 Apr 2009 18:58:46 -0000	1.40
+++ cust_main.cgi	22 Jun 2009 07:50:18 -0000	1.41
@@ -19,6 +19,8 @@
 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 ( $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 @@
 $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 @@
   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 @@
   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;
   



More information about the freeside-commits mailing list