combobox => [
action => [
t8('Save'),
- call => [ 'kivi.Order.save', $::instance_conf->get_order_warn_duplicate_parts ],
+ call => [ 'kivi.Order.save', 'save', $::instance_conf->get_order_warn_duplicate_parts ],
checks => [ 'kivi.Order.check_save_active_periodic_invoices' ],
],
action => [
t8('Save as new'),
- call => [ 'kivi.Order.save_as_new', $::instance_conf->get_order_warn_duplicate_parts ],
+ call => [ 'kivi.Order.save', 'save_as_new', $::instance_conf->get_order_warn_duplicate_parts ],
checks => [ 'kivi.Order.check_save_active_periodic_invoices' ],
disabled => !$self->order->id ? t8('This object has not been saved yet.') : undef,
],
action => [
t8('Save and Delivery Order'),
- call => [ 'kivi.Order.save_and_delivery_order', $::instance_conf->get_order_warn_duplicate_parts ],
+ call => [ 'kivi.Order.save', 'save_and_delivery_order', $::instance_conf->get_order_warn_duplicate_parts ],
checks => [ 'kivi.Order.check_save_active_periodic_invoices' ],
only_if => (any { $self->type eq $_ } (_sales_order_type(), _purchase_order_type()))
],
action => [
t8('Save and Invoice'),
- call => [ 'kivi.Order.save_and_invoice', $::instance_conf->get_order_warn_duplicate_parts ],
+ call => [ 'kivi.Order.save', 'save_and_invoice', $::instance_conf->get_order_warn_duplicate_parts ],
checks => [ 'kivi.Order.check_save_active_periodic_invoices' ],
],
], # end of combobox "Save"
return true;
};
- ns.save = function(warn_on_duplicates) {
+ ns.save = function(action, warn_on_duplicates) {
if (!ns.check_cv()) return;
if (warn_on_duplicates && !ns.check_save_duplicate_parts()) return;
var data = $('#order_form').serializeArray();
- data.push({ name: 'action', value: 'Order/save' });
-
- $.post("controller.pl", data, kivi.eval_json_result);
- };
-
- ns.save_as_new = function(warn_on_duplicates) {
- if (!ns.check_cv()) return;
- if (warn_on_duplicates && !ns.check_save_duplicate_parts()) return;
-
- var data = $('#order_form').serializeArray();
- data.push({ name: 'action', value: 'Order/save_as_new' });
-
- $.post("controller.pl", data, kivi.eval_json_result);
- };
-
- ns.save_and_delivery_order = function(warn_on_duplicates) {
- if (!ns.check_cv()) return;
- if (warn_on_duplicates && !ns.check_save_duplicate_parts()) return;
-
- var data = $('#order_form').serializeArray();
- data.push({ name: 'action', value: 'Order/save_and_delivery_order' });
-
- $.post("controller.pl", data, kivi.eval_json_result);
- };
-
- ns.save_and_invoice = function(warn_on_duplicates) {
- if (!ns.check_cv()) return;
- if (warn_on_duplicates && !ns.check_save_duplicate_parts()) return;
-
- var data = $('#order_form').serializeArray();
- data.push({ name: 'action', value: 'Order/save_and_invoice' });
+ data.push({ name: 'action', value: 'Order/' + action });
$.post("controller.pl", data, kivi.eval_json_result);
};