Funktion "show_invoices" auf die Verwendung von HTML-Vorlagen umgestellt.
authorMoritz Bunkus <m.bunkus@linet-services.de>
Fri, 4 May 2007 15:51:40 +0000 (15:51 +0000)
committerMoritz Bunkus <m.bunkus@linet-services.de>
Fri, 4 May 2007 15:51:40 +0000 (15:51 +0000)
bin/mozilla/dn.pl
locale/de/dn
templates/webpages/dunning/show_invoices_de.html [new file with mode: 0644]
templates/webpages/dunning/show_invoices_master.html [new file with mode: 0644]

index 65b3bc3..52f6cd5 100644 (file)
@@ -86,184 +86,25 @@ sub show_invoices {
   DN->get_invoices(\%myconfig, \%$form);
   $form->{title} = $locale->text('Start Dunning Process');
 
-  if (@{ $form->{DUNNING_CONFIG} }) {
-    foreach $item (@{ $form->{DUNNING_CONFIG} }) {
-        $form->{selectdunning} .=
-          "<option value=$item->{id}>$item->{dunning_description}</option>";
-    }
-  }
-
-
-  $form->{nextsub} = "save_dunning";
-
-  $form->{jsscript} = 1;
-  $form->{javascript} .= qq|<script type="text/javascript" src="js/checkbox_utils.js"></script>|;
-
-  $form->{callback} =
-    "$form->{script}?action=show_invoices&login=$form->{login}&password=$form->{password}&customer=$form->{customer}&invnumber=$form->{invnumber}&ordnumber=$form->{ordnumber}&paymentuntil=$form->{paymentuntil}&groupinvoices=$form->{groupinvoices}&minamount=$form->{minamount}&dunning_level=$form->{dunning_level}&notes=$form->{notes}"
-    unless $form->{callback};
-
-  @column_index = qw(dunning_description dunning_description_next active email customername invnumber invdate inv_duedate amount next_duedate fee interest );
-
-  $column_header{dunning_description} =
-      qq|<th class="listheading" colspan="2">|
-    . $locale->text('Current / Next Level')
-    . qq|</th>|;
-  $column_header{active} =
-      qq|<th class=listheading>|
-    . NTI($cgi->checkbox('-name' => 'selectall_active',
-                         '-label' => $locale->text('Active?'),
-                         '-checked' => 0,
-                         '-onclick' => "checkbox_check_all('selectall_active', 'active_', 1, " . scalar(@{ $form->{DUNNINGS} }) . ")"))
-    . qq|</th>|;
-  $column_header{email} =
-      qq|<th class=listheading>|
-    . NTI($cgi->checkbox('-name' => 'selectall_email',
-                         '-label' => $locale->text('eMail?'),
-                         '-checked' => 0,
-                         '-onclick' => "checkbox_check_all('selectall_email', 'email_', 1, " . scalar(@{ $form->{DUNNINGS} }) . ")"))
-    . qq|</th>|;
-  $column_header{customername} =
-      qq|<th class=listheading>|
-    . $locale->text('Customername')
-    . qq|</th>|;
-  $column_header{invnumber} =
-      qq|<th class=listheading>|
-    . $locale->text('Invno.')
-    . qq|</th>|;
-  $column_header{inv_duedate} =
-      qq|<th class=listheading>|
-    . $locale->text('Inv. Duedate')
-    . qq|</th>|;
-  $column_header{next_duedate} =
-      qq|<th class=listheading>|
-    . $locale->text('Dunning Duedate')
-    . qq|</th>|;
-  $column_header{invdate} =
-      qq|<th class=listheading>|
-    . $locale->text('Invdate')
-    . qq|</th>|;
-  $column_header{amount} =
-      qq|<th class=listheading>|
-    . $locale->text('Amount')
-    . qq|</th>|;
-  $column_header{fee} =
-      qq|<th class=listheading>|
-    . $locale->text('Total Fees')
-    . qq|</th>|;
-  $column_header{interest} =
-      qq|<th class=listheading>|
-    . $locale->text('Interest')
-    . qq|</th>|;
-
-  $form->header;
-
-
-  print qq|
-<body>
-<script type="text/javascript" src="js/common.js"></script>
-<script type="text/javascript" src="js/dunning.js"></script>
-<form name=Form method=post action=$form->{script}>
+  foreach my $row (@{ $form->{DUNNINGS} }) {
+    $row->{DUNNING_CONFIG} = [ map +{ %{ $_ } }, @{ $form->{DUNNING_CONFIG} } ];
 
-
-<table width=100%>
-  <tr>
-    <th class=listtop colspan=12>$form->{title}</th>
-  </tr>
-  <tr height="5"></tr>
-  <tr>|;
-  map { print "$column_header{$_}\n" if $column_header{$_}; } @column_index;
-
-  print qq|
-        </tr>
-|;
-  my $i = 0;
-  foreach $ref (@{ $form->{DUNNINGS} }) {
-
-    $i++;
-    my $j = $i % 2;
-
-    print qq|
-        <tr valign=top class=listrow$j>
-|;
-
-    $form->{selectdunning} =~ s/ selected//g;
-    if ($ref->{next_dunning_config_id} ne "") {
-      $form->{selectdunning} =~ s/value=$ref->{next_dunning_config_id}/value=$ref->{next_dunning_config_id} selected/;
+    if ($row->{next_dunning_config_id}) {
+      map { $_->{SELECTED} = $_->{id} == $row->{next_dunning_config_id} } @{ $row->{DUNNING_CONFIG } };
     }
-
-    $column_data{dunning_description} =
-      qq|<td>|
-      . qq|<input type=hidden name=inv_id_$i size=2 value="$ref->{id}">|
-      . qq|<input type=hidden name=customer_id_$i size=2 value="$ref->{customer_id}">|
-      . ($ref->{dunning_level} ? $ref->{dunning_level} : "&nbsp;")
-      . qq|</td>|;
-    $column_data{dunning_description_next} =
-      qq|<td>|
-      . qq|<select name=next_dunning_config_id_$i>$form->{selectdunning}</select>|
-      . qq|</td>|;
-    my $active = ($ref->{active}) ? "checked" : "";
-    $column_data{active} =
-      qq|<td><input type=checkbox name=active_$i value=1 $active></td>|;
-    my $email = ($ref->{email}) ? "checked" : "";
-    $column_data{email} =
-      qq|<td><input type=checkbox name=email_$i value=1 $email></td>|;
-    $column_data{next_duedate}           = qq|<td>$ref->{next_duedate}</td>|;
-
-    $column_data{inv_duedate}           = qq|<td><input type=hidden name=inv_duedate_$i size=6 value="$ref->{duedate}">$ref->{duedate}</td>|;
-    $column_data{invdate}           = qq|<td><input type=hidden name=invdate_$i size=6 value="$ref->{transdate}">$ref->{transdate}</td>|;
-    $column_data{invnumber}           = qq|<td><input type=hidden name=invnumber_$i size=6 value="$ref->{invnumber}">$ref->{invnumber}</td>|;
-    $column_data{customername}           = qq|<td><input type=hidden name=customername_$i size=6 value="$ref->{customername}">$ref->{customername}</td>|;
-
-    map { $column_data{$_} =
-            qq|<td align="right">|
-            . H($form->format_amount(\%myconfig, $ref->{$_} * 1, -2))
-            . qq|</td>|
-    } qw(amount fee interest);
-
-    map { print "$column_data{$_}\n" } @column_index;
-
-    print qq|
-       </tr>
-|;
+    map { $row->{$_} = $form->format_amount(\%myconfig, $row->{$_} * 1, -2) } qw(amount fee interest);
   }
 
-  $form->{rowcount} = $i;
+  $form->{rowcount}       = scalar @{ $form->{DUNNINGS} };
+  $form->{jsscript}       = 1;
+  $form->{callback}     ||= build_std_url("action=show_invoices", qw(login password customer invnumber ordnumber groupinvoices minamount dunning_level notes));
 
-  print qq|
-      </table>
-    </td>
-  </tr>
-  <tr>
-  <td><hr size=3 noshade></td>
-  </tr>
-</table>|;
-  print_options();
-  print qq|
-<br>
-<form method=post action=$form->{script}>
-
-<input name=callback type=hidden value="$form->{callback}">
-<input name=rowcount type=hidden value="$form->{rowcount}">
-<input name=nextsub type=hidden value="$form->{nextsub}">
-<input name=groupinvoices type=hidden value="$form->{groupinvoices}">
-
-
-<input type=hidden name=login value=$form->{login}>
-<input type=hidden name=password value=$form->{password}>
-<input type="hidden" name="action">
-<input type="submit" name="dummy" value="|
-    . $locale->text('Continue') . qq|" onclick="this.disabled=true; this.value='| . $locale->text("The dunning process started") . qq|'; document.Form.action.value='| . $locale->text('Continue') . qq|'; document.Form.submit()">
-
-  </form>
-
-  </body>
-  </html>
-|;
+  $form->{PRINT_OPTIONS}  = print_options(1);
 
+  $form->header();
+  print $form->parse_html_template("dunning/show_invoices");
 
   $lxdebug->leave_sub();
-
 }
 
 sub save {
index 1b09165..a14701c 100644 (file)
@@ -2,7 +2,6 @@ $self->{texts} = {
   ' Date missing!'              => ' Datum fehlt!',
   '*/'                          => '*/',
   'ADDED'                       => 'Hinzugefügt',
-  'Active?'                     => 'Aktiviert?',
   'Add Purchase Order'          => 'Lieferantenauftrag erfassen',
   'Add Quotation'               => 'Angebot erfassen',
   'Add Request for Quotation'   => 'Anfrage erfassen',
@@ -27,7 +26,6 @@ $self->{texts} = {
   'Could not create dunning copy!' => 'Eine Kopie der Zahlungserinnerung konnte nicht erstellt werden.',
   'Country'                     => 'Land',
   'Credit Note'                 => 'Gutschrift',
-  'Current / Next Level'        => 'Aktuelles / Nächstes Mahnlevel',
   'Customer'                    => 'Kunde',
   'Customer Number'             => 'Kundennummer',
   'Customer not on file or locked!' => 'Dieser Kunde existiert nicht oder ist gesperrt.',
@@ -68,10 +66,8 @@ gestartet',
   'History'                     => 'Historie',
   'In-line'                     => 'im Text',
   'Interest'                    => 'Zinsen',
-  'Inv. Duedate'                => 'Rg. Fälligkeit',
   'Invdate'                     => 'Rechnungsdatum',
   'Invdate from'                => 'Rechnungen von',
-  'Invno.'                      => 'Rg. Nr.',
   'Invnumber'                   => 'Rechnungsnummer',
   'Invoice'                     => 'Rechnung',
   'Invoice Date missing!'       => 'Rechnungsdatum fehlt!',
@@ -181,7 +177,6 @@ gestartet',
   'Subtotal'                    => 'Zwischensumme',
   'Terms missing in row '       => '+Tage fehlen in Zeile ',
   'The \'tag\' field must only consist of alphanumeric characters or the carachters - _ ( )' => 'Das Feld \'tag\' darf nur aus alphanumerischen Zeichen und den Zeichen - _ ( ) bestehen.',
-  'The dunning process started' => 'Der Mahnprozess ist gestartet.',
   'To'                          => 'An',
   'Total Fees'                  => 'Kumulierte Gebühren',
   'Trying to call a sub without a name' => 'Es wurde versucht, eine Unterfunktion ohne Namen aufzurufen.',
@@ -196,7 +191,6 @@ gestartet',
   'Zipcode'                     => 'PLZ',
   'bin_list'                    => 'Lagerliste',
   'button'                      => '?',
-  'eMail?'                      => 'eMail?',
   'emailed to'                  => 'gemailt an',
   'invoice'                     => 'Rechnung',
   'none (pricegroup)'           => 'keine',
diff --git a/templates/webpages/dunning/show_invoices_de.html b/templates/webpages/dunning/show_invoices_de.html
new file mode 100644 (file)
index 0000000..ab2849d
--- /dev/null
@@ -0,0 +1,84 @@
+<body>
+ <script type="text/javascript" src="js/checkbox_utils.js"></script>
+ <script type="text/javascript" src="js/common.js"></script>
+ <script type="text/javascript" src="js/dunning.js"></script>
+
+ <div class="listtop" width="100%"><TMPL_VAR title></div>
+
+ <form name="Form" method="post" action="dn.pl">
+
+  <table width="100%">
+   <th class="listheading" colspan="2">Aktuelles / Nächstes Mahnlevel</th>
+
+   <th class="listheading">
+    <input type="checkbox" name="selectall_active" id="selectall_active" onclick="checkbox_check_all('selectall_active', 'active_', 1, <TMPL_VAR rowcount>);">
+    <label for="selectall_active">Aktiviert?</label>
+   </th>
+
+   <th class="listheading">
+    <input type="checkbox" name="selectall_email" id="selectall_email" onclick="checkbox_check_all('selectall_email', 'email_', 1, <TMPL_VAR rowcount>);">
+    <label for="selectall_email">eMail?</label>
+   </th>
+
+   <th class="listheading">Kundenname</th>
+   <th class="listheading">Rg. Nr.</th>
+   <th class="listheading">Rechnungsdatum</th>
+   <th class="listheading">Rg. Fälligkeit</th>
+   <th class="listheading">Betrag</th>
+   <th class="listheading">Zahlbar bis</th>
+   <th class="listheading">Kumulierte Gebühren</th>
+   <th class="listheading">Zinsen</th>
+
+   <!-- Ausgabe der einzelnen Zeilen -->
+
+   <TMPL_LOOP DUNNINGS>
+    <tr class="listrow<TMPL_IF __odd__>1<TMPL_ELSE>0</TMPL_IF>">
+
+     <td>
+      <input type="hidden" name="inv_id_<TMPL_VAR __counter__>" size="2" value="<TMPL_VAR id ESCAPE=HTML>">
+      <input type="hidden" name="customer_id_<TMPL_VAR __counter__>" size="2" value="<TMPL_VAR customer_id ESCAPE=HTML>">
+      <TMPL_IF dunning_level><TMPL_VAR dunning_level ESCAPE=HTML><TMPL_ELSE>&nbsp;</TMPL_IF>
+     </td>
+
+     <td>
+      <select name="next_dunning_config_id_<TMPL_VAR __counter__>">
+       <TMPL_LOOP DUNNING_CONFIG><option value="<TMPL_VAR id ESCAPE=HTML>" <TMPL_IF SELECTED>selected</TMPL_IF>><TMPL_VAR dunning_description ESCAPE=HTML></option></TMPL_LOOP>
+      </select>
+     </td>
+
+     <td><input type="checkbox" name="active_<TMPL_VAR __counter__>" value="1" <TMPL_IF active>checked</TMPL_IF>></td>
+     <td><input type="checkbox" name="email_<TMPL_VAR __counter__>" value="1" <TMPL_IF email>checked</TMPL_IF>></td>
+     <td><TMPL_VAR next_duedate ESCAPE=HTML></td>
+     <td><input type="hidden" name="inv_duedate_<TMPL_VAR __counter__>" size="6" value="<TMPL_VAR duedate ESCAPE=HTML>"><TMPL_VAR duedate ESCAPE=HTML></td>
+     <td><input type="hidden" name="invdate_<TMPL_VAR __counter__>" size="6" value="<TMPL_VAR transdate ESCAPE=HTML>"><TMPL_VAR transdate ESCAPE=HTML></td>
+     <td><input type="hidden" name="invnumber_<TMPL_VAR __counter__>" size="6" value="<TMPL_VAR invnumber ESCAPE=HTML>"><TMPL_VAR invnumber ESCAPE=HTML></td>
+     <td><input type="hidden" name="customername_<TMPL_VAR __counter__>" size="6" value="<TMPL_VAR customername ESCAPE=HTML>"><TMPL_VAR customername ESCAPE=HTML></td>
+     <td align="right"><input type="hidden" name="amount_<TMPL_VAR __counter__>" size="6" value="<TMPL_VAR amount ESCAPE=HTML>"><TMPL_VAR amount ESCAPE=HTML></td>
+     <td align="right"><input type="hidden" name="fee_<TMPL_VAR __counter__>" size="6" value="<TMPL_VAR fee ESCAPE=HTML>"><TMPL_VAR fee ESCAPE=HTML></td>
+     <td align="right"><input type="hidden" name="interest_<TMPL_VAR __counter__>" size="6" value="<TMPL_VAR interest ESCAPE=HTML>"><TMPL_VAR interest ESCAPE=HTML></td>
+    </tr>
+   </TMPL_LOOP>
+  </table>
+
+  <hr size=3 noshade>
+
+  <TMPL_VAR PRINT_OPTIONS>
+
+  <br>
+
+  <input name="rowcount" type="hidden" value="<TMPL_VAR rowcount ESCAPE=HTML>">
+  <input name="groupinvoices" type="hidden" value="<TMPL_VAR groupinvoices ESCAPE=HTML>">
+
+  <input name="callback" type="hidden" value="<TMPL_VAR callback ESCAPE=HTML>">
+  <input name="nextsub" type="hidden" value="save_dunning">
+
+  <input type="hidden" name="login" value="<TMPL_VAR login ESCAPE=HTML>">
+  <input type="hidden" name="password" value="<TMPL_VAR password ESCAPE=HTML>">
+  <input type="hidden" name="action" value="Weiter">
+
+  <input type="submit" name="dummy" value="Weiter"
+         onclick="this.disabled=true; this.value='Der Mahnprozess ist gestartet.'; document.Form.submit()">
+
+ </form>
+</body>
+</html>
diff --git a/templates/webpages/dunning/show_invoices_master.html b/templates/webpages/dunning/show_invoices_master.html
new file mode 100644 (file)
index 0000000..5d3487b
--- /dev/null
@@ -0,0 +1,84 @@
+<body>
+ <script type="text/javascript" src="js/checkbox_utils.js"></script>
+ <script type="text/javascript" src="js/common.js"></script>
+ <script type="text/javascript" src="js/dunning.js"></script>
+
+ <div class="listtop" width="100%"><TMPL_VAR title></div>
+
+ <form name="Form" method="post" action="dn.pl">
+
+  <table width="100%">
+   <th class="listheading" colspan="2"><translate>Current / Next Level</translate></th>
+
+   <th class="listheading">
+    <input type="checkbox" name="selectall_active" id="selectall_active" onclick="checkbox_check_all('selectall_active', 'active_', 1, <TMPL_VAR rowcount>);">
+    <label for="selectall_active"><translate>Active?</translate></label>
+   </th>
+
+   <th class="listheading">
+    <input type="checkbox" name="selectall_email" id="selectall_email" onclick="checkbox_check_all('selectall_email', 'email_', 1, <TMPL_VAR rowcount>);">
+    <label for="selectall_email"><translate>eMail?</translate></label>
+   </th>
+
+   <th class="listheading"><translate>Customername</translate></th>
+   <th class="listheading"><translate>Invno.</translate></th>
+   <th class="listheading"><translate>Invdate</translate></th>
+   <th class="listheading"><translate>Inv. Duedate</translate></th>
+   <th class="listheading"><translate>Amount</translate></th>
+   <th class="listheading"><translate>Dunning Duedate</translate></th>
+   <th class="listheading"><translate>Total Fees</translate></th>
+   <th class="listheading"><translate>Interest</translate></th>
+
+   <!-- Ausgabe der einzelnen Zeilen -->
+
+   <TMPL_LOOP DUNNINGS>
+    <tr class="listrow<TMPL_IF __odd__>1<TMPL_ELSE>0</TMPL_IF>">
+
+     <td>
+      <input type="hidden" name="inv_id_<TMPL_VAR __counter__>" size="2" value="<TMPL_VAR id ESCAPE=HTML>">
+      <input type="hidden" name="customer_id_<TMPL_VAR __counter__>" size="2" value="<TMPL_VAR customer_id ESCAPE=HTML>">
+      <TMPL_IF dunning_level><TMPL_VAR dunning_level ESCAPE=HTML><TMPL_ELSE>&nbsp;</TMPL_IF>
+     </td>
+
+     <td>
+      <select name="next_dunning_config_id_<TMPL_VAR __counter__>">
+       <TMPL_LOOP DUNNING_CONFIG><option value="<TMPL_VAR id ESCAPE=HTML>" <TMPL_IF SELECTED>selected</TMPL_IF>><TMPL_VAR dunning_description ESCAPE=HTML></option></TMPL_LOOP>
+      </select>
+     </td>
+
+     <td><input type="checkbox" name="active_<TMPL_VAR __counter__>" value="1" <TMPL_IF active>checked</TMPL_IF>></td>
+     <td><input type="checkbox" name="email_<TMPL_VAR __counter__>" value="1" <TMPL_IF email>checked</TMPL_IF>></td>
+     <td><TMPL_VAR next_duedate ESCAPE=HTML></td>
+     <td><input type="hidden" name="inv_duedate_<TMPL_VAR __counter__>" size="6" value="<TMPL_VAR duedate ESCAPE=HTML>"><TMPL_VAR duedate ESCAPE=HTML></td>
+     <td><input type="hidden" name="invdate_<TMPL_VAR __counter__>" size="6" value="<TMPL_VAR transdate ESCAPE=HTML>"><TMPL_VAR transdate ESCAPE=HTML></td>
+     <td><input type="hidden" name="invnumber_<TMPL_VAR __counter__>" size="6" value="<TMPL_VAR invnumber ESCAPE=HTML>"><TMPL_VAR invnumber ESCAPE=HTML></td>
+     <td><input type="hidden" name="customername_<TMPL_VAR __counter__>" size="6" value="<TMPL_VAR customername ESCAPE=HTML>"><TMPL_VAR customername ESCAPE=HTML></td>
+     <td align="right"><input type="hidden" name="amount_<TMPL_VAR __counter__>" size="6" value="<TMPL_VAR amount ESCAPE=HTML>"><TMPL_VAR amount ESCAPE=HTML></td>
+     <td align="right"><input type="hidden" name="fee_<TMPL_VAR __counter__>" size="6" value="<TMPL_VAR fee ESCAPE=HTML>"><TMPL_VAR fee ESCAPE=HTML></td>
+     <td align="right"><input type="hidden" name="interest_<TMPL_VAR __counter__>" size="6" value="<TMPL_VAR interest ESCAPE=HTML>"><TMPL_VAR interest ESCAPE=HTML></td>
+    </tr>
+   </TMPL_LOOP>
+  </table>
+
+  <hr size=3 noshade>
+
+  <TMPL_VAR PRINT_OPTIONS>
+
+  <br>
+
+  <input name="rowcount" type="hidden" value="<TMPL_VAR rowcount ESCAPE=HTML>">
+  <input name="groupinvoices" type="hidden" value="<TMPL_VAR groupinvoices ESCAPE=HTML>">
+
+  <input name="callback" type="hidden" value="<TMPL_VAR callback ESCAPE=HTML>">
+  <input name="nextsub" type="hidden" value="save_dunning">
+
+  <input type="hidden" name="login" value="<TMPL_VAR login ESCAPE=HTML>">
+  <input type="hidden" name="password" value="<TMPL_VAR password ESCAPE=HTML>">
+  <input type="hidden" name="action" value="<translate>Continue</translate>">
+
+  <input type="submit" name="dummy" value="<translate>Continue</translate>"
+         onclick="this.disabled=true; this.value='<translate>The dunning process started</translate>'; document.Form.submit()">
+
+ </form>
+</body>
+</html>