summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorivan <ivan>2003-05-08 09:34:43 +0000
committerivan <ivan>2003-05-08 09:34:43 +0000
commit2dea7078530a565f2300b52b6d235b5eaf2df9e0 (patch)
treea4bbc20dcf5df18e8ed9bf15528f0963bf989225
parent9b0f7114f88501c962df86511dbe2a42c8b1cde5 (diff)
general Pg 7.3 fix for setting int columns to '' / NULLfreeside_1_4_1rc2
-rw-r--r--FS/FS/Record.pm22
-rw-r--r--Makefile4
2 files changed, 17 insertions, 9 deletions
diff --git a/FS/FS/Record.pm b/FS/FS/Record.pm
index d783870cc..5cf77d3e7 100644
--- a/FS/FS/Record.pm
+++ b/FS/FS/Record.pm
@@ -1167,15 +1167,23 @@ type (see L<DBIx::DBSchema::Column>) does not end in `char' or `binary'.
=cut
sub _quote {
- my($value,$table,$field)=@_;
- my($dbh)=dbh;
- if ( $value =~ /^\d+(\.\d+)?$/ &&
-# ! ( datatype($table,$field) =~ /^char/ )
- ! $dbdef->table($table)->column($field)->type =~ /(char|binary|text)$/i
- ) {
+ my($value, $table, $column) = @_;
+ my $column_obj = $dbdef->table($table)->column($column);
+ my $column_type = $column_obj->type;
+
+ if ( $value eq '' && $column_type =~ /^int/ ) {
+ if ( $column_obj->null ) {
+ 'NULL';
+ } else {
+ cluck "WARNING: Attempting to set non-null integer $table.$column null; ".
+ "using 0 instead";
+ 0;
+ }
+ } elsif ( $value =~ /^\d+(\.\d+)?$/ &&
+ ! $column_type =~ /(char|binary|text)$/i ) {
$value;
} else {
- $dbh->quote($value);
+ dbh->quote($value);
}
}
diff --git a/Makefile b/Makefile
index dfd3c0607..c48f5e91a 100644
--- a/Makefile
+++ b/Makefile
@@ -45,8 +45,8 @@ SELFSERVICE_MACHINE = localhost
#not changable yet
FREESIDE_CONF = /usr/local/etc/freeside
-VERSION=1.4.1rc1
-TAG=freeside_1_4_1rc1
+VERSION=1.4.1rc2
+TAG=freeside_1_4_1rc2
help:
@echo "supported targets: aspdocs masondocs alldocs docs install-docs"