neue Methode items_sorted für Order, DeliveryOrder, Invoice, PurchaseInvoice
[kivitendo-erp.git] / js / part_selection.js
1 function part_selection_window(input_partnumber, input_description, input_partsid, allow_creation, formname, options) {
2   var width                   = allow_creation ? 1000 : 800;
3   var parm                    = centerParms(width,500) + ",width=" + width + ",height=500,status=yes,scrollbars=yes";
4   var partnumber              = document.getElementsByName(input_partnumber)[0].value;
5   var description             = document.getElementsByName(input_description)[0].value;
6   var action_on_part_selected = document.getElementsByName("action_on_part_selected")[0];
7   var form                    = (formname == undefined) ? document.forms[0] : document.getElementsByName(formname)[0];
8   var filter                  = document.getElementsByName(input_partnumber + "_filter")[0];
9   var input_partnotes         = "";
10
11   if (input_partnumber.match(/_\d+$/)) {
12     input_partnotes = input_partnumber;
13     input_partnotes = input_partnotes.replace(/partnumber/, "partnotes");
14     if (input_partnotes == input_partnumber)
15       input_partnotes = "";
16   }
17
18   if (filter)
19     filter = filter.value;
20   else
21     filter = "";
22
23   if (!options)
24     options = "";
25
26   url = "common.pl?" +
27     "INPUT_ENCODING=UTF-8&" +
28     "action=part_selection_internal&" +
29     "partnumber="              + encodeURIComponent(partnumber)        + "&" +
30     "description="             + encodeURIComponent(description)       + "&" +
31     "input_partnumber="        + encodeURIComponent(input_partnumber)  + "&" +
32     "input_description="       + encodeURIComponent(input_description) + "&" +
33     "input_partsid="           + encodeURIComponent(input_partsid)     + "&" +
34     "input_partnotes="         + encodeURIComponent(input_partnotes)   + "&" +
35     "filter="                  + encodeURIComponent(filter)            + "&" +
36     "options="                 + encodeURIComponent(options)           + "&" +
37     "formname="                + encodeURIComponent(formname)          + "&" +
38     "allow_creation="          + (allow_creation ? "1" : "0")   + "&" +
39     "action_on_part_selected=" + (null == action_on_part_selected ? "" : action_on_part_selected.value);
40   //alert(url);
41   window.open(url, "_new_part_selection", parm);
42 }
43