From d6b56cbd6138dd03b755a8d9f4828568cfafaf53 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Bernd=20Ble=C3=9Fmann?= Date: Tue, 22 Sep 2020 16:18:31 +0200 Subject: [PATCH] =?utf8?q?Auftrags-Controller:=20Speichern=20und=20E-Mail-?= =?utf8?q?Dialog=20=C3=BCber=20vorhandene=20Funktion?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Die js-Funktion email() tut praktisch das gleiche wie save(). Dann kann auch diese benutzt werden. Damit auch klar ist, dass vor dem Aufruf des E-Mail-Dialogs gespeichert wird, ist die action im Controller umbenannt worden. --- SL/Controller/Order.pm | 4 ++-- js/kivi.Order.js | 13 +------------ 2 files changed, 3 insertions(+), 14 deletions(-) diff --git a/SL/Controller/Order.pm b/SL/Controller/Order.pm index 4f2abe523..12b9bae64 100644 --- a/SL/Controller/Order.pm +++ b/SL/Controller/Order.pm @@ -350,7 +350,7 @@ sub action_print { } # open the email dialog -sub action_show_email_dialog { +sub action_save_and_show_email_dialog { my ($self) = @_; my $errors = $self->save(); @@ -1884,7 +1884,7 @@ sub setup_edit_action_bar { ], action => [ t8('Save and E-mail'), - call => [ 'kivi.Order.email', $::instance_conf->get_order_warn_duplicate_parts ], + call => [ 'kivi.Order.save', 'save_and_show_email_dialog', $::instance_conf->get_order_warn_duplicate_parts ], ], action => [ t8('Download attachments of all parts'), diff --git a/js/kivi.Order.js b/js/kivi.Order.js index a62be8838..288af2d42 100644 --- a/js/kivi.Order.js +++ b/js/kivi.Order.js @@ -28,7 +28,7 @@ namespace('kivi.Order', function(ns) { } if (pos.length > 0) { - question = question || kivi.t8("Do you really want to save?"); + question = question || kivi.t8("Do you really want to continue?"); return confirm(kivi.t8("There are duplicate parts at positions") + "\n" + pos.join(', ') + "\n" + question); @@ -89,17 +89,6 @@ namespace('kivi.Order', function(ns) { $.post("controller.pl", data, kivi.eval_json_result); }; - ns.email = function(warn_on_duplicates) { - if (warn_on_duplicates && !ns.check_duplicate_parts(kivi.t8("Do you really want to send by mail?"))) return; - if (!ns.check_cv()) return; - - var data = $('#order_form').serializeArray(); - data.push({ name: 'order.language_id', value: $('#language_id').val() }); // language from print options - data.push({ name: 'action', value: 'Order/show_email_dialog' }); - - $.post("controller.pl", data, kivi.eval_json_result); - }; - var email_dialog; ns.setup_send_email_dialog = function() { -- 2.20.1