X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=js%2Fcalculate_qty.js;h=ee36cf0f60675bcb4a6dd38f90fb291ebe395d64;hb=b775c378552e6b5bf59f98046cdf4e577cd351df;hp=2c992a741306086ac4eaaf9f2cebd8ca4d85f6ef;hpb=54e4131e091831e00a861fe2c4f53e344b87ddca;p=kivitendo-erp.git diff --git a/js/calculate_qty.js b/js/calculate_qty.js index 2c992a741..ee36cf0f6 100644 --- a/js/calculate_qty.js +++ b/js/calculate_qty.js @@ -1,22 +1,27 @@ -function calculate_qty_selection_window(input_name, alu, formel, row) { - var parm = centerParms(600,500) + ",width=600,height=500,status=yes,scrollbars=yes"; - var name = document.getElementsByName(input_name)[0].value; - if (document.getElementsByName(alu)[0].value == "1") { - var action = "calculate_alu"; - var qty = document.getElementsByName("qty_" + row)[0].value; - var description = document.getElementsByName("description_" + row)[0].value; - } else var action = "calculate_qty"; - url = "common.pl?" + - "action=" + action + "&" + - "login=" + encodeURIComponent(document.getElementsByName("login")[0].value) + "&" + - "password=" + encodeURIComponent(document.getElementsByName("password")[0].value) + "&" + - "path=" + encodeURIComponent(document.getElementsByName("path")[0].value) + "&" + - "name=" + escape(name) + "&" + - "input_name=" + escape(input_name) + "&" + - "description=" + escape(description) + "&" + - "qty=" + escape(qty) + "&" + - "row=" + escape(row) + "&" + - "formel=" + escape(document.getElementsByName(formel)[0].value) - //alert(url); - window.open(url, "_new_generic", parm); +function calculate_qty_selection_dialog(input_name, input_id, formel_name, formel_id) { + // The target input element is determined by it's dom id or by it's name. + // The formula input element (the one containing the formula) is determined by it's dom id or by it's name. + // If the id is not provided the name is used. + if (formel_id) { + var formel = $('#' + formel_id).val(); + } else { + var formel = $('[name="' + formel_name + '"]').val(); + } + var url = "common.pl"; + var data = { + action: "calculate_qty", + input_name: input_name, + input_id: input_id, + formel: formel + }; + kivi.popup_dialog({ + id: 'calc_qty_dialog', + url: url, + data: data, + dialog: { + width: 500, + height: 400, + title: kivi.t8('Please enter values'), + } + }); }