X-Git-Url: http://wagnertech.de/gitweb/gitweb.cgi/mfinanz.git/blobdiff_plain/85693e13660f80e5116e571ccac7199a680817c9..42a10479a98f0cf963ca2ca3d387d21225928679:/js/kivi.Order.js
diff --git a/js/kivi.Order.js b/js/kivi.Order.js
index 75e7d2de6..7c97a97e4 100644
--- a/js/kivi.Order.js
+++ b/js/kivi.Order.js
@@ -66,6 +66,7 @@ namespace('kivi.Order', function(ns) {
ns.show_print_options = function(warn_on_duplicates, warn_on_reqdate) {
if (!ns.check_cv()) return;
if (warn_on_duplicates && !ns.check_duplicate_parts(kivi.t8("Do you really want to print?"))) return;
+ if (warn_on_reqdate && !ns.check_valid_reqdate()) return;
kivi.popup_dialog({
id: 'print_options',
@@ -233,6 +234,8 @@ namespace('kivi.Order', function(ns) {
};
ns.recalc_amounts_and_taxes = function() {
+ if (!kivi.validate_form('#order_form')) return;
+
var data = $('#order_form').serializeArray();
data.push({ name: 'action', value: 'Order/recalc_amounts_and_taxes' });
@@ -820,7 +823,7 @@ namespace('kivi.Order', function(ns) {
if (number_info !== '') { info += ' (' + number_info + ')' }
if (name_info !== '') { info += ' (' + name_info + ')' }
- if (!$('#follow_up_rowcount').lenght) {
+ if (!$('#follow_up_rowcount').length) {
$('').appendTo('#order_form');
$('').appendTo('#order_form');
$('').appendTo('#order_form');
@@ -836,6 +839,37 @@ namespace('kivi.Order', function(ns) {
follow_up_window();
};
+ ns.create_part = function() {
+ var data = $('#order_form').serializeArray();
+ data.push({ name: 'action', value: 'Order/create_part' });
+
+ $.post("controller.pl", data, kivi.eval_json_result);
+ };
+
+ ns.check_transport_cost_article_presence = function() {
+ var $form = $('#order_form');
+ var wanted_part_id = $form.data('transport-cost-reminder-article-id');
+
+ if (!wanted_part_id) return true
+
+ var id_arr = $('[name="order.orderitems[].parts_id"]').map(function() { return this.value; }).get();
+ id_arr = $.grep(id_arr, function(elt) {
+ return ((elt*1) === wanted_part_id);
+ });
+
+ if (id_arr.length) return true;
+
+ var description = $form.data('transport-cost-reminder-article-description');
+ return confirm(kivi.t8("The transport cost article '#1' is missing. Do you want to continue anyway?", [ description ]));
+ };
+
+ ns.check_cusordnumber_presence = function() {
+ if ($('#order_cusordnumber').val() === '') {
+ return confirm(kivi.t8('The customer order number is missing. Do you want to continue anyway?'));
+ }
+ return true;
+ };
+
});
$(function() {