From: Bernd Bleßmann Date: Thu, 22 Feb 2018 15:15:59 +0000 (+0100) Subject: Auftrags-Controller: Mini-Refactoring: js-save-Funktionen zusammengefasst X-Git-Tag: release-3.5.4~455 X-Git-Url: http://wagnertech.de/git?a=commitdiff_plain;h=068063804d2061fe26e70f7bfdba2a99c18d935a;p=kivitendo-erp.git Auftrags-Controller: Mini-Refactoring: js-save-Funktionen zusammengefasst --- diff --git a/SL/Controller/Order.pm b/SL/Controller/Order.pm index c081e4200..8ee73f9c8 100644 --- a/SL/Controller/Order.pm +++ b/SL/Controller/Order.pm @@ -1395,24 +1395,24 @@ sub _setup_edit_action_bar { 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" diff --git a/js/kivi.Order.js b/js/kivi.Order.js index fc7bb2305..1a5924c11 100644 --- a/js/kivi.Order.js +++ b/js/kivi.Order.js @@ -35,42 +35,12 @@ namespace('kivi.Order', function(ns) { 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); };