Will things ever be the same again?
[freeside.git] / httemplate / view / cust_main / tickets.html
1 %
2 %  my( $cust_main ) = @_;
3 %
4 %  my $conf = new FS::Conf;
5 %  my $num = $conf->config('cust_main-max_tickets') || 10;
6 %
7 %  my @tickets = ();
8 %  unless ( $conf->config('ticket_system-custom_priority_field') ) {
9 %
10 %    @tickets =
11 %      @{ FS::TicketSystem->customer_tickets($cust_main->custnum, $num) };
12 %
13 %  } else {
14 %
15 %    foreach my $priority (
16 %      $conf->config('ticket_system-custom_priority_field-values'), ''
17 %    ) {
18 %      last if scalar(@tickets) >= $num;
19 %      push @tickets, 
20 %        @{ FS::TicketSystem->customer_tickets( $cust_main->custnum,
21 %                                               $num - scalar(@tickets),
22 %                                               $priority,
23 %                                             )
24 %         };
25 %    }
26 %
27 %  }
28 %
29 %
30
31
32 Highest priority tickets
33 (<A HREF="<% FS::TicketSystem->href_customer_tickets($cust_main->custnum) %>">View all tickets for this customer</A>)
34 (<A HREF="<% FS::TicketSystem->href_new_ticket($cust_main, join(', ', grep { $_ !~ /^(POST|FAX)$/ } $cust_main->invoicing_list ) ) %>">New ticket for this customer</A>)
35
36 <% include("/elements/table-grid.html") %>
37 % my $bgcolor1 = '#eeeeee';
38 %   my $bgcolor2 = '#ffffff';
39 %   my $bgcolor = '';
40 %
41
42
43 <TR>
44   <TH CLASS="grid" BGCOLOR="#cccccc">#</TH>
45   <TH CLASS="grid" BGCOLOR="#cccccc">Subject</TH>
46   <TH CLASS="grid" BGCOLOR="#cccccc">Priority</TH>
47   <TH CLASS="grid" BGCOLOR="#cccccc">Queue</TH>
48   <TH CLASS="grid" BGCOLOR="#cccccc">Status</TH>
49 </TR>
50 % foreach my $ticket ( @tickets ) {
51 %     my $href = FS::TicketSystem->href_ticket($ticket->{id});
52 %     if ( $bgcolor eq $bgcolor1 ) {
53 %       $bgcolor = $bgcolor2;
54 %     } else {
55 %       $bgcolor = $bgcolor1;
56 %     }
57 %
58
59
60 <TR>
61
62   <TD CLASS="grid" BGCOLOR="<% $bgcolor %>"><A HREF=<%$href%>><% $ticket->{id} %></A></TD>
63
64   <TD CLASS="grid" BGCOLOR="<% $bgcolor %>"><A HREF=<%$href%>><% $ticket->{subject} %></A></TD>
65
66   <TD ALIGN="right" CLASS="grid" BGCOLOR="<% $bgcolor %>"><% $ticket->{content} || $ticket->{priority} %></TD>
67
68   <TD CLASS="grid" BGCOLOR="<% $bgcolor %>"><% $ticket->{name} %></TD>
69
70   <TD CLASS="grid" BGCOLOR="<% $bgcolor %>"><% $ticket->{status} %></TD>
71
72 </TR>
73 % } 
74
75
76 </TABLE>
77