[freeside-commits] freeside/FS/FS cust_main.pm, 1.432, 1.433 Conf.pm, 1.291, 1.292

Ivan,,, ivan at wavetail.420.am
Mon Jun 22 03:06:13 PDT 2009


Update of /home/cvs/cvsroot/freeside/FS/FS
In directory wavetail.420.am:/tmp/cvs-serv23974/FS/FS

Modified Files:
	cust_main.pm Conf.pm 
Log Message:
finish basic implemention of tax exemption by tax name hack, RT#5127

Index: Conf.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/Conf.pm,v
retrieving revision 1.291
retrieving revision 1.292
diff -u -d -r1.291 -r1.292
--- Conf.pm	22 Jun 2009 07:50:18 -0000	1.291
+++ Conf.pm	22 Jun 2009 10:06:11 -0000	1.292
@@ -2830,7 +2830,7 @@
   {
     'key'         => 'tax-cust_exempt-groups',
     'section'     => '',
-    'description' => 'List of grouping possibilities for tax names, for per-customer exemption purposes, one tax name prefix for line.  For example, "GST" would indicate the ability to exempt customers individually from taxes starting with "GST" (but not other taxes).',
+    'description' => 'List of grouping possibilities for tax names, for per-customer exemption purposes, one tax name per line.  For example, "GST" would indicate the ability to exempt customers individually from taxes named "GST" (but not other taxes).',
     'type'        => 'textarea',
   },
 

Index: cust_main.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/cust_main.pm,v
retrieving revision 1.432
retrieving revision 1.433
diff -u -d -r1.432 -r1.433
--- cust_main.pm	22 Jun 2009 07:50:18 -0000	1.432
+++ cust_main.pm	22 Jun 2009 10:06:11 -0000	1.433
@@ -2972,6 +2972,10 @@
         @taxes = qsearch( 'cust_main_county', \%taxhash_elim );
       }
 
+      @taxes = grep { ! $_->taxname or ! $self->tax_exemption($_->taxname) }
+                    @taxes
+        if $self->cust_main_exemption; #just to be safe
+
       if ( $conf->exists('tax-pkg_address') && $cust_pkg->locationnum ) {
         foreach (@taxes) {
           $_->set('pkgnum',      $cust_pkg->pkgnum );
@@ -2984,12 +2988,12 @@
       $taxes{'recur'} = [ @taxes ];
       $taxes{$_} = [ @taxes ] foreach (@classes);
 
-      # maybe eliminate this entirely, along with all the 0% records
-      unless ( @taxes ) {
-        return
-          "fatal: can't find tax rate for state/county/country/taxclass ".
-          join('/', map $taxhash{$_}, qw(state county country taxclass) );
-      }
+      # # maybe eliminate this entirely, along with all the 0% records
+      # unless ( @taxes ) {
+      #   return
+      #     "fatal: can't find tax rate for state/county/country/taxclass ".
+      #     join('/', map $taxhash{$_}, qw(state county country taxclass) );
+      # }
 
     } #if $conf->exists('enable_taxproducts') ...
 
@@ -6384,12 +6388,20 @@
   my( $self, $taxname ) = @_;
 
   qsearchs( 'cust_main_exemption', { 'custnum' => $self->custnum,
-                                     'taxname' => { 'op'    => 'LIKE',
-                                                    'value' => $taxname.'%' },
-                                    },
+                                     'taxname' => $taxname,
+                                   },
           );
 }
 
+=item cust_main_exemption
+
+=cut
+
+sub cust_main_exemption {
+  my $self = shift;
+  qsearch( 'cust_main_exemption', { 'custnum' => $self->custnum } );
+}
+
 =item invoicing_list [ ARRAYREF ]
 
 If an arguement is given, sets these email addresses as invoice recipients



More information about the freeside-commits mailing list