[Rt-commit] rt branch, 4.2/allow-undef-values, created. rt-4.2.11-38-gda9149d
Todd Wade
todd at bestpractical.com
Tue Aug 11 07:17:00 EDT 2015
The branch, 4.2/allow-undef-values has been created
at da9149d3af741dd0f02c9ac8dad17c8d3b38c96b (commit)
- Log -----------------------------------------------------------------
commit da9149d3af741dd0f02c9ac8dad17c8d3b38c96b
Author: Todd Wade <todd at bestpractical.com>
Date: Tue Aug 11 07:15:20 2015 -0400
Allow setting db fields to NULL
$obj->Set...( undef ) should set a field to NULL
diff --git a/lib/RT/Record.pm b/lib/RT/Record.pm
index 7cf116a..a0456c1 100644
--- a/lib/RT/Record.pm
+++ b/lib/RT/Record.pm
@@ -496,8 +496,8 @@ sub _Set {
#if the user is trying to modify the record
# TODO: document _why_ this code is here
- if ( ( !defined( $args{'Field'} ) ) || ( !defined( $args{'Value'} ) ) ) {
- $args{'Value'} = 0;
+ if ( ( !defined( $args{'Field'} ) ) || ( !exists( $args{'Value'} ) ) ) {
+ $args{'Value'} = 0;
}
my $old_val = $self->__Value($args{'Field'});
@@ -524,7 +524,7 @@ sub _Set {
"[_1] changed from [_2] to [_3]",
$self->loc( $args{'Field'} ),
( $old_val ? '"' . $old_val . '"' : $self->loc("(no value)") ),
- '"' . $self->__Value( $args{'Field'}) . '"',
+ '"' . ($self->__Value( $args{'Field'}) || 'undef') . '"',
);
}
} else {
-----------------------------------------------------------------------
More information about the rt-commit
mailing list