-[%- USE HTML %][%- USE LxERP -%][%- USE L -%]
+[%- USE HTML %][%- USE LxERP -%][%- USE L -%][%- USE P -%]
+[%- SET have_files = 0 %]
+
+[% BLOCK attach_file_list %]
+ [% IF files.as_list.size %]
+ [% SET have_files = 1;
+ FOREACH file = files.as_list %]
+ <tr>
+ <th align="right" nowrap>
+ [% IF loop.first %]
+ [% label %]
+ [% END %]
+ </th>
+ <td>
+ [% IF checked %]
+ [% P.checkbox_tag("email_form.attach_file_ids[]", label=file.db_file.file_name, value=file.db_file.id, checked="1") %]
+ [% ELSE %]
+ [% P.checkbox_tag("email_form.attach_file_ids[]", label=file.db_file.file_name, value=file.db_file.id, checked="0") %]
+ [% END %]
+ </td>
+ </tr>
+ [% END %]
+ [% END %]
+[% END %]
<table>
<tbody>
<tr>
- <th align="right" nowrap>[% LxERP.t8("To") %]</th>
- <td>[% L.input_tag("email_form.to", email_form.to, size="80") %]</td>
+ <th align="right" nowrap>
+ [% IF is_invoice_mail %]
+ [% LxERP.t8("Invoice to:") %]
+ [% ELSE %]
+ [% LxERP.t8("Recipients") %]
+ [% END %]
+ </th>
+ <td>
+ [% L.input_tag("email_form.to", email_form.to, size="80",readonly=is_invoice_mail ) %]
+ <span class="interactive cursor-pointer" onclick="$('[data-toggle-recipients=1]').toggle()" data-toggle-recipients="1">[+]</span>
+ <span class="interactive cursor-pointer hidden" onclick="$('[data-toggle-recipients=1]').toggle()" data-toggle-recipients="1">[-]</span>
+ </td>
</tr>
- <tr>
+ [%- IF ALL_EMPLOYEES.size %]
+ <tr class="hidden" data-toggle-recipients="1">
+ <th align="right" nowrap>[% LxERP.t8("CC to Employee") %]</th>
+ <td>[% L.select_tag('email_form.cc_employee', ALL_EMPLOYEES, value_key='login' title_key='safe_name', with_empty=1, style=style) %]</td>
+ </tr>
+ [%- END %]
+
+ <tr class="hidden" data-toggle-recipients="1">
<th align="right" nowrap>[% LxERP.t8("Cc") %]</th>
<td>[% L.input_tag("email_form.cc", email_form.cc, size="80") %]</td>
</tr>
[%- IF show_bcc %]
- <tr>
+ <tr class="hidden" data-toggle-recipients="1">
<th align="right" nowrap>[% LxERP.t8("Bcc") %]</th>
<td>[% L.input_tag("email_form.bcc", email_form.bcc, size="80") %]</td>
</tr>
<td>[% L.input_tag("email_form.subject", email_form.subject, size="80") %]</td>
</tr>
+ <tr valign="top">
+ <th align="right" nowrap>[% LxERP.t8("Message") %]
+ <sup> [% L.link("generictranslations.pl?action=edit_email_strings", "1)", title=LxERP.t8('Tired of copying always nice phrases for this message? Click here to use the new preset message option!'), target="_blank") %]</sup>
+ </th>
+ <td>[% L.textarea_tag("email_form.message", email_form.message, rows="15", cols="80", class="texteditor") %]</td>
+ </tr>
+
+[% IF INSTANCE_CONF.get_doc_storage %]
<tr>
- <th align="right" nowrap>[% LxERP.t8("Attachment name") %]</th>
- <td>[% L.input_tag("email_form.attachment_filename", email_form.attachment_filename, size="80") %]</td>
+ <th align="right" nowrap>[% LxERP.t8("Send printout of record") %]</th>
+ <td>
+ [% SET no_file_label = have_files ? LxERP.t8("Don't include a printout of the record with the email, only selected files") : LxERP.t8("Don't include a printout of the record with the email") ;
+ options = [
+ [ "old_file", LxERP.t8("Send the last or create the first version for this record") ],
+ [ "normal", LxERP.t8("Create and send a new printout for this record") ],
+ [ "no_file", no_file_label ],
+ ] ;
+ L.select_tag("email_form.attachment_policy", options, onchange="kivi.SalesPurchase.activate_send_email_actions_regarding_printout()") %]
+ </td>
</tr>
+[% END %]
- <tr valign="top">
- <th align="right" nowrap>[% LxERP.t8("Message") %]</th>
- <td>[% L.textarea_tag("email_form.message", email_form.message, rows="15" cols="80" wrap="soft") %]</td>
+ <tr>
+ <th align="right" nowrap>
+[% IF !INSTANCE_CONF.get_doc_storage %]
+ [% LxERP.t8("Attachment name") %]
+[% END %]
+ </th>
+ <td>[% L.input_tag("email_form.attachment_filename", email_form.attachment_filename, size="80") %]</td>
</tr>
+
+[% IF INSTANCE_CONF.get_doc_storage %]
+ [% PROCESS attach_file_list
+ files = FILES.files
+ checked = INSTANCE_CONF.get_email_attachment_record_files_checked
+ label = LxERP.t8("Record's files") %]
+
+ [% PROCESS attach_file_list
+ files = FILES.vc_files
+ checked = INSTANCE_CONF.get_email_attachment_vc_files_checked
+ label = is_customer ? LxERP.t8("Files from customer") : LxERP.t8("Files from vendor") %]
+
+ [% PROCESS attach_file_list
+ files = FILES.part_files
+ checked = INSTANCE_CONF.get_email_attachment_part_files_checked
+ label = LxERP.t8("Files from parts") %]
+
+ [% PROCESS attach_file_list
+ files = FILES.project_files
+ label = LxERP.t8("Files from projects") %]
+[% END %]
</tbody>
</table>
<div id="email_form_print_options"></div>
<p>
- [% L.button_tag("kivi.SalesPurchase.send_email()", LxERP.t8("Send email")) %]
+ [% L.button_tag(email_form.js_send_function, LxERP.t8("Send email"), id='send_email') %]
[% L.button_tag("\$('#send_email_dialog').dialog('close');", LxERP.t8("Abort")) %]
</p>