[Rt-commit] r8304 - rt/branches/3.7-EXPERIMENTAL-TUNIS/lib/RT
ruz at bestpractical.com
ruz at bestpractical.com
Thu Jul 26 17:34:11 EDT 2007
Author: ruz
Date: Thu Jul 26 17:34:10 2007
New Revision: 8304
Modified:
rt/branches/3.7-EXPERIMENTAL-TUNIS/lib/RT/Record.pm
Log:
* add support for 0 as value of a CF in Record::AddCustomFieldValue
Modified: rt/branches/3.7-EXPERIMENTAL-TUNIS/lib/RT/Record.pm
==============================================================================
--- rt/branches/3.7-EXPERIMENTAL-TUNIS/lib/RT/Record.pm (original)
+++ rt/branches/3.7-EXPERIMENTAL-TUNIS/lib/RT/Record.pm Thu Jul 26 17:34:10 2007
@@ -1563,8 +1563,26 @@
my ( $old_value, $old_content );
if ( $old_value = $values->First ) {
$old_content = $old_value->Content;
- return ($old_value->id) if ( $old_content || '' ) eq ( $args{'Value'} || '' ) &&
- ( $old_value->LargeContent || '' ) eq ( $args{'LargeContent'} || '' );
+ $old_content = undef if defined $old_content && !length $old_content;
+
+ my $is_the_same = 1;
+ if ( defined $args{'Value'} ) {
+ $is_the_same = 0 unless defined $old_content
+ && lc $old_value eq lc $args{'Value'};
+ } else {
+ $is_the_same = 0 if defined $old_content;
+ }
+ if ( $is_the_same ) {
+ my $old_content = $old_value->LargeContent;
+ if ( defined $args{'LargeContent'} ) {
+ $is_the_same = 0 unless defined $old_content
+ && $old_content eq $args{'LargeContent'};
+ } else {
+ $is_the_same = 0 if defined $old_content;
+ }
+ }
+
+ return $old_value->id if $is_the_same;
}
my ( $new_value_id, $value_msg ) = $cf->AddValueForObject(
@@ -1598,10 +1616,10 @@
}
my $new_content = $new_value->Content;
- if ( !defined $old_content || $old_content eq '' ) {
+ unless ( defined $old_content && length $old_content ) {
return ( $new_value_id, $self->loc( "[_1] [_2] added", $cf->Name, $new_content ));
}
- elsif ( !defined $new_content || $new_content eq '' ) {
+ elsif ( !defined $new_content || !length $new_content ) {
return ( $new_value_id,
$self->loc( "[_1] [_2] deleted", $cf->Name, $old_content ) );
}
More information about the Rt-commit
mailing list