[% USE HTML %]
[% USE LxERP %]
[% USE L %]
-<body>
+[% SET style="width: 400px" %]
- <div class="listtop">[% title %]</div>
+[%- IF !popup_dialog -%]
+<h1>[% title %]</h1>
+[%- END -%]
<form name="Form" action="oe.pl" method="post">
+ [%- IF popup_dialog -%]
+ [% L.button_tag(popup_js_assign_function, LxERP.t8('Assign')) %]
+ [% L.button_tag(popup_js_close_function, LxERP.t8('Cancel')) %]
+
+ [%- ELSE -%]
+ [% L.hidden_tag('action', 'save_periodic_invoices_config') %]
+
+ <p>
+ [% L.submit_tag('', LxERP.t8('Assign')) %]
+ [% L.submit_tag('', LxERP.t8('Cancel'), onclick => "self.close(); return false;") %]
+ </p>
+ [%- END -%]
<p>
<table border="0">
<tr>
<th align="right">[% LxERP.t8('Status') %]</th>
- <td>[% L.checkbox_tag("active", checked => active, label => LxERP.t8('Active')) %]</td>
+ <td>[% L.checkbox_tag("active", checked => config.active, label => LxERP.t8('Active')) %]</td>
</tr>
<tr>
<td> </td>
<td>
- [% L.checkbox_tag('terminated', label => LxERP.t8('terminated'), checked => terminated) %]
+ [% L.checkbox_tag('terminated', label => LxERP.t8('terminated'), checked => config.terminated) %]
+ </td>
+ </tr>
+
+ <tr>
+ <th align="right" valign="top">[%- LxERP.t8('Billing Periodicity') %]</th>
+ <td valign="top">
+ [% L.select_tag("periodicity", [ [ "o", LxERP.t8("one time") ], [ "m", LxERP.t8("monthly") ], [ "q", LxERP.t8("every third month") ], [ "b", LxERP.t8("semiannually") ], [ "y", LxERP.t8("yearly") ] ], default=config.periodicity, style=style) %]
</td>
</tr>
<tr>
- <th align="right" valign="top">[%- LxERP.t8('Periodicity') %]</th>
+ <th align="right" valign="top">[%- LxERP.t8('Order value periodicity') %]</th>
<td valign="top">
- [% L.radio_button_tag("periodicity", value => "m", label => LxERP.t8("monthly"), checked => periodicity == 'm') %]
- <br>
- [% L.radio_button_tag("periodicity", value => "q", label => LxERP.t8("quarterly"), checked => periodicity == 'q') %]
- <br>
- [% L.radio_button_tag("periodicity", value => "y", label => LxERP.t8("yearly"), checked => periodicity == 'y') %]
+ [% L.select_tag("order_value_periodicity",
+ [ [ "p", LxERP.t8("same as periodicity") ], [ "m", LxERP.t8("monthly") ], [ "q", LxERP.t8("every third month") ], [ "b", LxERP.t8("semiannually") ], [ "y", LxERP.t8("yearly") ],
+ [ "2", LxERP.t8("2 years") ], [ "3", LxERP.t8("3 years") ], [ "4", LxERP.t8("4 years") ], [ "5", LxERP.t8("5 years") ], ],
+ default=config.order_value_periodicity, style=style) %]
</td>
</tr>
<tr>
<th align="right">[%- LxERP.t8('Start date') %]</th>
<td valign="top">
- [% L.date_tag("start_date_as_date", start_date_as_date) %]
+ [% L.date_tag("start_date_as_date", config.start_date_as_date) %]
</td>
</tr>
<tr>
<th align="right">[%- LxERP.t8('End date') %]<sup>(1)</sup></th>
<td valign="top">
- [% L.date_tag("end_date_as_date", end_date_as_date) %]
+ [% L.date_tag("end_date_as_date", config.end_date_as_date) %]
+ </td>
+ </tr>
+
+ <tr>
+ <th align="right">[%- LxERP.t8('Create first invoice on') %]<sup>(2)</sup></th>
+ <td valign="top">
+ [% L.date_tag("first_billing_date_as_date", config.first_billing_date_as_date) %]
</td>
</tr>
<tr>
<th align="right">[% LxERP.t8('Extend automatically by n months') %]</th>
<td valign="top">
- [% L.input_tag("extend_automatically_by", extend_automatically_by, size => 10) %]
+ [% L.input_tag("extend_automatically_by", config.extend_automatically_by, size => 10) %]
</td>
</tr>
<tr>
<th align="right">[%- LxERP.t8('Record in') %]</th>
<td valign="top">
- [% L.select_tag("ar_chart_id", AR, title_key => 'description', default => ar_chart_id) %]
+ [% L.select_tag("ar_chart_id", AR, title_key => 'description', default => config.ar_chart_id, style=style) %]
</td>
</tr>
<tr>
+ <th align="right">[%- LxERP.t8('direct debit') %]</th>
+ <td valign="top">[% L.checkbox_tag("direct_debit", checked=config.direct_debit) %]</td>
+ </tr>
+
+ <tr class="rule-before">
<th align="right">[%- LxERP.t8('Print automatically') %]</th>
<td valign="top">
- [% L.checkbox_tag("print", onclick => "toggle_printer_id_ctrl()", checked => print) %]
+ [% L.checkbox_tag("print", onclick => "toggle_printer_id_ctrl()", checked => config.print) %]
</td>
</tr>
<tr>
<th align="right">[%- LxERP.t8('Printer') %]</th>
<td valign="top">
- [% L.select_tag("printer_id", ALL_PRINTERS, title_key = 'printer_description', default = printer_id, disabled = !print) %]
+ [% L.select_tag("printer_id", ALL_PRINTERS, title_key = 'printer_description', default = config.printer_id, disabled = !config.print, id = "pic_printer_id", style=style) %]
</td>
</tr>
<tr>
<th align="right">[%- LxERP.t8('Copies') %]</th>
- <td valign="top">[% L.input_tag("copies", copies, size => 6, disabled => !print) %]</td>
+ <td valign="top">[% L.input_tag("copies", config.copies, size => 6, disabled => !config.print, id = "pic_copies") %]</td>
+ </tr>
+
+ <tr class="rule-before">
+ <th align="right">[%- LxERP.t8("Send invoice via email") %]</th>
+ <td>[% L.checkbox_tag("send_email", onclick => "toggle_send_email_ctrl()", checked=config.send_email, disabled=postal_invoice) %]</td>
+ </tr>
+ <tr>
+ <th align="right">[%- LxERP.t8("Email of the invoice recipient") %]</th>
+ <td>[% email_recipient_invoice_address %]</td>
+ </tr>
+ <tr>
+ <th align="right">[%- LxERP.t8("Contact to send to") %]</th>
+ <td>[% L.select_tag("email_recipient_contact_id", ALL_CONTACTS, title_key="full_name_dep", value_key="cp_id", default=config.email_recipient_contact_id, with_empty=1, disabled=!config.send_email, style=style) %]</td>
+ </tr>
+
+ <tr>
+ <th align="right">[%- LxERP.t8("Other recipients") %]<sup>3</sup></th>
+ <td>[% L.input_tag("email_recipient_address", config.email_recipient_address, disabled=!config.send_email, style=style) %]</td>
+ </tr>
+
+ <tr>
+ <th align="right">[%- LxERP.t8("Sender") %]<sup>4</sup></th>
+ <td>[% L.input_tag("email_sender", config.email_sender, disabled=!config.send_email, style=style) %]</td>
+ </tr>
+
+ <tr>
+ <th align="right">[%- LxERP.t8("Subject") %]</th>
+ <td>[% L.input_tag("email_subject", config.email_subject, disabled=!config.send_email, style=style) %]</td>
+ </tr>
+
+ <tr>
+ <th align="right" valign="top">[%- LxERP.t8("Message") %]</th>
+ <td valign="top">[% L.textarea_tag("email_body", config.email_body, disabled=!config.send_email, rows=8, style=style, class="texteditor texteditor-space-for-toolbar") %]</td>
</tr>
</table>
</p>
<hr>
<p>(1): [%- LxERP.t8('The end date is the last day for which invoices will possibly be created.') %]</p>
-
- [% L.hidden_tag('action', 'save_periodic_invoices_config') %]
-
- <p>
- [% L.submit_tag('', LxERP.t8('Close')) %]
- [% L.submit_tag('', LxERP.t8('Cancel'), onclick => "self.close(); return false;") %]
- </p>
+ <p>(2): [% LxERP.t8("If missing then the start date will be used.") %]</p>
+ <p>(3): [% LxERP.t8("Multiple addresses can be entered separated by commas.") %]</p>
+ <p>(4): [% LxERP.t8("If left empty the default sender from the kivitendo configuration will be used (key 'email_from' in section 'periodic_invoices'; current value: #1).", HTML.escape(LXCONFIG.periodic_invoices.email_from)) %]</p>
</form>
<script type="text/javascript">
<!--
function toggle_printer_id_ctrl() {
- var disabled = !$('#print').attr('checked');
- $('#printer_id').attr('disabled', disabled);
- $('#copies').attr('disabled', disabled);
+ var disabled = !$('#print').prop('checked');
+ $('#pic_printer_id').prop('disabled', disabled);
+ $('#pic_copies').prop('disabled', disabled);
+ }
+
+ function toggle_send_email_ctrl() {
+ var disabled = !$('#send_email').prop('checked');
+ $('#email_recipient_contact_id').prop('disabled', disabled);
+ $('#email_recipient_address').prop('disabled', disabled);
+ $('#email_sender').prop('disabled', disabled);
+ $('#email_subject').prop('disabled', disabled);
+ $('#email_body').data('ckeditorInstance').setReadOnly(disabled);
}
-->
</script>
-
-</body>
-</html>