fix part_pkg upgrade, fallout from 18503
[freeside.git] / FS / FS / cust_main_county.pm
index e84fa98..6316f23 100644 (file)
@@ -56,6 +56,8 @@ currently supported:
 
 =item taxnum - primary key (assigned automatically for new tax rates)
 
+=item district - tax district (optional)
+
 =item city
 
 =item county
@@ -119,6 +121,7 @@ sub check {
   $self->exempt_amount(0) unless $self->exempt_amount;
 
   $self->ut_numbern('taxnum')
+    || $self->ut_alphan('district')
     || $self->ut_textn('city')
     || $self->ut_textn('county')
     || $self->ut_anything('state')
@@ -173,7 +176,7 @@ with different tax classes.
 sub sql_taxclass_sameregion {
   my $self = shift;
 
-  my $same_query = 'SELECT taxclass FROM cust_main_county '.
+  my $same_query = 'SELECT DISTINCT taxclass FROM cust_main_county '.
                    ' WHERE taxnum != ? AND country = ?';
   my @same_param = ( 'taxnum', 'country' );
   foreach my $opt_field (qw( state county )) {
@@ -328,7 +331,7 @@ sub taxline {
             'taxnum'     => $self->taxnum,
             'year'       => 1900+$year,
             'month'      => $mon,
-            'amount'     => sprintf("%.2f", $addl ),
+            'amount'     => sprintf('%.2f', $addl ),
           } );
           if ($cust_bill_pkg->billpkgnum) {
             $cust_tax_exempt_pkg->billpkgnum($cust_bill_pkg->billpkgnum);