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) %>
97 use Date::Parse qw(str2time);
98 use Date::Format qw(time2str);
101 my $conf = new FS::Conf;
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' ] }
120 elsif ( $object->isa('FS::cust_svc') ) {
122 $open_link = FS::TicketSystem->href_service_tickets($object->svcnum);
124 $res_link = FS::TicketSystem->href_service_tickets(
126 { 'statuses' => [ 'resolved' ] }
130 my $ss_priority = FS::TicketSystem->selfservice_priority;
131 if ( $ss_priority ) {
132 my $dir = $conf->exists('ticket_system-priority_reverse') ? -1 : 1;
134 # sort in the following way:
136 # within a severity level...
137 ( $a->{'content'} eq $b->{'content'} ) ? (
138 # no-priority tickets sort last
140 ($a->{'_selfservice_priority'} eq '') <=>
141 ($b->{'_selfservice_priority'} eq '')
143 # otherwise obey ticket_system-priority_reverse
145 ($b->{'_selfservice_priority'} <=> $a->{'_selfservice_priority'})
147 ) : 0; # but don't rearrange between severity levels
151 my $format = $conf->config('date_format') || '%Y-%m-%d';
153 my $date_formatter = sub {
154 my $time = str2time($_[0], 'GMT');
155 # exclude times within 24 hours of zero
156 ($time > 86400) ? time2str($format, $time) : '';