X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=rt%2Fshare%2Fhtml%2FElements%2FShowCustomFields;h=75e302bd34e9e90bae40d0fea3566d23b40d77f9;hb=31f3763747b82764bb019cfab5b2a2945fc9a99d;hp=3fe51c109af46eca4b7fd9c2f99a46865f7f58ac;hpb=b8988e1d3ac75af63c85e8563e57701030315a9e;p=freeside.git diff --git a/rt/share/html/Elements/ShowCustomFields b/rt/share/html/Elements/ShowCustomFields index 3fe51c109..75e302bd3 100644 --- a/rt/share/html/Elements/ShowCustomFields +++ b/rt/share/html/Elements/ShowCustomFields @@ -2,7 +2,7 @@ %# %# COPYRIGHT: %# -%# This software is Copyright (c) 1996-2014 Best Practical Solutions, LLC +%# This software is Copyright (c) 1996-2015 Best Practical Solutions, LLC %# %# %# (Except where explicitly superseded by other copyright notices) @@ -49,27 +49,31 @@ % if ($Table) { % } -% while ( my $CustomField = $CustomFields->Next ) { -% my $Values = $Object->CustomFieldValues( $CustomField->Id ); -% my $count = $Values->Count; +% foreach my $set ($CustomFields, $HiddenCustomFields) { +% $set->GotoFirstItem; +% while ( my $CustomField = $set->Next ) { +% my $Values = $Object->CustomFieldValues( $CustomField->Id ); +% my $count = $Values->Count; +% next if $count == 0 and $CustomField->Disabled; +% } % } % if ($Table) {
<% $CustomField->Name %>: -% unless ( $count ) { +% if ( $count == 0 ) { <&|/l&>(no value) -% } elsif ( $count == 1 ) { -% $print_value->( $CustomField, $Values->First ); -% } else { +% } elsif ( $count == 1 ) { +% $print_value->( $CustomField, $Values->First ); +% } else {
    -% while ( my $Value = $Values->Next ) { +% while ( my $Value = $Values->Next ) {
  • -% $print_value->( $CustomField, $Value ); +% $print_value->( $CustomField, $Value );
  • -% } +% }
-% } +% }
@@ -83,9 +87,15 @@ $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->LimitToDeleted; + # don't print anything if there is no custom fields -return unless $CustomFields->First; -$CustomFields->GotoFirstItem; +return unless $CustomFields->Count > 0 or $HiddenCustomFields->Count > 0; my $print_value = sub { my ($cf, $value) = @_; @@ -127,5 +137,6 @@ my $print_value = sub { <%ARGS> $Object => undef $CustomFields => $Object->CustomFields + $Table => 1