1 <FORM METHOD="GET" NAME="CreateTicketForm" STYLE="display:inline">
2 <SCRIPT TYPE="text/javascript">
3 function updateTicketLink() {
4 var link = document.getElementById('CreateTicketLink');
5 var selector = document.getElementById('Queue')
6 link.href = "<% $new_base.'?'.
8 { ($_ eq 'Queue') ? () : "$_=$new_param{$_}"}
9 keys %new_param),'Queue=') %>" + selector.options[selector.selectedIndex].value;
12 <A id="CreateTicketLink" HREF="<% $new_link %>"><% mt('Create new ticket') |h %></A>
13 <% mt('in queue') |h %>
14 %# fetch list of queues in which the user can create tickets
15 % my %queues = FS::TicketSystem->queues('', 'CreateTicket');
16 % if( $conf->exists('ticket_system-force_default_queueid') ) {
17 <B><% $queues{$new_param{'Queue'}} %></B>
18 <INPUT TYPE="hidden" NAME="Queue" VALUE="<% $new_param{'Queue'} %>">
21 <SELECT NAME="Queue" id="Queue" onchange="updateTicketLink()">
22 % foreach my $queueid ( sort { $queues{$a} cmp $queues{$b} } keys %queues ) {
23 <OPTION VALUE="<% $queueid %>"
24 <% $queueid == $new_param{'Queue'} ? 'SELECTED' : '' %>
25 ><% $queues{$queueid} |h %>
28 <SCRIPT DEFER TYPE="text/javascript">updateTicketLink();</SCRIPT>
33 (<A HREF="<% $open_link %>"><% mt("View $openlabel tickets for this customer") |h %></A>)
34 (<A HREF="<% $res_link %>"><% mt('View resolved tickets for this customer') |h %></A>)
37 <& /elements/table-grid.html &>
38 % my $bgcolor1 = '#eeeeee';
39 % my $bgcolor2 = '#ffffff';
43 <TH CLASS="grid" BGCOLOR="#cccccc"><% mt('#') |h %></TH>
44 <TH CLASS="grid" BGCOLOR="#cccccc"><% mt('Subject') |h %></TH>
45 <TH CLASS="grid" BGCOLOR="#cccccc"><% mt('Status') |h %></TH>
46 <TH CLASS="grid" BGCOLOR="#cccccc"><% mt('Queue') |h %></TH>
47 <TH CLASS="grid" BGCOLOR="#cccccc"><% mt('Owner') |h %></TH>
48 <TH CLASS="grid" BGCOLOR="#cccccc"><% mt('Due') |h %></TH>
49 <TH CLASS="grid" BGCOLOR="#cccccc"><% mt('Estimated Time') |h %></TH>
50 <TH CLASS="grid" BGCOLOR="#cccccc"><% mt('Priority') |h %></TH>
51 % if ( $ss_priority ) {
52 <TH CLASS="grid" BGCOLOR="#cccccc"><% mt('Customer Priority') |h %></TH>
56 % foreach my $ticket ( @tickets ) {
57 % my $href = FS::TicketSystem->href_ticket($ticket->{id});
58 % if ( $bgcolor eq $bgcolor1 ) {
59 % $bgcolor = $bgcolor2;
61 % $bgcolor = $bgcolor1;
66 <TD CLASS="grid" BGCOLOR="<% $bgcolor %>">
67 <A HREF=<%$href%>><% $ticket->{id} %></A>
70 <TD CLASS="grid" BGCOLOR="<% $bgcolor %>">
71 <A HREF=<%$href%>><% $ticket->{subject} %></A>
74 <TD CLASS="grid" BGCOLOR="<% $bgcolor %>">
75 <% $ticket->{status} %>
78 <TD CLASS="grid" BGCOLOR="<% $bgcolor %>">
79 <% $ticket->{queue} %>
82 <TD CLASS="grid" BGCOLOR="<% $bgcolor %>">
83 <% $ticket->{owner} %>
86 <TD CLASS="grid" BGCOLOR="<% $bgcolor %>">
87 <% $date_formatter->($ticket->{due}) %>
90 <TD ALIGN="right" CLASS="grid" BGCOLOR="<% $bgcolor %>">
91 <% $ticket->{timeestimated} %>
94 <TD ALIGN="right" CLASS="grid" BGCOLOR="<% $bgcolor %>">
96 ? $ticket->{content}.' ('.$ticket->{priority}.')'
101 % if ( $ss_priority ) {
102 <TD ALIGN="right" CLASS="grid" BGCOLOR="<% $bgcolor %>">
103 <% $ticket->{"CF.{$ss_priority}"} %>
114 use Date::Format 'time2str';
115 use Date::Parse 'str2time';
117 my( $conf ) = new FS::Conf;
118 my( $cust_main ) = @_;
119 my( @tickets ) = $cust_main->tickets;
121 my $open_link = FS::TicketSystem->href_customer_tickets($cust_main->custnum);
122 my $openlabel = join('/', FS::TicketSystem->statuses );
124 my $res_link = FS::TicketSystem->href_customer_tickets(
126 { 'statuses' => [ 'resolved' ] }
129 my( $new_base, %new_param ) =
130 FS::TicketSystem->href_params_new_ticket( $cust_main );
132 my $new_link = FS::TicketSystem->href_new_ticket( $cust_main );
134 my $ss_priority = FS::TicketSystem->selfservice_priority;
135 if ( $ss_priority ) {
136 my $dir = $conf->exists('ticket_system-priority_reverse') ? -1 : 1;
138 # sort in the following way:
140 # within a severity level...
141 ( $a->{'content'} eq $b->{'content'} ) ? (
142 # no-priority tickets sort last
144 ($a->{'_selfservice_priority'} eq '') <=>
145 ($b->{'_selfservice_priority'} eq '')
147 # otherwise obey ticket_system-priority_reverse
149 ($b->{'_selfservice_priority'} <=> $a->{'_selfservice_priority'})
151 ) : 0; # but don't rearrange between severity levels
155 my $format = $conf->config('date_format') || '%Y-%m-%d';
157 my $date_formatter = sub {
158 my $time = str2time($_[0], 'GMT');
159 # exclude times within 24 hours of zero
160 ($time > 86400) ? time2str($format, $time) : '';