X-Git-Url: http://wagnertech.de/gitweb/gitweb.cgi/mfinanz.git/blobdiff_plain/6b50c021fc7f7d2a6914135fe6901f6e4fa7dbcf..9ce44b6f09f77fc51a69e4536fa44dee68d0ab85:/js/kivi.Order.js diff --git a/js/kivi.Order.js b/js/kivi.Order.js index a96f49f7f..140eba2f0 100644 --- a/js/kivi.Order.js +++ b/js/kivi.Order.js @@ -844,6 +844,23 @@ namespace('kivi.Order', function(ns) { $.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 ])); + }; + }); $(function() {