Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 46d3bb6e

Von Bernd Bleßmann vor fast 9 Jahren hinzugefügt

  • ID 46d3bb6e2f544e82ed36ce6fa08bf48f74a54cc9
  • Vorgänger ed04f337
  • Nachfolger b1b3cdeb

Auftrags-Controller: serializeArray und push statt serialize und += auf Strings

Unterschiede anzeigen:

templates/webpages/order/form.html
52 52

  
53 53
function save() {
54 54
  if (!check_cv()) return;
55
  var data = $('#order_form').serialize();
56
  data += '&action=Order/save';
55
  var data = $('#order_form').serializeArray();
56
  data.push({ name: 'action', value: 'Order/save' });
57 57

  
58 58
  $.post("controller.pl", data, kivi.eval_json_result);
59 59
}
60 60

  
61 61
function create_pdf() {
62 62
  if (!check_cv()) return;
63
  var data = $('#order_form').serialize();
64
  data += '&action=Order/create_pdf';
63
  var data = $('#order_form').serializeArray();
64
  data.push({ name: 'action', value: 'Order/create_pdf' });
65 65

  
66 66
  $.post("controller.pl", data, kivi.eval_json_result);
67 67
}
68 68

  
69 69
function download_pdf(pdf_filename, key) {
70
  var data = 'action=Order/download_pdf';
71
  data += '&type=' + $('#type').val();
72
  data += '&pdf_filename=' + pdf_filename;
73
  data += '&key=' + key;
70
  var data = [];
71
  data.push({ name: 'action', value: 'Order/download_pdf' });
72
  data.push({ name: 'type', value: $('#type').val() });
73
  data.push({ name: 'pdf_filename', value: pdf_filename });
74
  data.push({ name: 'key', value: key });
74 75
  $.download("controller.pl", data);
75 76
}
76 77

  
77 78
function email() {
78 79
  if (!check_cv()) return;
79
  var data = $('#order_form').serialize();
80
  data += '&action=Order/show_email_dialog';
80
  var data = $('#order_form').serializeArray();
81
  data.push({ name: 'action', value: 'Order/show_email_dialog' });
81 82

  
82 83
  $.post("controller.pl", data, kivi.eval_json_result);
83 84
}
84 85

  
85 86
function save_and_delivery_order() {
86 87
  if (!check_cv()) return;
87
  var data = $('#order_form').serialize();
88
  data += '&action=Order/save_and_delivery_order';
88
  var data = $('#order_form').serializeArray();
89
  data.push({ name: 'action', value: 'Order/save_and_delivery_order' });
89 90

  
90 91
  $.post("controller.pl", data, kivi.eval_json_result);
91 92
}
templates/webpages/order/tabs/_email_dialog.html
54 54

  
55 55
<script type='text/javascript'>
56 56
function send_email() {
57
  var data = $('#order_form').serialize();
58
  data += '&';
59
  data += $('#email_form').serialize();
60
  data += '&action=Order/send_email';
57
  var data = $('#order_form').serializeArray();
58
  data = data.concat($('#email_form').serializeArray());
59
  data.push({ name: 'action', value: 'Order/send_email' });
61 60
  $.post("controller.pl", data, kivi.eval_json_result);
62 61
}
63 62
</script>
templates/webpages/order/tabs/_multi_items_dialog.html
23 23

  
24 24
<script type='text/javascript'>
25 25
function update_result() {
26
  var data = $('#multi_items_form').serialize();
27
  data += '&type=[%- FORM.type %]';
26
  var data = $('#multi_items_form').serializeArray();
27
  data.push({ name: 'type', value: '[%- FORM.type %]' });
28 28
  $.ajax({
29 29
    url: 'controller.pl?action=Order/multi_items_update_result',
30 30
    data: data,
......
43 43
}
44 44

  
45 45
function add_multi_items() {
46
  var data = $('#[%- FORM.callback_data_id %]').serialize();
47
  data += '&';
48
  data += $('#multi_items_form').serialize();
49
  data += '&action=[%- FORM.callback %]';
46
  var data = $('#[%- FORM.callback_data_id %]').serializeArray();
47
  data = data.concat($('#multi_items_form').serializeArray());
48
  data.push({ name: 'action', value: '[%- FORM.callback %]' });
50 49
  $.post("controller.pl", data, kivi.eval_json_result);
51 50
}
52 51

  
templates/webpages/order/tabs/basic_data.html
269 269

  
270 270
<script type='text/javascript'>
271 271
function reload_cv_dependend_selections() {
272
  var data = $('#order_form').serialize();
273
  data += '&action=Order/customer_vendor_changed';
272
  var data = $('#order_form').serializeArray();
273
  data.push({ name: 'action', value: 'Order/customer_vendor_changed' });
274 274

  
275 275
  $.post("controller.pl", data, kivi.eval_json_result);
276 276
}
......
284 284
  var oldval = $(select_elt).data('oldval');
285 285
  $(select_elt).data('oldval', $(select_elt).val());
286 286

  
287
  var data = $('#order_form').serialize();
288
  data += '&action=Order/unit_changed';
289
  data += '&item_id=' + item_id_dom.val();
290
  data += '&old_unit=' + oldval;
291
  data += '&sellprice_dom_id=' + sellprice_dom.attr('id');
287
  var data = $('#order_form').serializeArray();
288
  data.push({ name: 'action', value: 'Order/unit_changed' });
289
  data.push({ name: 'item_id', value: item_id_dom.val() });
290
  data.push({ name: 'old_unit', value: oldval });
291
  data.push({ name: 'sellprice_dom_id', value: sellprice_dom.attr('id') });
292 292

  
293 293
  $.post("controller.pl", data, kivi.eval_json_result);
294 294
}
......
307 307

  
308 308
  $('#row_table_id thead a img').remove();
309 309

  
310
  var data = $('#order_form').serialize();
311
  data += '&action=Order/add_item';
310
  var data = $('#order_form').serializeArray();
311
  data.push({ name: 'action', value: 'Order/add_item' });
312 312

  
313 313
  $.post("controller.pl", data, kivi.eval_json_result);
314 314
}
......
349 349
  var row = $(clicked).parents("tbody").first();
350 350
  var item_id_dom = $(row).find('[name="orderitem_ids[+]"]');
351 351

  
352
  var data = $('#order_form').serialize();
353
  data += '&action=Order/price_popup';
354
  data += '&item_id=' + item_id_dom.val();
352
  var data = $('#order_form').serializeArray();
353
  data.push({ name: 'action', value: 'Order/price_popup' });
354
  data.push({ name: 'item_id', value: item_id_dom.val() });
355 355

  
356 356
  $.post("controller.pl", data, kivi.eval_json_result);
357 357
}
......
431 431
}
432 432

  
433 433
function recalc_amounts_and_taxes() {
434
  var data = $('#order_form').serialize();
435
  data += '&action=Order/recalc_amounts_and_taxes';
434
  var data = $('#order_form').serializeArray();
435
  data.push({ name: 'action', value: 'Order/recalc_amounts_and_taxes' });
436 436

  
437 437
  $.post("controller.pl", data, kivi.eval_json_result);
438 438
}
......
544 544

  
545 545
  $('#' + order_by + '_header_id a').append('<img border=0 data-sort-dir=' + dir + ' src=' + src + ' alt="[%- LxERP.t8('sort items') %]">');
546 546

  
547
  var data = $('#order_form').serialize();
548
  data += '&action=Order/reorder_items';
549
  data += '&order_by=' + order_by;
550
  data += '&sort_dir=' + dir;
547
  var data = $('#order_form').serializeArray();
548
  data.push({ name: 'action', value: 'Order/reorder_items' });
549
  data.push({ name: 'order_by', value: order_by });
550
  data.push({ name: 'sort_dir', value: dir });
551 551

  
552 552
  $.post("controller.pl", data, kivi.eval_json_result);
553 553
}
......
572 572
  var longdescription;
573 573

  
574 574
  if (!longdescription_elt.length) {
575
    var data = 'action=Order/get_item_longdescription';
576
    data += '&type=' + $('#type').val();
577
    data += '&item_id=' + $(row).find('[name="order.orderitems[+].id"]').val();
578
    data += '&parts_id=' + $(row).find('[name="order.orderitems[].parts_id"]').val();
575
    var data = [];
576
    data.push({ name: 'action', value: 'Order/get_item_longdescription' });
577
    data.push({ name: 'type', value: $('#type').val() });
578
    data.push({ name: 'item_id', value: $(row).find('[name="order.orderitems[+].id"]').val() });
579
    data.push({ name: 'parts_id', value: $(row).find('[name="order.orderitems[].parts_id"]').val() });
579 580
    $.ajax({
580 581
      url: 'controller.pl',
581 582
      data: data,

Auch abrufbar als: Unified diff