function save() {
if (!check_cv()) return;
- var data = $('#order_form').serialize();
- data += '&action=Order/save';
+ var data = $('#order_form').serializeArray();
+ data.push({ name: 'action', value: 'Order/save' });
$.post("controller.pl", data, kivi.eval_json_result);
}
function create_pdf() {
if (!check_cv()) return;
- var data = $('#order_form').serialize();
- data += '&action=Order/create_pdf';
+ var data = $('#order_form').serializeArray();
+ data.push({ name: 'action', value: 'Order/create_pdf' });
$.post("controller.pl", data, kivi.eval_json_result);
}
function download_pdf(pdf_filename, key) {
- var data = 'action=Order/download_pdf';
- data += '&type=' + $('#type').val();
- data += '&pdf_filename=' + pdf_filename;
- data += '&key=' + key;
+ var data = [];
+ data.push({ name: 'action', value: 'Order/download_pdf' });
+ data.push({ name: 'type', value: $('#type').val() });
+ data.push({ name: 'pdf_filename', value: pdf_filename });
+ data.push({ name: 'key', value: key });
$.download("controller.pl", data);
}
function email() {
if (!check_cv()) return;
- var data = $('#order_form').serialize();
- data += '&action=Order/show_email_dialog';
+ var data = $('#order_form').serializeArray();
+ data.push({ name: 'action', value: 'Order/show_email_dialog' });
$.post("controller.pl", data, kivi.eval_json_result);
}
function save_and_delivery_order() {
if (!check_cv()) return;
- var data = $('#order_form').serialize();
- data += '&action=Order/save_and_delivery_order';
+ var data = $('#order_form').serializeArray();
+ data.push({ name: 'action', value: 'Order/save_and_delivery_order' });
$.post("controller.pl", data, kivi.eval_json_result);
}
<script type='text/javascript'>
function update_result() {
- var data = $('#multi_items_form').serialize();
- data += '&type=[%- FORM.type %]';
+ var data = $('#multi_items_form').serializeArray();
+ data.push({ name: 'type', value: '[%- FORM.type %]' });
$.ajax({
url: 'controller.pl?action=Order/multi_items_update_result',
data: data,
}
function add_multi_items() {
- var data = $('#[%- FORM.callback_data_id %]').serialize();
- data += '&';
- data += $('#multi_items_form').serialize();
- data += '&action=[%- FORM.callback %]';
+ var data = $('#[%- FORM.callback_data_id %]').serializeArray();
+ data = data.concat($('#multi_items_form').serializeArray());
+ data.push({ name: 'action', value: '[%- FORM.callback %]' });
$.post("controller.pl", data, kivi.eval_json_result);
}
<script type='text/javascript'>
function reload_cv_dependend_selections() {
- var data = $('#order_form').serialize();
- data += '&action=Order/customer_vendor_changed';
+ var data = $('#order_form').serializeArray();
+ data.push({ name: 'action', value: 'Order/customer_vendor_changed' });
$.post("controller.pl", data, kivi.eval_json_result);
}
var oldval = $(select_elt).data('oldval');
$(select_elt).data('oldval', $(select_elt).val());
- var data = $('#order_form').serialize();
- data += '&action=Order/unit_changed';
- data += '&item_id=' + item_id_dom.val();
- data += '&old_unit=' + oldval;
- data += '&sellprice_dom_id=' + sellprice_dom.attr('id');
+ var data = $('#order_form').serializeArray();
+ data.push({ name: 'action', value: 'Order/unit_changed' });
+ data.push({ name: 'item_id', value: item_id_dom.val() });
+ data.push({ name: 'old_unit', value: oldval });
+ data.push({ name: 'sellprice_dom_id', value: sellprice_dom.attr('id') });
$.post("controller.pl", data, kivi.eval_json_result);
}
$('#row_table_id thead a img').remove();
- var data = $('#order_form').serialize();
- data += '&action=Order/add_item';
+ var data = $('#order_form').serializeArray();
+ data.push({ name: 'action', value: 'Order/add_item' });
$.post("controller.pl", data, kivi.eval_json_result);
}
var row = $(clicked).parents("tbody").first();
var item_id_dom = $(row).find('[name="orderitem_ids[+]"]');
- var data = $('#order_form').serialize();
- data += '&action=Order/price_popup';
- data += '&item_id=' + item_id_dom.val();
+ var data = $('#order_form').serializeArray();
+ data.push({ name: 'action', value: 'Order/price_popup' });
+ data.push({ name: 'item_id', value: item_id_dom.val() });
$.post("controller.pl", data, kivi.eval_json_result);
}
}
function recalc_amounts_and_taxes() {
- var data = $('#order_form').serialize();
- data += '&action=Order/recalc_amounts_and_taxes';
+ var data = $('#order_form').serializeArray();
+ data.push({ name: 'action', value: 'Order/recalc_amounts_and_taxes' });
$.post("controller.pl", data, kivi.eval_json_result);
}
$('#' + order_by + '_header_id a').append('<img border=0 data-sort-dir=' + dir + ' src=' + src + ' alt="[%- LxERP.t8('sort items') %]">');
- var data = $('#order_form').serialize();
- data += '&action=Order/reorder_items';
- data += '&order_by=' + order_by;
- data += '&sort_dir=' + dir;
+ var data = $('#order_form').serializeArray();
+ data.push({ name: 'action', value: 'Order/reorder_items' });
+ data.push({ name: 'order_by', value: order_by });
+ data.push({ name: 'sort_dir', value: dir });
$.post("controller.pl", data, kivi.eval_json_result);
}
var longdescription;
if (!longdescription_elt.length) {
- var data = 'action=Order/get_item_longdescription';
- data += '&type=' + $('#type').val();
- data += '&item_id=' + $(row).find('[name="order.orderitems[+].id"]').val();
- data += '&parts_id=' + $(row).find('[name="order.orderitems[].parts_id"]').val();
+ var data = [];
+ data.push({ name: 'action', value: 'Order/get_item_longdescription' });
+ data.push({ name: 'type', value: $('#type').val() });
+ data.push({ name: 'item_id', value: $(row).find('[name="order.orderitems[+].id"]').val() });
+ data.push({ name: 'parts_id', value: $(row).find('[name="order.orderitems[].parts_id"]').val() });
$.ajax({
url: 'controller.pl',
data: data,