allow old "support time" custom field to be viewed, but not edited; #30921
authorMark Wells <mark@freeside.biz>
Thu, 20 Nov 2014 00:41:12 +0000 (16:41 -0800)
committerMark Wells <mark@freeside.biz>
Thu, 20 Nov 2014 00:41:12 +0000 (16:41 -0800)
rt/lib/RT/CustomFields.pm
rt/share/html/Elements/ShowCustomFields

index 7c77015..5fdac15 100644 (file)
@@ -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
index 3fe51c1..387497e 100644 (file)
@@ -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;
   <tr id="CF-<%$CustomField->id%>-ShowRow">
     <td class="label"><% $CustomField->Name %>:</td>
     <td class="value">
 % }
     </td>
   </tr>
+%   if ( $CustomFields->IsLast ) {
+%     # switch to the other result set
+%     $CustomFields = $HiddenCustomFields;
+%   }
 % }
 % if ($Table) {
 </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
 </%ARGS>