rc.pl: reconciliation in template ausgelagert
authorSven Schöling <s.schoeling@linet-services.de>
Mon, 19 Sep 2011 16:56:31 +0000 (18:56 +0200)
committerSven Schöling <s.schoeling@linet-services.de>
Mon, 19 Sep 2011 16:56:31 +0000 (18:56 +0200)
bin/mozilla/rc.pl
templates/webpages/rc/step1.html [new file with mode: 0644]

index 0f01ac9..b36f6e3 100644 (file)
@@ -42,78 +42,17 @@ use strict;
 # end of main
 
 sub reconciliation {
-  $main::lxdebug->enter_sub();
-
-  my $form     = $main::form;
-  my %myconfig = %main::myconfig;
-  my $locale   = $main::locale;
-
-  $main::auth->assert('cash');
-
-  RC->paymentaccounts(\%myconfig, \%$form);
-
-  my $selection = "";
-  map { $selection .= "<option>$_->{accno}--$_->{description}\n" }
-    @{ $form->{PR} };
-
-  $form->{title} = $locale->text('Reconciliation');
-  $form->{javascript} .= qq|<script type="text/javascript" src="js/common.js"></script>|;
-  $form->{"jsscript"} = 1;
-  $form->header;
-  my $onload = qq|focus()|;
-  $onload .= qq|;setupDateFormat('|. $myconfig{dateformat} .qq|', '|. $locale->text("Falsches Datumsformat!") .qq|')|;
-
-  print qq|
-<body onLoad="$onload">
-
-<form method=post action=$form->{script}>
-
-<table width=100%>
-  <tr>
-    <th class=listtop>$form->{title}</th>
-  </tr>
-  <tr height="5"></tr>
-  <tr>
-    <td>
-      <table>
-        <tr>
-          <th align=right nowrap>| . $locale->text('Account') . qq|</th>
-          <td colspan=3><select name=accno>$selection</select>
-          </td>
-        </tr>
-        <tr>
-          <th align=right>| . $locale->text('From') . qq|</th>
-          <td><input name=fromdate id=fromdate size=11 title="$myconfig{dateformat}" onBlur=\"check_right_date_format(this)\">
-         <input type="button" name="fromdate" id="trigger_fromdate" value="?"></td>
-          <th align=right>| . $locale->text('Until') . qq|</th>
-          <td><input name=todate id=todate size=11 title="$myconfig{dateformat}" onBlur=\"check_right_date_format(this)\">
-         <input type="button" name="todate" id="trigger_todate" value="?"></td>
-        </tr>
-      </table>
-    </td>
-  </tr>
-  <tr>
-    <td><hr size=3 noshade></td>
-  </tr>
-</table>
-
-| . $form->write_trigger(\%myconfig, 2,
-                         "fromdate", "BL", "trigger_fromdate",
-                         "todate", "BL", "trigger_todate") . qq|
-
-<br>
-<input type=hidden name=nextsub value=get_payments>
+  $::lxdebug->enter_sub;
+  $::auth->assert('cash');
 
-<input type=submit class=submit name=action value="|
-    . $locale->text('Continue') . qq|">
+  RC->paymentaccounts(\%::myconfig, $::form);
 
-</form>
+  $::form->header;
+  print $::form->parse_html_template('rc/step1', {
+    selection_sub => sub { ("$_[0]{accno}--$_[0]{description}")x2 },
+  });
 
-</body>
-</html>
-|;
-
-  $main::lxdebug->leave_sub();
+  $::lxdebug->leave_sub;
 }
 
 sub continue { call_sub($main::form->{"nextsub"}); }
diff --git a/templates/webpages/rc/step1.html b/templates/webpages/rc/step1.html
new file mode 100644 (file)
index 0000000..718fe30
--- /dev/null
@@ -0,0 +1,33 @@
+[%- USE T8 %]
+[%- USE HTML %]
+[%- USE L %]
+[%- USE LxERP %]
+<body onLoad="[% onload %]">
+
+<h1>[% 'Reconciliation' | $T8 %]</h1>
+
+<form method=post action="[% script %]">
+
+<table>
+  <tr>
+    <th align=right nowrap>[% 'Account' | $T8 %]</th>
+    <td colspan=3>[% L.select_tag('accno', L.options_for_select(PR, value_title_sub=\selection_sub)) %]</td>
+  </tr>
+  <tr>
+    <th align=right>[% 'From' | $T8 %]</th>
+    <td>[% L.date_tag('fromdate') %]</td>
+    <th align=right>[% 'Until' | $T8 %]</th>
+    <td>[% L.date_tag('todate') %]</td>
+  </tr>
+</table>
+
+<hr size=3 noshade>
+<br>
+
+[% L.hidden_tag('nextsub', 'get_payments') %]
+[% L.submit_tag('action', LxERP.t8('Continue')) %]
+
+</form>
+
+</body>
+</html>