also in agent edit, fix form getting submitted before customer search can complete...
[freeside.git] / httemplate / edit / agent.cgi
index 215542d..30a0865 100755 (executable)
@@ -4,7 +4,20 @@
 
 <% include('/elements/error.html') %>
 
-<FORM ACTION="<%popurl(1)%>process/agent.cgi" METHOD=POST>
+<FORM METHOD   = POST
+      ACTION   = "<%popurl(1)%>process/agent.cgi"
+      onSubmit = "return check_agent_custnum_search(this)"
+>
+
+<SCRIPT TYPE="text/javascript">
+  function check_agent_custnum_search(what) {
+    while ( agent_custnum_search_active ) {
+      // javascript needs ambien
+    }
+    return true;
+  }
+</SCRIPT>
+
 <INPUT TYPE="hidden" NAME="agentnum" VALUE="<% $agent->agentnum %>">
 Agent #<% $agent->agentnum ? $agent->agentnum : "(NEW)" %>
 
@@ -46,13 +59,21 @@ Agent #<% $agent->agentnum ? $agent->agentnum : "(NEW)" %>
     <TD><INPUT TYPE="checkbox" NAME="disabled" VALUE="Y"<% $agent->disabled eq 'Y' ? ' CHECKED' : '' %>></TD>
   </TR>
 
+% if ( $conf->exists('agent-invoice_template') ) {
+
   <% include('/elements/tr-select-invoice_template.html',
                'label'      => 'Invoice template',
                'field'      => 'invoice_template',
                'curr_value' => $agent->invoice_template,
             )
   %>
-  
+
+% } else {
+
+  <INPUT TYPE="hidden" NAME="invoice_template" VALUE="<% $agent->invoice_template %>">
+
+% }
+
 % if ( $conf->config('ticket_system') ) {
 %    my $default_queueid = $conf->config('ticket_system-default_queueid');
 %    my $default_queue = FS::TicketSystem->queue($default_queueid);