X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=rt%2Fshare%2Fhtml%2FElements%2FShowCustomFields;h=f632e68fe7310cb61b7eda129184e7b1b33ca4dc;hb=03b2044cdbb22cd41cf308c75d92a108e3e70816;hp=1bb61435ffb4cff2b104fe6d61d31914ec8f38dc;hpb=fc6209f398899f0211cfcedeb81a3cd65e04a941;p=freeside.git diff --git a/rt/share/html/Elements/ShowCustomFields b/rt/share/html/Elements/ShowCustomFields index 1bb61435f..f632e68fe 100644 --- a/rt/share/html/Elements/ShowCustomFields +++ b/rt/share/html/Elements/ShowCustomFields @@ -2,7 +2,7 @@ %# %# COPYRIGHT: %# -%# This software is Copyright (c) 1996-2011 Best Practical Solutions, LLC +%# This software is Copyright (c) 1996-2014 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 );
  • -% } +% }
-% } +% }
@@ -77,11 +81,22 @@ % $m->callback( CallbackName => 'AfterCustomFields', Object => $Object ); <%INIT> $m->callback( + %ARGS, CallbackName => 'MassageCustomFields', Object => $Object, 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->Count > 0 or $HiddenCustomFields->Count > 0; + my $print_value = sub { my ($cf, $value) = @_; my $linked = $value->LinkValueTo; @@ -108,13 +123,13 @@ my $print_value = sub { if ( $cf->IncludeContentForValue ) { my $vid = $value->id; $m->out( '
' ); - $m->print( loc("See also:") ); - $m->out( '' ); - $m->print( $value->IncludeContentForValue ); + $m->out( loc("See also:") ); + $m->out( '' ); + $m->out( $m->interp->apply_escapes($value->IncludeContentForValue, 'h') ); $m->out( qq{
\n} ); - $m->out( qq{\n} ); + $m->out( qq{\n} ); } }; @@ -122,5 +137,6 @@ my $print_value = sub { <%ARGS> $Object => undef $CustomFields => $Object->CustomFields + $Table => 1