From: Bernd Bleßmann Date: Mon, 28 Mar 2022 09:19:41 +0000 (+0200) Subject: Auftrags-Controller: Speichern und schließen, … X-Git-Tag: kivitendo-mebil_0.1-0~10^2~2^2~78 X-Git-Url: http://wagnertech.de/git?a=commitdiff_plain;h=abafb475d9742e3a6c28427477235c923b21eeef;p=kivitendo-erp.git Auftrags-Controller: Speichern und schließen, … … was einen zurück zur voherigen Ansicht bringt --- diff --git a/SL/Controller/Order.pm b/SL/Controller/Order.pm index b7793b1be..39b3c0128 100644 --- a/SL/Controller/Order.pm +++ b/SL/Controller/Order.pm @@ -197,11 +197,19 @@ sub action_save { : ''; flash_later('info', $text); - my @redirect_params = ( - action => 'edit', - type => $self->type, - id => $self->order->id, - ); + my @redirect_params; + if ($::form->{back_to_caller}) { + @redirect_params = $::form->{callback} ? ($::form->{callback}) + : (controller => 'LoginScreen', action => 'user_login'); + + } else { + @redirect_params = ( + action => 'edit', + type => $self->type, + id => $self->order->id, + callback => $::form->{callback}, + ); + } $self->redirect_to(@redirect_params); } @@ -2055,6 +2063,17 @@ sub setup_edit_action_bar { ], disabled => !$may_edit_create ? t8('You do not have the permissions to access this function.') : undef, ], + action => [ + t8('Save and Close'), + call => [ 'kivi.Order.save', 'save', $::instance_conf->get_order_warn_duplicate_parts, + $::instance_conf->get_order_warn_no_deliverydate, + 1 + ], + checks => [ 'kivi.Order.check_save_active_periodic_invoices', ['kivi.validate_form','#order_form'], + @req_trans_cost_art, @req_cusordnumber, + ], + disabled => !$may_edit_create ? t8('You do not have the permissions to access this function.') : undef, + ], action => [ t8('Save as new'), call => [ 'kivi.Order.save', 'save_as_new', $::instance_conf->get_order_warn_duplicate_parts ], diff --git a/js/kivi.Order.js b/js/kivi.Order.js index 729407274..05cea60a3 100644 --- a/js/kivi.Order.js +++ b/js/kivi.Order.js @@ -45,7 +45,7 @@ namespace('kivi.Order', function(ns) { } }; - ns.save = function(action, warn_on_duplicates, warn_on_reqdate) { + ns.save = function(action, warn_on_duplicates, warn_on_reqdate, back_to_caller) { if (!ns.check_cv()) return; if (warn_on_duplicates && !ns.check_duplicate_parts()) return; if (warn_on_reqdate && !ns.check_valid_reqdate()) return; @@ -53,6 +53,8 @@ namespace('kivi.Order', function(ns) { var data = $('#order_form').serializeArray(); data.push({ name: 'action', value: 'Order/' + action }); + if (back_to_caller) data.push({ name: 'back_to_caller', value: '1' }); + $.post("controller.pl", data, kivi.eval_json_result); };