[freeside-commits] freeside/FS/FS Record.pm, 1.167, 1.168 cust_main.pm, 1.359, 1.360 part_pkg_taxrate.pm, 1.3, 1.4 tax_rate.pm, 1.7, 1.8

Jeff Finucane,420,, jeff at wavetail.420.am
Fri Aug 22 20:29:21 PDT 2008


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

Modified Files:
	Record.pm cust_main.pm part_pkg_taxrate.pm tax_rate.pm 
Log Message:
tax data update bug fixes and error message improvements

Index: part_pkg_taxrate.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/part_pkg_taxrate.pm,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- part_pkg_taxrate.pm	15 Apr 2008 20:47:59 -0000	1.3
+++ part_pkg_taxrate.pm	23 Aug 2008 03:29:18 -0000	1.4
@@ -150,7 +150,7 @@
     || $self->ut_text('country')
     || $self->ut_foreign_keyn('taxclassnumtaxed', 'tax_class', 'taxclassnum')
     || $self->ut_foreign_key('taxclassnum', 'tax_class', 'taxclassnum')
-    || $self->ut_numbern('effective_date')
+    || $self->ut_snumbern('effdate')
     || $self->ut_enum('taxable', [ 'Y', '' ])
   ;
   return $error if $error;
@@ -271,8 +271,6 @@
       }
 
       $hash->{'effdate'} = str2time($hash->{'effdate'});
-
-      $hash->{'effdate'} = str2time($hash->{'effdate'});
       $hash->{'country'} = 'US'; # CA is available
 
       delete($hash->{'taxable'}) if ($hash->{'taxable'} eq 'N');

Index: tax_rate.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/tax_rate.pm,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- tax_rate.pm	14 Aug 2008 11:44:51 -0000	1.7
+++ tax_rate.pm	23 Aug 2008 03:29:18 -0000	1.8
@@ -199,7 +199,7 @@
     || $self->ut_textn('data_vendor')
     || $self->ut_textn('location')
     || $self->ut_foreign_key('taxclassnum', 'tax_class', 'taxclassnum')
-    || $self->ut_numbern('effective_date')
+    || $self->ut_snumbern('effective_date')
     || $self->ut_float('tax')
     || $self->ut_floatn('excessrate')
     || $self->ut_money('taxbase')
@@ -642,6 +642,8 @@
 
     if ( $error ) {
       $dbh->rollback if $oldAutoCommit;
+      my $hashref = $insert{$_};
+      $line = join(", ", map { "$_ => ". $hashref->{$_} } keys(%$hashref) );
       return "can't insert tax_rate for $line: $error";
     }
 
@@ -667,13 +669,15 @@
         #join(" ", map { "$_ => ". $old->{$_} } @fields);
         join(" ", map { "$_ => ". $old->{$_} } keys(%$old) );
     }
-    my $new = new FS::tax_rate( $insert{$_} );
+    my $new = new FS::tax_rate({ $old->hash, %{$insert{$_}}, 'manual' => ''  });
     $new->taxnum($old->taxnum);
     my $error = $new->replace($old);
 
     if ( $error ) {
       $dbh->rollback if $oldAutoCommit;
-      return "can't insert tax_rate for $line: $error";
+      my $hashref = $insert{$_};
+      $line = join(", ", map { "$_ => ". $hashref->{$_} } keys(%$hashref) );
+      return "can't replace tax_rate for $line: $error";
     }
 
     $imported++;
@@ -703,7 +707,9 @@
 
     if ( $error ) {
       $dbh->rollback if $oldAutoCommit;
-      return "can't insert tax_rate for $line: $error";
+      my $hashref = $delete{$_};
+      $line = join(", ", map { "$_ => ". $hashref->{$_} } keys(%$hashref) );
+      return "can't delete tax_rate for $line: $error";
     }
 
     $imported++;
@@ -831,7 +837,7 @@
       unlink $file or warn "Can't delete $file: $!";
     }
     
-    $error = "No DETAIL supplied"
+    $error ||= "No DETAIL supplied"
       unless ($files{detail});
     open my $fh, "< $dir/". $files{detail}
       or $error ||= "Can't open DETAIL file: $!";

Index: cust_main.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/cust_main.pm,v
retrieving revision 1.359
retrieving revision 1.360
diff -u -d -r1.359 -r1.360
--- cust_main.pm	14 Aug 2008 11:53:40 -0000	1.359
+++ cust_main.pm	23 Aug 2008 03:29:17 -0000	1.360
@@ -37,6 +37,7 @@
 use FS::cust_refund;
 use FS::part_referral;
 use FS::cust_main_county;
+use FS::cust_tax_location;
 use FS::agent;
 use FS::cust_main_invoice;
 use FS::cust_credit_bill;

Index: Record.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/Record.pm,v
retrieving revision 1.167
retrieving revision 1.168
diff -u -d -r1.167 -r1.168
--- Record.pm	14 Aug 2008 01:58:30 -0000	1.167
+++ Record.pm	23 Aug 2008 03:29:17 -0000	1.168
@@ -312,13 +312,13 @@
     if ( $type =~ /(int|(big)?serial)/i && $value =~ /^\d+(\.\d+)?$/ ) {
       $TYPE = SQL_INTEGER;
 
-    #DBD::Pg 1.49: Cannot bind ... unknown sql_type 6
-    #} elsif (    ( $type =~ /(numeric)/i     && $value =~ /^[+-]?\d+(\.\d+)?$/)
-    #          || ( $type =~ /(real|float4)/i
-    #                 && $value =~ /[-+]?\d*\.?\d+([eE][-+]?\d+)?/
-    #             )
-    #        ) {
-    #  $TYPE = SQL_FLOAT;
+    #DBD::Pg 1.49: Cannot bind ... unknown sql_type 6 with SQL_FLOAT
+    } elsif (    ( $type =~ /(numeric)/i     && $value =~ /^[+-]?\d+(\.\d+)?$/)
+              || ( $type =~ /(real|float4)/i
+                     && $value =~ /[-+]?\d*\.?\d+([eE][-+]?\d+)?/
+                 )
+            ) {
+      $TYPE = SQL_DECIMAL;
     }
 
     if ( $DEBUG > 2 ) {



More information about the freeside-commits mailing list