summaryrefslogtreecommitdiff
path: root/rt
diff options
context:
space:
mode:
authorIvan Kohler <ivan@freeside.biz>2014-12-04 10:37:16 -0800
committerIvan Kohler <ivan@freeside.biz>2014-12-04 10:37:16 -0800
commit8dd41f364aaba88969dfd0908feb22709025e7f6 (patch)
tree471cb3796019d873da648413d88ca70a657414ed /rt
parenta2df4ef9575be1ae2f1f5b9089f121316f796bac (diff)
parentbf50a8356a7344b4f75c7bc7f952019b98867f26 (diff)
Merge branch 'master' of git.freeside.biz:/home/git/freeside
Diffstat (limited to 'rt')
-rw-r--r--rt/lib/RT/CustomFields.pm6
-rw-r--r--rt/share/html/Elements/ShowCustomFields37
2 files changed, 26 insertions, 17 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..f632e68fe 100644
--- a/rt/share/html/Elements/ShowCustomFields
+++ b/rt/share/html/Elements/ShowCustomFields
@@ -49,27 +49,31 @@
% if ($Table) {
<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;
<tr id="CF-<%$CustomField->id%>-ShowRow">
<td class="label"><% $CustomField->Name %>:</td>
<td class="value">
-% unless ( $count ) {
+% if ( $count == 0 ) {
<i><&|/l&>(no value)</&></i>
-% } elsif ( $count == 1 ) {
-% $print_value->( $CustomField, $Values->First );
-% } else {
+% } elsif ( $count == 1 ) {
+% $print_value->( $CustomField, $Values->First );
+% } else {
<ul>
-% while ( my $Value = $Values->Next ) {
+% while ( my $Value = $Values->Next ) {
<li>
-% $print_value->( $CustomField, $Value );
+% $print_value->( $CustomField, $Value );
</li>
-% }
+% }
</ul>
-% }
+% }
</td>
</tr>
+% }
% }
% if ($Table) {
</table>
@@ -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
</%ARGS>