X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=rt%2Flib%2FRT%2FRecord.pm;h=78bbe915d7d5a6ea0698b6f1c987faab694d0da4;hb=25591d52b441b5bfa34f0ffef1095098e1d2f1b2;hp=4f38b040523a8fa6f101d9aad66a5d5e3c389ac6;hpb=5c96d46d56f2066bb40d9a34c4db56f53f43c6f2;p=freeside.git diff --git a/rt/lib/RT/Record.pm b/rt/lib/RT/Record.pm index 4f38b0405..78bbe915d 100755 --- a/rt/lib/RT/Record.pm +++ b/rt/lib/RT/Record.pm @@ -1562,6 +1562,7 @@ sub CustomFields { $cfs->LimitToGlobalOrObjectId( $self->_LookupId( $self->CustomFieldLookupType ) ); + $cfs->ApplySortOrder; return $cfs; } @@ -1743,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 )); } @@ -1831,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 ) ); }