From 2302507c0ecd6761f4a27923b50295cfe3f35a14 Mon Sep 17 00:00:00 2001 From: Mark Wells Date: Wed, 19 Nov 2014 16:40:07 -0800 Subject: [PATCH] allow old "support time" custom field to be viewed, but not edited; #30921 --- rt/lib/RT/CustomFields.pm | 6 ++---- rt/share/html/Elements/ShowCustomFields | 13 +++++++++++++ 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/rt/lib/RT/CustomFields.pm b/rt/lib/RT/CustomFields.pm index 7c7701580..5fdac15aa 100644 --- a/rt/lib/RT/CustomFields.pm +++ b/rt/lib/RT/CustomFields.pm @@ -121,8 +121,7 @@ sub LimitToChildType { my $self = shift; my $lookup = shift; - $self->Limit( FIELD => 'LookupType', VALUE => "$lookup" ); - $self->Limit( FIELD => 'LookupType', ENDSWITH => "$lookup" ); + $self->Limit( FIELD => 'LookupType', VALUE => "$lookup", OPERATOR => "ENDSWITH" ); } @@ -137,8 +136,7 @@ sub LimitToParentType { my $self = shift; my $lookup = shift; - $self->Limit( FIELD => 'LookupType', VALUE => "$lookup" ); - $self->Limit( FIELD => 'LookupType', STARTSWITH => "$lookup" ); + $self->Limit( FIELD => 'LookupType', VALUE => "$lookup", OPERATOR => "STARTSWITH" ); } =head2 LimitToObjectId diff --git a/rt/share/html/Elements/ShowCustomFields b/rt/share/html/Elements/ShowCustomFields index 3fe51c109..387497e29 100644 --- a/rt/share/html/Elements/ShowCustomFields +++ b/rt/share/html/Elements/ShowCustomFields @@ -52,6 +52,7 @@ % while ( my $CustomField = $CustomFields->Next ) { % my $Values = $Object->CustomFieldValues( $CustomField->Id ); % my $count = $Values->Count; +% next if $count == 0 and $CustomField->Disabled; <% $CustomField->Name %>: @@ -70,6 +71,10 @@ % } +% if ( $CustomFields->IsLast ) { +% # switch to the other result set +% $CustomFields = $HiddenCustomFields; +% } % } % if ($Table) { @@ -83,6 +88,13 @@ $m->callback( CustomFields => $CustomFields, ); +# kludge to allow "Support time" to be displayed even though it's been +# removed +my $HiddenCustomFields = RT::CustomFields->new($session{'CurrentUser'}); +$HiddenCustomFields->LimitToChildType(ref $Object); +$HiddenCustomFields->Limit( FIELD => 'Type', VALUE => 'TimeValue' ); +$HiddenCustomFields->Limit( FIELD => 'Disabled', VALUE => 1 ); + # don't print anything if there is no custom fields return unless $CustomFields->First; $CustomFields->GotoFirstItem; @@ -127,5 +139,6 @@ my $print_value = sub { <%ARGS> $Object => undef $CustomFields => $Object->CustomFields + $Table => 1 -- 2.11.0