internationalization/localization, RT12515
[freeside.git] / httemplate / view / cust_main / tickets.html
index 167849c..2175110 100644 (file)
@@ -1,20 +1,52 @@
-(<A HREF="<% $open_link %>">View <% $openlabel %> tickets for this customer</A>)
-(<A HREF="<% $res_link  %>">View resolved tickets for this customer</A>)
+<FORM METHOD="GET" NAME="CreateTicketForm" STYLE="display:inline">
+<SCRIPT TYPE="text/javascript">
+function updateTicketLink() {
+  var link = document.getElementById('CreateTicketLink');
+  var selector = document.getElementById('Queue')
+  link.href = "<% $new_base.'?'.
+    join(';', map(
+      { ($_ eq 'Queue') ? () : "$_=$new_param{$_}"} 
+    keys %new_param),'Queue=') %>" + selector.options[selector.selectedIndex].value;
+}
+</SCRIPT>
+<A id="CreateTicketLink" HREF="<% $new_link %>"><% mt('Create new ticket') |h %></A>
+ <% mt('in queue') |h %> 
+%# fetch list of queues in which the user can create tickets
+% my $session = FS::TicketSystem->session();
+% my %queues = FS::TicketSystem->queues($session, 'CreateTicket');
+% if( $conf->exists('ticket_system-force_default_queueid') ) {
+<B><% $queues{$new_param{'Queue'}} %></B>
+<INPUT TYPE="hidden" NAME="Queue" VALUE="<% $new_param{'Queue'} %>">
+% }
+% else {
+<SELECT NAME="Queue" id="Queue" onchange="updateTicketLink()">
+% foreach my $queueid ( sort { $queues{$a} cmp $queues{$b} } keys %queues ) {
+    <OPTION VALUE="<% $queueid %>"
+            <% $queueid == $new_param{'Queue'} ? 'SELECTED' : '' %>
+    ><% $queues{$queueid} |h %>
+% }
+</SELECT>
+<SCRIPT DEFER TYPE="text/javascript">updateTicketLink();</SCRIPT>
+% }
+</FORM>
 <BR>
-(<A HREF="<% $new_link  %>">Create new ticket for this customer</A>)
 
-<% include("/elements/table-grid.html") %>
+(<A HREF="<% $open_link %>"><% mt("View $openlabel tickets for this customer") |h %></A>)
+(<A HREF="<% $res_link  %>"><% mt('View resolved tickets for this customer') |h %></A>)
+<BR><BR>
+
+<& /elements/table-grid.html &>
 % my $bgcolor1 = '#eeeeee';
 %   my $bgcolor2 = '#ffffff';
 %   my $bgcolor = '';
 
 <TR>
-  <TH CLASS="grid" BGCOLOR="#cccccc">#</TH>
-  <TH CLASS="grid" BGCOLOR="#cccccc">Subject</TH>
-  <TH CLASS="grid" BGCOLOR="#cccccc">Status</TH>
-  <TH CLASS="grid" BGCOLOR="#cccccc">Queue</TH>
-  <TH CLASS="grid" BGCOLOR="#cccccc">Owner</TH>
-  <TH CLASS="grid" BGCOLOR="#cccccc">Priority</TH>
+  <TH CLASS="grid" BGCOLOR="#cccccc"><% mt('#') |h %></TH>
+  <TH CLASS="grid" BGCOLOR="#cccccc"><% mt('Subject') |h %></TH>
+  <TH CLASS="grid" BGCOLOR="#cccccc"><% mt('Status') |h %></TH>
+  <TH CLASS="grid" BGCOLOR="#cccccc"><% mt('Queue') |h %></TH>
+  <TH CLASS="grid" BGCOLOR="#cccccc"><% mt('Owner') |h %></TH>
+  <TH CLASS="grid" BGCOLOR="#cccccc"><% mt('Priority') |h %></TH>
 </TR>
 
 % foreach my $ticket ( @tickets ) {
@@ -62,6 +94,7 @@
 
 <%init>
 
+my( $conf ) = new FS::Conf;
 my( $cust_main ) = @_;
 my( @tickets )  = $cust_main->tickets;
 
@@ -73,9 +106,9 @@ my $res_link  = FS::TicketSystem->href_customer_tickets(
                   { 'statuses' => [ 'resolved' ] }
                 );
 
-my $new_link = FS::TicketSystem->href_new_ticket(
-                 $cust_main,
-                 join(', ', $cust_main->invoicing_list_emailonly )
-               );
+my( $new_base, %new_param ) = 
+  FS::TicketSystem->href_params_new_ticket( $cust_main );
+
+my $new_link = FS::TicketSystem->href_new_ticket( $cust_main );
 
 </%init>