summaryrefslogtreecommitdiff
path: root/httemplate/search/report_rt_ticket.html
blob: 7abc3e8cc3e30515def5e7be8e974740f16ebdda (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
<% include('/elements/header.html', 'Time worked summary report criteria' ) %>

<FORM ACTION="rt_ticket.html" METHOD="GET">

<TABLE>

  <% include ( '/elements/tr-input-beginning_ending.html' ) %>

  <& /elements/tr-select.html,
      label       => 'Time category:',
      field       => 'category',
      options     => [ '', 'development', 'support' ],
      option_labels => { '' => 'all' },
      curr_value  => 'development',
  &>

  <% include ( '/elements/tr-select-otaker.html' ) %>

  <TR>
    <TD ALIGN="right">Account:</TD>
    <TD>
      <SELECT NAME="svcnum">
        <OPTION VALUE="">(all)
%       foreach my $svc_acct (@svc_acct) {
          <OPTION VALUE="<% $svc_acct->svcnum %>"><% $svc_acct->email %></OPTION>
%       }
      </SELECT>
    </TD>
  </TR>

</TABLE>

<BR>
<INPUT TYPE="submit" VALUE="Search">

</FORM>

<% include('/elements/footer.html') %>
<%init>

die "access denied"
  unless $FS::CurrentUser::CurrentUser->access_right('List rating data');

my $conf = new FS::Conf;

my @pkgparts = $conf->config('support_packages');

my @svc_acct = ();
if ( @pkgparts ) {
  @svc_acct = qsearch({
    'table'     => 'svc_acct',
    'addl_from' => ' LEFT JOIN cust_svc USING ( svcnum ) '.
                   ' LEFT JOIN cust_pkg USING ( pkgnum ) ',
    'extra_sql' => 'WHERE pkgpart IN ('. join(',', @pkgparts). ')',
    'order_by'  => 'ORDER BY username',
  });
}

# 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 => 'RT::Transaction');

$CFs->Limit(FIELD => 'Type',
            VALUE => 'TimeValue');

</%init>