commit a74d7fafa1ecbaf1f786ed7fdc85dc757ce4955f
Author: Moritz Bunkus <m.bunkus@linet.de>
Date:   Mon Dec 27 14:23:15 2010 +0100

    Fehlermeldung ausgeben, wenn Kunde/Lieferant mit "EU mit UStID" aber ohne UStID gespeichert werden soll
    
    Fix für Bug 1406.

diff --git a/locale/de/all b/locale/de/all
index 604fad4d7..6d631eaa9 100644
--- a/locale/de/all
+++ b/locale/de/all
@@ -1214,6 +1214,7 @@ $self->{texts} = {
   'Please enter the login for the new user.' => 'Bitte geben Sie das Login f�r den neuen Benutzer ein.',
   'Please enter the name of the database that will be used as the template for the new database:' => 'Bitte geben Sie den Namen der Datenbank an, die als Vorlage f&uuml;r die neue Datenbank benutzt wird:',
   'Please enter the name of the dataset you want to restore the backup in.' => 'Bitte geben Sie den Namen der Datenbank ein, in der Sie die Sicherung wiederherstellen wollen.',
+  'Please enter the sales tax identification number.' => 'Bitte geben Sie die Umsatzsteueridentifikationsnummer an.',
   'Please enter the taxnumber in the administration menu user preferences' => 'Bitte bei den Einstellungen des aktuellen Benutzers im Administrationsmodul angeben.',
   'Please enter values'         => 'Bitte Werte eingeben',
   'Please insert object dimensions below.' => 'Bitte geben Sie die Abmessungen unten ein',
diff --git a/templates/webpages/ct/form_footer.html b/templates/webpages/ct/form_footer.html
index 0fc528913..4ea8a4247 100644
--- a/templates/webpages/ct/form_footer.html
+++ b/templates/webpages/ct/form_footer.html
@@ -1,6 +1,6 @@
 [%- USE T8 %]
 [% USE HTML %]
-
+[% USE LxERP %]
 <input name="id" type="hidden" id="cvid" value="[% HTML.escape(id) %]">
 <input name="business_save" type="hidden" value="[% HTML.escape(selectbusiness) %]">
 <input name="title_save" type="hidden" value="[% HTML.escape(title) %]">
@@ -9,19 +9,19 @@
 <input type="hidden" name="db" id="db" value="[% HTML.escape(db) %]">
 
 <br>
-  <input class="submit" type="submit" name="action" accesskey="s" value="[% 'Save' | $T8 %]">
-  <input class="submit" type="submit" name="action" accesskey="s" value="[% 'Save and Close' | $T8 %]">
+  <input class="submit" type="submit" name="action" accesskey="s" value="[% 'Save' | $T8 %]" onclick="return check_taxzone_and_ustid()">
+  <input class="submit" type="submit" name="action" accesskey="s" value="[% 'Save and Close' | $T8 %]" onclick="return check_taxzone_and_ustid()">
   [%- IF is_customer %]
-  <input class="submit" type="submit" name="action" value="[% 'Save and AR Transaction' | $T8 %]">
+  <input class="submit" type="submit" name="action" value="[% 'Save and AR Transaction' | $T8 %]" onclick="return check_taxzone_and_ustid()">
   [%- ELSE %]
-  <input class="submit" type="submit" name="action" value="[% 'Save and AP Transaction' | $T8 %]">
+  <input class="submit" type="submit" name="action" value="[% 'Save and AP Transaction' | $T8 %]" onclick="return check_taxzone_and_ustid()">
   [%- END %]
-  <input class="submit" type="submit" name="action" value="[% 'Save and Invoice' | $T8 %]">
-  <input class="submit" type="submit" name="action" value="[% 'Save and Order' | $T8 %]">
+  <input class="submit" type="submit" name="action" value="[% 'Save and Invoice' | $T8 %]" onclick="return check_taxzone_and_ustid()">
+  <input class="submit" type="submit" name="action" value="[% 'Save and Order' | $T8 %]" onclick="return check_taxzone_and_ustid()">
   [%- IF is_customer %]
-  <input class="submit" type="submit" name="action" value="[% 'Save and Quotation' | $T8 %]">
+  <input class="submit" type="submit" name="action" value="[% 'Save and Quotation' | $T8 %]" onclick="return check_taxzone_and_ustid()">
   [%- ELSE %]
-  <input class="submit" type="submit" name="action" value="[% 'Save and RFQ' | $T8 %]">
+  <input class="submit" type="submit" name="action" value="[% 'Save and RFQ' | $T8 %]" onclick="return check_taxzone_and_ustid()">
   [%- END %]
 [%- IF id AND is_orphaned %]
   <input class="submit" type="submit" name="action" value="[% 'Delete' | $T8 %]">
@@ -46,6 +46,14 @@
       maintab.setselectedClassTarget("link"); //"link" or "linkparent"
       maintab.init();
 
+      function check_taxzone_and_ustid() {
+        if (($('#taxzone_id').attr('value') == '1') && ($('#ustid').attr('value') == '')) {
+          alert('[% LxERP.t8('Please enter the sales tax identification number.') %]');
+          return false;
+        }
+        return true;
+      }
+
     -->
  </script>
 </body>
diff --git a/templates/webpages/ct/form_header.html b/templates/webpages/ct/form_header.html
index 4ca08157b..ea7354712 100644
--- a/templates/webpages/ct/form_header.html
+++ b/templates/webpages/ct/form_header.html
@@ -1,5 +1,7 @@
 [%- USE T8 %]
 [% USE HTML %][% USE LxERP %]
+[% USE L %]
+[% L.javascript_tag('jquery') %]
 <body>
 
  <div class="listtop">[% title %]</div>
@@ -184,7 +186,7 @@
       <td><input name="taxnumber" size="20" value="[% HTML.escape(taxnumber) %]"></td>
       <!-- Anm.: R&B 15.11.2008     VAT Reg No ist Ust-ID in GB, aber generell sollte es laut Richardson die sales tax id sein -->
       <th align="right">[% 'sales tax identification number' | $T8 %]</th>
-      <td><input name="ustid" maxlength="14" size="20" value="[% HTML.escape(ustid) %]"></td>
+      <td><input name="ustid" id="ustid" maxlength="14" size="20" value="[% HTML.escape(ustid) %]"></td>
       [%- IF is_customer %]
       <th align="right">[% 'our vendor number at customer' | $T8 %]</th>
       <td><input name="c_vendor_id" size="10" value="[% HTML.escape(c_vendor_id) %]"></td>
@@ -260,6 +262,7 @@
       <td>
        [%- INCLUDE generic/multibox.html
              name       = 'taxzone_id',
+             id         = 'taxzone_id',
              DATA       = ALL_TAXZONES,
              show_empty = 0,
              id_key     = 'id',
@@ -657,7 +660,6 @@
 
   </div>
 
-  <script type="text/javascript" src="js/jquery.js"></script>
   <script type="text/javascript">
    <!--
    function set_gender(gender) {
