Wiederkehrende Rechnungen: Templatevariablen in Hash oder Objekt übergeben
authorBernd Bleßmann <bernd@kivitendo-premium.de>
Mon, 29 Jan 2018 15:11:15 +0000 (16:11 +0100)
committerBernd Bleßmann <bernd@kivitendo-premium.de>
Mon, 29 Jan 2018 15:41:57 +0000 (16:41 +0100)
Damit lässt sich das Template auch mit einem PeriodicInvoiceConfig-Objekt
aufrufen und kann so von anderen Controllern verwendet werden.

bin/mozilla/oe.pl
templates/webpages/oe/edit_periodic_invoices_config.html

index 6a3f811..c1ecf19 100644 (file)
@@ -2183,7 +2183,7 @@ sub edit_periodic_invoices_config {
   }
 
   $::form->header(no_layout => 1);
-  print $::form->parse_html_template('oe/edit_periodic_invoices_config', $config);
+  print $::form->parse_html_template('oe/edit_periodic_invoices_config', {config => $config});
 
   $::lxdebug->leave_sub();
 }
index 5c7ac8b..e563d39 100644 (file)
    <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>&nbsp;</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=periodicity, style=style) %]
+      [% 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>
 
       [% 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=order_value_periodicity, style=style) %]
+                      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", first_billing_date_as_date) %]
+      [% 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, style=style) %]
+      [% 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=direct_debit) %]</td>
+     <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, style=style) %]
+      [% L.select_tag("printer_id", ALL_PRINTERS, title_key = 'printer_description', default = config.printer_id, disabled = !config.print, 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) %]</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=send_email) %]</td>
+     <td>[% L.checkbox_tag("send_email", onclick => "toggle_send_email_ctrl()", checked=config.send_email) %]</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=email_recipient_contact_id, with_empty=1, disabled=!send_email, style=style) %]</td>
+     <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", email_recipient_address, disabled=!send_email, style=style) %]</td>
+     <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", email_sender, disabled=!send_email, style=style) %]</td>
+     <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", email_subject, disabled=!send_email, style=style) %]</td>
+     <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", email_body, disabled=!send_email, rows=8, style=style) %]</td>
+     <td valign="top">[% L.textarea_tag("email_body", config.email_body, disabled=!config.send_email, rows=8, style=style) %]</td>
     </tr>
    </table>
   </p>