From 36b042b1f07afccc028121eef918fb3985e76eaa Mon Sep 17 00:00:00 2001 From: Mark Wells Date: Tue, 10 Apr 2012 16:01:59 -0700 Subject: [PATCH] time worked reports for RT custom fields, #17230 --- httemplate/elements/select-rt-customfield.html | 34 +++++++ httemplate/search/report_rt_ticket.html | 32 ++++++- httemplate/search/report_rt_transaction.html | 13 ++- httemplate/search/rt_ticket.html | 125 +++++++++++++++++-------- httemplate/search/rt_transaction.html | 125 +++++++++++++++++-------- 5 files changed, 250 insertions(+), 79 deletions(-) create mode 100644 httemplate/elements/select-rt-customfield.html 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 @@ + +<%once> +RT::Init(); + +<%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); +} + diff --git a/httemplate/search/report_rt_ticket.html b/httemplate/search/report_rt_ticket.html index 79a601b4b..f0d7a4200 100644 --- a/httemplate/search/report_rt_ticket.html +++ b/httemplate/search/report_rt_ticket.html @@ -6,10 +6,20 @@ <% include ( '/elements/tr-input-beginning_ending.html' ) %> + <& /elements/tr-td-label.html, label => 'Time category:' &> + + <& /elements/select-rt-customfield.html, + name => 'cfname', + lookuptype => 'RT::Transaction', + valuetype => 'TimeValue', + empty_label => 'Worked', + &> + + <% include ( '/elements/tr-select-otaker.html' ) %> - Account + Account: