improve CDR usage presentation
[freeside.git] / FS / FS / Record.pm
index 9badd5b..28c6295 100644 (file)
@@ -3,7 +3,9 @@ package FS::Record;
 use strict;
 use vars qw( $AUTOLOAD @ISA @EXPORT_OK $DEBUG
              $conf $me
-             %virtual_fields_cache $nowarn_identical $no_update_diff );
+             %virtual_fields_cache
+             $nowarn_identical $no_update_diff $no_check_foreign
+           );
 use Exporter;
 use Carp qw(carp cluck croak confess);
 use Scalar::Util qw( blessed );
@@ -33,6 +35,7 @@ $me = '[FS::Record]';
 
 $nowarn_identical = 0;
 $no_update_diff = 0;
+$no_check_foreign = 0;
 
 my $rsa_module;
 my $rsa_loaded;
@@ -308,17 +311,19 @@ sub qsearch {
     my $TYPE = SQL_VARCHAR;
     if ( $type =~ /(int|(big)?serial)/i && $value =~ /^\d+(\.\d+)?$/ ) {
       $TYPE = SQL_INTEGER;
-    } 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
+    #} elsif (    ( $type =~ /(numeric)/i     && $value =~ /^[+-]?\d+(\.\d+)?$/)
+    #          || ( $type =~ /(real|float4)/i
+    #                 && $value =~ /[-+]?\d*\.?\d+([eE][-+]?\d+)?/
+    #             )
+    #        ) {
+    #  $TYPE = SQL_FLOAT;
     }
 
     if ( $DEBUG > 2 ) {
       no strict 'refs';
-      %TYPE = map { &{"DBI::$_"} => $_ } @{ $DBI::EXPORT_TAGS{sql_types} }
+      %TYPE = map { &{"DBI::$_"}() => $_ } @{ $DBI::EXPORT_TAGS{sql_types} }
         unless keys %TYPE;
       warn "  bind_param $bind (for field $field), $value, TYPE $TYPE{$TYPE}\n";
     }
@@ -1900,6 +1905,7 @@ on the column first.
 
 sub ut_foreign_key {
   my( $self, $field, $table, $foreign ) = @_;
+  return '' if $no_check_foreign;
   qsearchs($table, { $foreign => $self->getfield($field) })
     or return "Can't find ". $self->table. ".$field ". $self->getfield($field).
               " in $table.$foreign";