Gossamer Forum
Home : Products : Gossamer Links : Discussions :

Re: [eupos] Problems with modifications

Quote Reply
Re: [eupos] Problems with modifications In reply to
Thanks, I see the problem. Here's a patch to fix the problem:

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
Subject Author Views Date
Thread Problems with modifications katakombe 20907 Jan 30, 2013, 7:20 AM
Thread Re: [katakombe] Problems with modifications
Andy 20531 Jan 30, 2013, 8:47 AM
Thread Re: [Andy] Problems with modifications
katakombe 20504 Jan 30, 2013, 8:53 AM
Post Re: [katakombe] Problems with modifications
Andy 20507 Jan 30, 2013, 9:09 AM
Thread Re: [katakombe] Problems with modifications
eupos 20555 Jan 30, 2013, 9:14 AM
Thread Re: [eupos] Problems with modifications
katakombe 20496 Jan 30, 2013, 9:32 AM
Thread Re: [katakombe] Problems with modifications
eupos 20522 Jan 30, 2013, 9:49 AM
Post Post deleted by katakombe
katakombe 20520 Jan 30, 2013, 10:00 AM
Thread Re: [eupos] Problems with modifications
katakombe 20461 Jan 30, 2013, 10:08 AM
Thread Re: [katakombe] Problems with modifications
eupos 20463 Jan 30, 2013, 10:52 AM
Thread Re: [eupos] Problems with modifications
katakombe 20480 Jan 30, 2013, 8:26 PM
Post Re: [katakombe] Problems with modifications
eupos 20354 Jan 30, 2013, 10:02 PM
Thread Re: [katakombe] Problems with modifications
brewt 20314 Jan 31, 2013, 4:46 PM
Thread Re: [brewt] Problems with modifications
eupos 20275 Jan 31, 2013, 4:53 PM
Thread Re: [eupos] Problems with modifications
brewt 20294 Jan 31, 2013, 8:45 PM
Thread Re: [brewt] Problems with modifications
eupos 20260 Jan 31, 2013, 9:30 PM
Thread Re: [eupos] Problems with modifications
brewt 20031 Feb 1, 2013, 12:51 PM
Post Re: [brewt] Problems with modifications
eupos 20061 Feb 1, 2013, 12:55 PM
Post Re: [brewt] Problems with modifications
VishalT 20009 Feb 1, 2013, 5:42 PM
Thread Re: [brewt] Problems with modifications
Andy 19907 Feb 2, 2013, 12:34 AM
Thread Re: [Andy] Problems with modifications
brewt 4271 Feb 4, 2013, 11:40 AM
Post Re: [brewt] Problems with modifications
Andy 4220 Feb 4, 2013, 11:44 AM
Post Re: [brewt] Problems with modifications
LordStryfe 4095 Feb 21, 2013, 7:14 PM
Thread Re: [brewt] Problems with modifications
katakombe 20257 Feb 1, 2013, 6:36 AM
Thread Re: [katakombe] Problems with modifications
Andy 20113 Feb 1, 2013, 8:01 AM
Thread Re: [Andy] Problems with modifications
katakombe 20140 Feb 1, 2013, 8:08 AM
Post Re: [katakombe] Problems with modifications
eupos 20099 Feb 1, 2013, 8:17 AM
Post Re: [katakombe] Problems with modifications
eupos 20128 Feb 1, 2013, 8:06 AM