form_footer in ic.pl in Template ausgelagert.
authorMoritz Bunkus <m.bunkus@linet-services.de>
Tue, 12 Aug 2008 12:54:46 +0000 (12:54 +0000)
committerMoritz Bunkus <m.bunkus@linet-services.de>
Tue, 12 Aug 2008 12:54:46 +0000 (12:54 +0000)
SL/MoreCommon.pm
bin/mozilla/ic.pl
locale/de/ic
templates/webpages/ic/form_footer_de.html [new file with mode: 0644]
templates/webpages/ic/form_footer_master.html [new file with mode: 0644]

index 32ca6b6..e4e13e8 100644 (file)
@@ -3,7 +3,7 @@ package SL::MoreCommon;
 require Exporter;
 @ISA = qw(Exporter);
 
-@EXPORT = qw(save_form restore_form compare_numbers);
+@EXPORT = qw(save_form restore_form compare_numbers any);
 
 use YAML;
 
@@ -76,5 +76,13 @@ sub compare_numbers {
   return $a <=> $b;
 }
 
+sub any (&@) {
+  my $f = shift;
+  return if ! @_;
+  for (@_) {
+    return 1 if $f->();
+  }
+  return 0;
+}
 
 1;
index 93758ec..3383316 100644 (file)
@@ -1491,102 +1491,7 @@ sub form_footer {
 
   $auth->assert('part_service_assembly_edit');
 
-  if ($form->{item} eq "assembly") {
-
-    print qq|
-       <tr>
-         <td>
-            <table width="100%">
-              <tr>
-                <th colspan=2 align=right>| . $locale->text('Total') . qq|&nbsp;</th>
-                <th align=right>| . $form->format_amount(\%myconfig, $form->{assemblytotal}, 2) . qq|</th>
-              </tr>
-            </table>
-          </td>
-        </tr>
-        <input type=hidden name=assembly_rows value=$form->{assembly_rows}>
-|;
-  }
-
-  print qq|
-      <input type=hidden name=callback value="$form->{callback}">
-      <input type=hidden name=previousform value="$form->{previousform}">
-      <input type=hidden name=taxaccount2 value="$form->{taxaccount2}">
-      <input type=hidden name=vc value=$form->{vc}>
-  <tr>
-    <td><hr size=3 noshade></td>
-  </tr>
-</table>
-
-<br>
-<input class=submit type=submit name=action value="|
-    . $locale->text('Update') . qq|">
-  |;
-
-####### moved into makemodel_row #############
-#  unless ($form->{item} eq "service") {
-#    print qq|
-#      <input type=hidden name=makemodel_rows value=$form->{makemodel_rows}>
-#    |;
-#  }
-
-  print qq|
-     <input type=hidden name=price_rows value=$form->{price_rows}>|;
-
-  print qq|
-      <input class=submit type=submit name=action value="|
-    . $locale->text('Save') . qq|">|;
-
-  if ($form->{id}) {
-
-    if (!$form->{previousform}) {
-      print qq|
-      <input class=submit type=submit name=action value="|
-        . $locale->text('Save as new') . qq|">|;
-    }
-
-    if ($form->{orphaned}) {
-      if (!$form->{previousform}) {
-        if ($form->{item} eq 'assembly') {
-          if (!$form->{onhand}) {
-            print qq|
-      <input class=submit type=submit name=action value="|
-              . $locale->text('Delete') . qq|">|;
-          }
-        } else {
-          print qq|
-      <input class=submit type=submit name=action value="|
-            . $locale->text('Delete') . qq|">|;
-        }
-      }
-    }
-  }
-
-  if (!$form->{previousform}) {
-    if ($form->{menubar}) {
-      require "bin/mozilla/menu.pl";
-      &menubar;
-    }
-  }
-# button for saving history
-  if($form->{id} ne "") {
-       print qq|
-               <input type=button class=submit onclick=set_history_window(|
-               . $form->{id} 
-               . qq|); name=history id=history value=|
-               . $locale->text('history') 
-               . qq|>|;
-  }
-# /button for saving history
-  print qq|
-
-</form>
-
-<script type="text/javascript" src="js/wz_tooltip.js"></script>
-
-</body>
-</html>
-|;
+  print $form->parse_html_template('ic/form_footer');
 
   $lxdebug->leave_sub();
 }
@@ -1595,7 +1500,7 @@ sub makemodel_row {
   $lxdebug->enter_sub();
   my ($numrows) = @_;
   
-  my @mm_data = grep { $_->{make} ne '' || $_->{model} ne '' } map +{ make => $form->{"make_$_"}, model => $form->{"model_$_"} }, 1 .. $numrows;
+  my @mm_data = grep { any { $_ ne '' } @$_{qw(make model)} } map +{ make => $form->{"make_$_"}, model => $form->{"model_$_"} }, 1 .. $numrows;
   print $form->parse_html_template('ic/makemodel', { MM_DATA => [ @mm_data, {} ], mm_rows => scalar @mm_data + 1 });
 
   $lxdebug->leave_sub();
index 098854a..9aa9a70 100644 (file)
@@ -10,7 +10,6 @@ $self->{texts} = {
   'AP Transaction'              => 'Kreditorenbuchung',
   'AR'                          => 'Verkauf',
   'AR Transaction'              => 'Debitorenbuchung',
-  'Accounting Menu'             => 'Kontoverwaltung',
   'Active'                      => 'Aktiv',
   'Add '                        => 'Hinzufügen',
   'Add Assembly'                => 'Erzeugnis erfassen',
@@ -74,7 +73,6 @@ $self->{texts} = {
   'Date'                        => 'Datum',
   'Dec'                         => 'Dez',
   'December'                    => 'Dezember',
-  'Delete'                      => 'Löschen',
   'Delivered'                   => 'Geliefert',
   'Delivery Date'               => 'Lieferdatum',
   'Delivery Order'              => 'Lieferschein',
@@ -230,8 +228,6 @@ $self->{texts} = {
   'Sales Invoice'               => 'Rechnung',
   'Sales Order'                 => 'Kundenauftrag',
   'Sales quotation'             => 'Angebot',
-  'Save'                        => 'Speichern',
-  'Save as new'                 => 'als neu speichern',
   'Screen'                      => 'Bildschirm',
   'Select a Customer'           => 'Endkunde auswählen',
   'Select a customer'           => 'Einen Kunden ausw&auml;hlen',
@@ -273,14 +269,12 @@ $self->{texts} = {
   'To (time)'                   => 'Bis',
   'Top 100'                     => 'Top 100',
   'Top 100 hinzufuegen'         => 'Top 100 hinzufügen',
-  'Total'                       => 'Summe',
   'Transactions, AR transactions, AP transactions' => 'Dialogbuchen, Debitorenrechnungen, Kreditorenrechnungen',
   'Transfer To Stock'           => 'Lagereingang',
   'Trying to call a sub without a name' => 'Es wurde versucht, eine Unterfunktion ohne Namen aufzurufen.',
   'Unit'                        => 'Einheit',
   'Unit of measure'             => 'Maßeinheit',
   'Unknown dependency \'%s\'.'  => 'Unbekannte Abh&auml;ngigkeit \'%s\'.',
-  'Update'                      => 'Erneuern',
   'Updated'                     => 'Erneuert am',
   'Value'                       => 'Wert',
   'Variable'                    => 'Variable',
@@ -308,7 +302,6 @@ $self->{texts} = {
   'deliverydate'                => 'Lieferdatum',
   'ea'                          => 'St.',
   'emailed to'                  => 'gemailt an',
-  'history'                     => 'Historie',
   'invoice'                     => 'Rechnung',
   'no'                          => 'nein',
   'none (pricegroup)'           => 'keine',
@@ -340,7 +333,6 @@ $self->{subs} = {
   '_check_io_auth'              => '_check_io_auth',
   '_update_part_information'    => '_update_part_information',
   '_update_ship'                => '_update_ship',
-  'acc_menu'                    => 'acc_menu',
   'add'                         => 'add',
   'addtop100'                   => 'addtop100',
   'assembly_row'                => 'assembly_row',
@@ -354,7 +346,6 @@ $self->{subs} = {
   'customer_details'            => 'customer_details',
   'delete'                      => 'delete',
   'delivery_customer_selection' => 'delivery_customer_selection',
-  'display'                     => 'display',
   'display_form'                => 'display_form',
   'display_row'                 => 'display_row',
   'edit'                        => 'edit',
@@ -394,7 +385,6 @@ $self->{subs} = {
   'save_as_new'                 => 'save_as_new',
   'search'                      => 'search',
   'search_update_prices'        => 'search_update_prices',
-  'section_menu'                => 'section_menu',
   'select_item'                 => 'select_item',
   'select_part'                 => 'select_part',
   'select_part_internal'        => 'select_part_internal',
diff --git a/templates/webpages/ic/form_footer_de.html b/templates/webpages/ic/form_footer_de.html
new file mode 100644 (file)
index 0000000..a065eb3
--- /dev/null
@@ -0,0 +1,58 @@
+[%- USE HTML %]
+[%- USE LxERP %]
+  [%- IF item == 'assembly' %]
+  <tr>
+    <td>
+      <table width="100%">
+        <tr>
+          <th colspan="2" align="right">Summe</th>
+          <th align="right">[% LxERP.format_amount(assemblytotal, 2) %]</th>
+        </tr>
+      </table>
+    </td>
+  </tr>
+  <input type="hidden" name="assembly_rows" value="[% HTML.escape(assembly_rows) %]">
+  [%- END %]
+
+  <input type="hidden" name="callback" value="[% HTML.escape(callback) %]">
+  <input type="hidden" name="previousform" value="[% HTML.escape(previousform) %]">
+  <input type="hidden" name="taxaccount2" value="[% HTML.escape(taxaccount2) %]">
+  <input type="hidden" name="vc" value="[% HTML.escape(vc) %]">
+  <tr>
+    <td><hr size="3" noshade></td>
+  </tr>
+</table>
+
+<br>
+<input class="submit" type="submit" name="action" value="Erneuern">
+<input type="hidden" name="price_rows" value="[% HTML.escape(price_rows) %]">
+<input class="submit" type="submit" name="action" value="Speichern">
+
+  [%- IF id %]
+    [%- UNLESS previousform %]
+<input class="submit" type="submit" name="action" value="als neu speichern">
+    [%- END %]
+
+    [%- IF orphaned %]
+      [%- UNLESS previousform %]
+        [%- IF item == 'assembly' %] {
+          [%- UNLESS onhand %]
+<input class="submit" type="submit" name="action" value="Löschen">
+          [%- END %]
+        [%- ELSE %]
+<input class="submit" type="submit" name="action" value="Löschen">
+        [%- END %]
+      [%- END %]
+    [%- END %]
+  [%- END %]
+
+  [%- IF id != "" %]
+<input type="button" class="submit" onclick="set_history_window([% id %]);" name="history" id="history" value="Historie">
+  [%- END %]
+
+</form>
+
+<script type="text/javascript" src="js/wz_tooltip.js"></script>
+
+</body>
+</html>
diff --git a/templates/webpages/ic/form_footer_master.html b/templates/webpages/ic/form_footer_master.html
new file mode 100644 (file)
index 0000000..d041971
--- /dev/null
@@ -0,0 +1,58 @@
+[%- USE HTML %]
+[%- USE LxERP %]
+  [%- IF item == 'assembly' %]
+  <tr>
+    <td>
+      <table width="100%">
+        <tr>
+          <th colspan="2" align="right"><translate>Total</translate></th>
+          <th align="right">[% LxERP.format_amount(assemblytotal, 2) %]</th>
+        </tr>
+      </table>
+    </td>
+  </tr>
+  <input type="hidden" name="assembly_rows" value="[% HTML.escape(assembly_rows) %]">
+  [%- END %]
+
+  <input type="hidden" name="callback" value="[% HTML.escape(callback) %]">
+  <input type="hidden" name="previousform" value="[% HTML.escape(previousform) %]">
+  <input type="hidden" name="taxaccount2" value="[% HTML.escape(taxaccount2) %]">
+  <input type="hidden" name="vc" value="[% HTML.escape(vc) %]">
+  <tr>
+    <td><hr size="3" noshade></td>
+  </tr>
+</table>
+
+<br>
+<input class="submit" type="submit" name="action" value="<translate>Update</translate>">
+<input type="hidden" name="price_rows" value="[% HTML.escape(price_rows) %]">
+<input class="submit" type="submit" name="action" value="<translate>Save</translate>">
+
+  [%- IF id %]
+    [%- UNLESS previousform %]
+<input class="submit" type="submit" name="action" value="<translate>Save as new</translate>">
+    [%- END %]
+
+    [%- IF orphaned %]
+      [%- UNLESS previousform %]
+        [%- IF item == 'assembly' %] {
+          [%- UNLESS onhand %]
+<input class="submit" type="submit" name="action" value="<translate>Delete</translate>">
+          [%- END %]
+        [%- ELSE %]
+<input class="submit" type="submit" name="action" value="<translate>Delete</translate>">
+        [%- END %]
+      [%- END %]
+    [%- END %]
+  [%- END %]
+
+  [%- IF id != "" %]
+<input type="button" class="submit" onclick="set_history_window([% id %]);" name="history" id="history" value="<translate>history</translate>">
+  [%- END %]
+
+</form>
+
+<script type="text/javascript" src="js/wz_tooltip.js"></script>
+
+</body>
+</html>