X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=rt%2Fshare%2Fhtml%2FSearch%2FElements%2FPickCFs;h=1c9f2a918a5be45e7482acc18c862c7d550dc73a;hb=b8988e1d3ac75af63c85e8563e57701030315a9e;hp=9abab444327327e55ba68f6d56e0701d6ddc68d0;hpb=b5c4237a34aef94976bc343c8d9e138664fc3984;p=freeside.git diff --git a/rt/share/html/Search/Elements/PickCFs b/rt/share/html/Search/Elements/PickCFs index 9abab4443..1c9f2a918 100644 --- a/rt/share/html/Search/Elements/PickCFs +++ b/rt/share/html/Search/Elements/PickCFs @@ -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,24 +49,6 @@ <& ConditionRow, Condition => $_ &> % } <%INIT> -my $CustomFields = RT::CustomFields->new( $session{'CurrentUser'}); -foreach my $id (keys %cfqueues) { - # Gotta load up the $queue object, since queues get stored by name now. my $id - my $queue = RT::Queue->new($session{'CurrentUser'}); - $queue->Load($id); - unless ($queue->id) { - # XXX TODO: This ancient code dates from a former developer - # we have no idea what it means or why cfqueues are so encoded. - $id =~ s/^.'*(.*).'*$/$1/; - - # unescape internal quotes - $id =~ s/(\\(.))/$2 eq "'" ? "'" : $1/eg; - - $queue->Load($id); - } - $CustomFields->LimitToQueue($queue->Id); -} -$CustomFields->LimitToGlobal; $m->callback( CallbackName => 'MassageCustomFields', CustomFields => $CustomFields, @@ -76,16 +58,23 @@ $m->callback( my @lines; while ( my $CustomField = $CustomFields->Next ) { my %line; - $line{'Name'} = "'CF.{" . $CustomField->Name . "}'"; + $line{'Name'} = "'$TicketSQLField.{" . $CustomField->Name . "}'"; $line{'Field'} = $CustomField->Name; # Op - if ($CustomField->Type eq 'Date') { + if ($CustomField->Type =~ /^Date(Time)?$/ ) { $line{'Op'} = { Type => 'component', Path => '/Elements/SelectDateRelation', Arguments => {}, }; + } + elsif ($CustomField->Type =~ /^IPAddress(Range)?$/ ) { + $line{'Op'} = { + Type => 'component', + Path => '/Elements/SelectIPRelation', + Arguments => {}, + }; } else { $line{'Op'} = { Type => 'component', @@ -99,11 +88,12 @@ while ( my $CustomField = $CustomFields->Next ) { } # Value - if ($CustomField->Type eq 'Date') { + if ($CustomField->Type =~ /^Date(Time)?$/) { + my $is_datetime = $1 ? 1 : 0; $line{'Value'} = { Type => 'component', Path => '/Elements/SelectDate', - Arguments => {}, + Arguments => { $is_datetime ? (ShowTime => 1) : (ShowTime => 0), }, }; } else { $line{'Value'} = { @@ -116,10 +106,12 @@ while ( my $CustomField = $CustomFields->Next ) { push @lines, \%line; } -$m->callback( Conditions => \@lines, Queues => \%cfqueues ); +$m->callback( Conditions => \@lines, Queues => \%queues ); <%ARGS> -%cfqueues => undef +%queues => () +$CustomFields +$TicketSQLField => 'CF'