+</SCRIPT>
+% if ( $msg_template and $msg_template->disabled ) {
+% # if we've already established a draft template, don't let msgnum be changed
+ <& /elements/hidden.html,
+ field => 'msgnum',
+ curr_value => ( scalar($cgi->param('msgnum')) || ''),
+ &>
+% } else {
+Template:
+ <& /elements/select-msg_template.html,
+ onchange => 'toggle(this)',
+ curr_value => ( scalar($cgi->param('msgnum')) || ''),
+ &>
+ <BR>
+% }
+% # select destination contact classes
+Send to contacts:
+ <& /elements/checkboxes.html,
+ 'style' => 'display: inline; vertical-align: top',
+ 'disable_links' => 1,
+ 'names_list' => \@contact_checkboxes,
+ 'element_name_prefix' => 'contact_class_',
+ 'checked_callback' => sub {
+ my($cgi, $name) = @_;
+ $name eq 'invoice' #others default to unchecked
+ },
+ &>
+<BR>
+% # if sending a one-off message, show a form to edit it
+ <TABLE BGCOLOR="#cccccc" CELLSPACING=0 WIDTH="100%" id="table_no_template">
+ <& /elements/tr-td-label.html, 'label' => 'From:' &>
+ <TD><& /elements/input-text.html,
+ 'field' => 'from_name',
+ 'value' => $conf->config('invoice_from_name', $agent_virt_agentnum) ||
+ $conf->config('company_name', $agent_virt_agentnum), #?
+ 'size' => 20,
+ 'curr_value' => scalar($cgi->param('from_name')),
+ &> <\
+ <& /elements/input-text.html,
+ 'field' => 'from_addr',
+ 'type' => 'email', # HTML5, woot
+ 'value' => $conf->config('invoice_from', $agent_virt_agentnum),
+ 'size' => 20,
+ 'curr_value' => scalar($cgi->param('from_addr')),
+ &>></TD>
+
+ <& /elements/tr-input-text.html,