summaryrefslogtreecommitdiff
path: root/httemplate/elements/select-rt-customfield.html
diff options
context:
space:
mode:
authorMark Wells <mark@freeside.biz>2012-04-10 16:01:59 -0700
committerMark Wells <mark@freeside.biz>2012-04-10 16:02:46 -0700
commit36b042b1f07afccc028121eef918fb3985e76eaa (patch)
tree60ca0a4bd4b92c3e1c61992c67a0f19083e07b89 /httemplate/elements/select-rt-customfield.html
parent85ae8035888f10fd8075be3234f8e981f5004557 (diff)
time worked reports for RT custom fields, #17230
Diffstat (limited to 'httemplate/elements/select-rt-customfield.html')
-rw-r--r--httemplate/elements/select-rt-customfield.html34
1 files changed, 34 insertions, 0 deletions
diff --git a/httemplate/elements/select-rt-customfield.html b/httemplate/elements/select-rt-customfield.html
new file mode 100644
index 000000000..7a45bb14b
--- /dev/null
+++ b/httemplate/elements/select-rt-customfield.html
@@ -0,0 +1,34 @@
+<SELECT NAME="<% $opt{name} %>">
+% while ( @fields ) {
+<OPTION VALUE="<% shift @fields %>"><% shift @fields %></OPTION>
+% }
+</SELECT>
+<%once>
+RT::Init();
+</%once>
+<%init>
+my %opt = @_;
+my $lookuptype = $opt{lookuptype};
+my $valuetype = $opt{valuetype};
+# get a list of TimeValue-type custom fields
+my $CurrentUser = RT::CurrentUser->new();
+$CurrentUser->LoadByName($FS::CurrentUser::CurrentUser->username);
+die "RT not configured" unless $CurrentUser->id;
+my $CFs = RT::CustomFields->new($CurrentUser);
+
+$CFs->Limit(FIELD => 'LookupType',
+ OPERATOR => 'ENDSWITH',
+ VALUE => $lookuptype)
+ if $lookuptype;
+
+$CFs->Limit(FIELD => 'Type',
+ VALUE => $valuetype)
+ if $valuetype;
+
+my @fields;
+push @fields, '', $opt{empty_label} if exists($opt{empty_label});
+
+while (my $CF = $CFs->Next) {
+ push @fields, $CF->Name, ($CF->Description || $CF->Name);
+}
+</%init>