1 <& /elements/form-create_ticket.html, object => $object &>
4 <A HREF="<% $open_link %>"><% mt($openlabel) |h %></A> |
5 <A HREF="<% $res_link %>"><% mt('resolved') |h %></A>
8 <& /elements/table-grid.html &>
9 % my $bgcolor1 = '#eeeeee';
10 % my $bgcolor2 = '#ffffff';
14 <TH CLASS="grid" BGCOLOR="#cccccc"><% mt('#') |h %></TH>
15 <TH CLASS="grid" BGCOLOR="#cccccc"><% mt('Subject') |h %></TH>
16 <TH CLASS="grid" BGCOLOR="#cccccc"><% mt('Status') |h %></TH>
17 <TH CLASS="grid" BGCOLOR="#cccccc"><% mt('Queue') |h %></TH>
18 <TH CLASS="grid" BGCOLOR="#cccccc"><% mt('Owner') |h %></TH>
19 <TH CLASS="grid" BGCOLOR="#cccccc"><% mt('Due') |h %></TH>
20 <TH CLASS="grid" BGCOLOR="#cccccc"><% mt('Estimated Time') |h %></TH>
21 <TH CLASS="grid" BGCOLOR="#cccccc"><% mt('Priority') |h %></TH>
22 % if ( $ss_priority ) {
23 <TH CLASS="grid" BGCOLOR="#cccccc"><% mt('Customer Priority') |h %></TH>
25 % if ( $object->isa('FS::cust_main') ) {
26 <TH CLASS="grid" BGCOLOR="#cccccc"><% mt('Service') |h %></TH>
30 % foreach my $ticket ( @tickets ) {
31 % my $href = FS::TicketSystem->href_ticket($ticket->{id});
32 % if ( $bgcolor eq $bgcolor1 ) {
33 % $bgcolor = $bgcolor2;
35 % $bgcolor = $bgcolor1;
40 <TD CLASS="grid" BGCOLOR="<% $bgcolor %>">
41 <A HREF=<%$href%>><% $ticket->{id} %></A>
44 <TD CLASS="grid" BGCOLOR="<% $bgcolor %>">
45 <A HREF=<%$href%>><% $ticket->{subject} %></A>
48 <TD CLASS="grid" BGCOLOR="<% $bgcolor %>">
49 <% $ticket->{status} %>
52 <TD CLASS="grid" BGCOLOR="<% $bgcolor %>">
53 <% $ticket->{queue} %>
56 <TD CLASS="grid" BGCOLOR="<% $bgcolor %>">
57 <% $ticket->{owner} %>
60 <TD CLASS="grid" BGCOLOR="<% $bgcolor %>">
61 <% $date_formatter->($ticket->{due}) %>
64 <TD ALIGN="right" CLASS="grid" BGCOLOR="<% $bgcolor %>">
65 <% $ticket->{timeestimated} %>
68 <TD ALIGN="right" CLASS="grid" BGCOLOR="<% $bgcolor %>">
70 ? $ticket->{content}.' ('.$ticket->{priority}.')'
75 % if ( $ss_priority ) {
76 <TD ALIGN="right" CLASS="grid" BGCOLOR="<% $bgcolor %>">
77 <% $ticket->{"CF.{$ss_priority}"} %>
80 % if ( $object->isa('FS::cust_main') ) {
81 <TD CLASS="grid" BGCOLOR="<% $bgcolor %>"><FONT SIZE=-1><B>
82 % foreach (@{ $ticket->{svcnums} }) {
83 % my $cust_svc = FS::cust_svc->by_key($_) or next;
84 <% FS::UI::Web::svc_label_link($m, $cust_svc->part_svc, $cust_svc) %>
99 my $conf = new FS::Conf;
101 return '' unless $conf->config('ticket_system');
103 my $object = $opt{'object'};
104 $object = $object->cust_svc if $object->isa('FS::svc_Common');
105 my( @tickets ) = $object->tickets;
107 my ($openlabel, $open_link, $res_link, $thing);
108 $openlabel = join('/', FS::TicketSystem->statuses );
110 # not the nicest way to do this--FS::has_tickets_Common?
111 if ( $object->isa('FS::cust_main') ) {
113 $open_link = FS::TicketSystem->href_customer_tickets($object->custnum);
115 $res_link = FS::TicketSystem->href_customer_tickets(
117 { 'statuses' => [ 'resolved' ] }
119 } elsif ( $object->isa('FS::cust_svc') ) {
121 return '' unless $object->pkgnum;
124 $open_link = FS::TicketSystem->href_service_tickets($object->svcnum);
126 $res_link = FS::TicketSystem->href_service_tickets(
128 { 'statuses' => [ 'resolved' ] }
132 my $ss_priority = FS::TicketSystem->selfservice_priority;
133 if ( $ss_priority ) {
134 my $dir = $conf->exists('ticket_system-priority_reverse') ? -1 : 1;
136 # sort in the following way:
138 # within a severity level...
139 ( $a->{'content'} eq $b->{'content'} ) ? (
140 # no-priority tickets sort last
142 ($a->{'_selfservice_priority'} eq '') <=>
143 ($b->{'_selfservice_priority'} eq '')
145 # otherwise obey ticket_system-priority_reverse
147 ($b->{'_selfservice_priority'} <=> $a->{'_selfservice_priority'})
149 ) : 0; # but don't rearrange between severity levels
153 my $format = $conf->config('date_format') || '%Y-%m-%d';
155 my $date_formatter = sub {
156 my $time = parse_datetime($_[0], 'GMT');
157 # exclude times within 24 hours of zero
158 ($time > 86400) ? time2str($format, $time) : '';