Thanks, I see the problem. Here's a patch to fix the problem:
--- admin/Links/User/Modify.pm 21 Mar 2009 11:09:27 -0000 1.81
+++ admin/Links/User/Modify.pm 1 Feb 2013 04:41:42 -0000
@@ -412,7 +412,27 @@
$fset = $file->pre_file_actions(\%fcols, $new, $args, $new->{ID}) or return { error => $GT::SQL::error, %ret };
}
- $db->_check_update($new, { ID => $new->{ID} }) or return { error => $GT::SQL::error, %ret };
+# The following block of code modifies $new (so that _check_update() works
+# properly), but we don't want that later on, so make a shallow copy of it.
+ my $new_copy = { %$new };
+
+# This block of code is pulled from GT::SQL::Table::modify (minus the comments)
+ my $cols = $db->{schema}->{cols};
+ for my $col (keys %$cols) {
+ next unless exists $new_copy->{$col};
+
+ if ($cols->{$col}->{type} eq 'TIMESTAMP') {
+ delete $new_copy->{$col};
+ }
+ elsif ($cols->{$col}->{type} =~ /^(?:.*INT|INTEGER|FLOAT|REAL|DOUBLE|DECIMAL|DATE|TIME|DATETIME)$/ and defined $new_copy->{$col} and $new_copy->{$col} eq '') {
+ $new_copy->{$col} = undef;
+ }
+ elsif ($cols->{$col}->{not_null} and not (defined $new_copy->{$col} and length $new_copy->{$col})) {
+ $new_copy->{$col} = undef;
+ }
+ }
+
+ $db->_check_update($new_copy, { ID => $new_copy->{ID} }) or return { error => $GT::SQL::error, %ret };
}
# Make sure the category id's are valid
Adrian
Code:
diff -u -r1.81 Modify.pm --- admin/Links/User/Modify.pm 21 Mar 2009 11:09:27 -0000 1.81
+++ admin/Links/User/Modify.pm 1 Feb 2013 04:41:42 -0000
@@ -412,7 +412,27 @@
$fset = $file->pre_file_actions(\%fcols, $new, $args, $new->{ID}) or return { error => $GT::SQL::error, %ret };
}
- $db->_check_update($new, { ID => $new->{ID} }) or return { error => $GT::SQL::error, %ret };
+# The following block of code modifies $new (so that _check_update() works
+# properly), but we don't want that later on, so make a shallow copy of it.
+ my $new_copy = { %$new };
+
+# This block of code is pulled from GT::SQL::Table::modify (minus the comments)
+ my $cols = $db->{schema}->{cols};
+ for my $col (keys %$cols) {
+ next unless exists $new_copy->{$col};
+
+ if ($cols->{$col}->{type} eq 'TIMESTAMP') {
+ delete $new_copy->{$col};
+ }
+ elsif ($cols->{$col}->{type} =~ /^(?:.*INT|INTEGER|FLOAT|REAL|DOUBLE|DECIMAL|DATE|TIME|DATETIME)$/ and defined $new_copy->{$col} and $new_copy->{$col} eq '') {
+ $new_copy->{$col} = undef;
+ }
+ elsif ($cols->{$col}->{not_null} and not (defined $new_copy->{$col} and length $new_copy->{$col})) {
+ $new_copy->{$col} = undef;
+ }
+ }
+
+ $db->_check_update($new_copy, { ID => $new_copy->{ID} }) or return { error => $GT::SQL::error, %ret };
}
# Make sure the category id's are valid
Adrian