diff options
Diffstat (limited to 'rt/lib/RT/CustomField_Overlay.pm')
-rw-r--r-- | rt/lib/RT/CustomField_Overlay.pm | 44 |
1 files changed, 42 insertions, 2 deletions
diff --git a/rt/lib/RT/CustomField_Overlay.pm b/rt/lib/RT/CustomField_Overlay.pm index 5db11db00..5e868d1c5 100644 --- a/rt/lib/RT/CustomField_Overlay.pm +++ b/rt/lib/RT/CustomField_Overlay.pm @@ -97,6 +97,16 @@ our %FieldTypes = ( 'Enter one value with autocompletion', # loc 'Enter up to [_1] values with autocompletion', # loc ], + Date => [ + 'Select multiple dates', # loc + 'Select date', # loc + 'Select up to [_1] dates', # loc + ], + TimeValue => [ + 'Enter multiple time values (UNSUPPORTED)', + 'Enter a time value', + 'Enter [_1] time values (UNSUPPORTED)', + ], ); @@ -256,6 +266,10 @@ sub Create { $self->SetBasedOn( $args{'BasedOn'} ); } + if ( exists $args{'UILocation'} ) { + $self->SetUILocation( $args{'UILocation'} ); + } + return ($rv, $msg) unless exists $args{'Queue'}; # Compat code -- create a new ObjectCustomField mapping @@ -830,7 +844,7 @@ Returns an array of all possible composite values for custom fields. sub TypeComposites { my $self = shift; - return grep !/(?:[Tt]ext|Combobox)-0/, map { ("$_-1", "$_-0") } $self->Types; + return grep !/(?:[Tt]ext|Combobox|Date|TimeValue)-0/, map { ("$_-1", "$_-0") } $self->Types; } =head2 SetLookupType @@ -1161,6 +1175,15 @@ sub AddValueForObject { $extra_values--; } } + # For date, we need to store Content as ISO date + if ($self->Type eq 'Date') { + my $DateObj = new RT::Date( $self->CurrentUser ); + $DateObj->Set( + Format => 'unknown', + Value => $args{'Content'}, + ); + $args{'Content'} = $DateObj->ISO; + } my $newval = RT::ObjectCustomFieldValue->new( $self->CurrentUser ); my $val = $newval->Create( ObjectType => ref($obj), @@ -1417,7 +1440,7 @@ sub SetBasedOn { return (0, "Permission denied") unless $cf->Id && $cf->CurrentUserHasRight('SeeCustomField'); - return $self->SetAttribute( + return $self->AddAttribute( Name => "BasedOn", Description => "Custom field whose CF we depend on", Content => $cf->Id, @@ -1433,4 +1456,21 @@ sub BasedOnObj { return $obj; } +sub UILocation { + my $self = shift; + my $tag = $self->FirstAttribute( 'UILocation' ); + return $tag ? $tag->Content : ''; +} + +sub SetUILocation { + my $self = shift; + my $tag = shift; + if ( $tag ) { + return $self->SetAttribute( Name => 'UILocation', Content => $tag ); + } + else { + return $self->DeleteAttribute('UILocation'); + } +} + 1; |