diff options
author | ivan <ivan> | 2010-07-20 00:59:02 +0000 |
---|---|---|
committer | ivan <ivan> | 2010-07-20 00:59:02 +0000 |
commit | 25591d52b441b5bfa34f0ffef1095098e1d2f1b2 (patch) | |
tree | 3f2881729adba24830ac73690523a1c5e64987b7 /rt/lib/RT/Record.pm | |
parent | 1a62d4a284a58919716f076baa594f02dda2472d (diff) |
RT custom fields patch, RT#8449
Diffstat (limited to 'rt/lib/RT/Record.pm')
-rwxr-xr-x | rt/lib/RT/Record.pm | 31 |
1 files changed, 30 insertions, 1 deletions
diff --git a/rt/lib/RT/Record.pm b/rt/lib/RT/Record.pm index bee9442..78bbe91 100755 --- a/rt/lib/RT/Record.pm +++ b/rt/lib/RT/Record.pm @@ -1744,6 +1744,25 @@ sub _AddCustomFieldValue { } my $new_content = $new_value->Content; + + # For date, we need to display them in "human" format in result message + if ($cf->Type eq 'Date') { + my $DateObj = new RT::Date( $self->CurrentUser ); + $DateObj->Set( + Format => 'ISO', + Value => $new_content, + ); + $new_content = $DateObj->AsString; + + if ( defined $old_content && length $old_content ) { + $DateObj->Set( + Format => 'ISO', + Value => $old_content, + ); + $old_content = $DateObj->AsString; + } + } + unless ( defined $old_content && length $old_content ) { return ( $new_value_id, $self->loc( "[_1] [_2] added", $cf->Name, $new_content )); } @@ -1832,11 +1851,21 @@ sub DeleteCustomFieldValue { return ( 0, $self->loc( "Couldn't create a transaction: [_1]", $Msg ) ); } + my $old_value = $TransactionObj->OldValue; + # For date, we need to display them in "human" format in result message + if ( $cf->Type eq 'Date' ) { + my $DateObj = new RT::Date( $self->CurrentUser ); + $DateObj->Set( + Format => 'ISO', + Value => $old_value, + ); + $old_value = $DateObj->AsString; + } return ( $TransactionId, $self->loc( "[_1] is no longer a value for custom field [_2]", - $TransactionObj->OldValue, $cf->Name + $old_value, $cf->Name ) ); } |