Merge branch 'constraints_in_tax_and_taxkeys'
[kivitendo-erp.git] / templates / webpages / ct / form_footer.html
index 0fc5289..774a50e 100644 (file)
@@ -1,6 +1,7 @@
 [%- USE T8 %]
 [% USE HTML %]
-
+[% USE LxERP %]
+[% USE L %]
 <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) %]">
 <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 %]">
+  [% L.submit_tag('action', LxERP.t8('Delete'), id => 'action_delete', confirm => LxERP.t8('Do you really want to delete this object?')) %]
 [%- END %]
 [%- IF id %]
   <input type="button" class="submit" onclick="set_history_window([% HTML.escape(id) %]);" name="history" id="history" value="[% 'history' | $T8 %]">
 
  <script type="text/javascript">
   <!--
-      Calendar.setup({ inputField : "from",    ifFormat :"[% myconfig_jsc_dateformat %]", align : "BL", button : "trigger_from" });
-      Calendar.setup({ inputField : "to",      ifFormat :"[% myconfig_jsc_dateformat %]", align : "BL", button : "trigger_to" });
-      Calendar.setup({ inputField : "FU_date", ifFormat :"[% myconfig_jsc_dateformat %]", align : "BR", button : "FU_date_trigger" });
-
       function enable_delete_shipto(used) { var s=document.getElementById('delete_shipto');  if (s) s.disabled = (used > 0 ? true : false); }
       function enable_delete_contact(used){ var s=document.getElementById('delete_contact'); if (s) s.disabled = (used > 0 ? true : false); }
 
-      var maintab = new ddtabcontent("maintab");
-      maintab.setpersist(true);
-      maintab.setselectedClassTarget("link"); //"link" or "linkparent"
-      maintab.init();
+      function submitInputButton(button)
+      {
+        var hidden = document.createElement("input");
+        hidden.setAttribute("type", "hidden");
+
+        if( button.hasAttribute("name") )
+          hidden.setAttribute("name", button.getAttribute("name"));
+
+        if( button.hasAttribute("value") )
+          hidden.setAttribute("value", button.getAttribute("value"));
+
+
+        button.form.appendChild(hidden);
+
+        button.disabled = true;
+
+        button.form.submit();
+      }
+
+      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>
-</html>