From 43816cb7289ee9225c3bb229d077bd87a75562cc Mon Sep 17 00:00:00 2001 From: =?utf8?q?Bernd=20Ble=C3=9Fmann?= Date: Thu, 31 Mar 2022 15:48:56 +0200 Subject: [PATCH] =?utf8?q?Letter:=20"alle"=20E-Mail-Adressen=20per=20Anhak?= =?utf8?q?en=20als=20Empf=C3=A4nger?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- SL/Controller/Letter.pm | 4 +++- js/kivi.SalesPurchase.js | 9 ++++++--- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/SL/Controller/Letter.pm b/SL/Controller/Letter.pm index 4da3e1918..4faf452cf 100644 --- a/SL/Controller/Letter.pm +++ b/SL/Controller/Letter.pm @@ -620,6 +620,8 @@ sub setup_load_letter_draft_action_bar { sub setup_display_action_bar { my ($self, %params) = @_; + my $vc = $self->is_sales ? 'customer' : 'vendor'; # needed for show_email_dialog + for my $bar ($::request->layout->get('actionbar')) { $bar->add( action => [ @@ -655,7 +657,7 @@ sub setup_display_action_bar { ], action => [ t8('E-mail'), - call => [ 'kivi.SalesPurchase.show_email_dialog', 'Letter/send_email' ], + call => [ 'kivi.SalesPurchase.show_email_dialog', 'Letter/send_email', $vc, '#letter_' . $vc . '_id' ], disabled => !$self->letter->id ? t8('The object has not been saved yet.') : undef, ], ], diff --git a/js/kivi.SalesPurchase.js b/js/kivi.SalesPurchase.js index 2b13dd866..a350e1963 100644 --- a/js/kivi.SalesPurchase.js +++ b/js/kivi.SalesPurchase.js @@ -274,10 +274,13 @@ namespace('kivi.SalesPurchase', function(ns) { return true; }; - this.show_email_dialog = function(send_action) { + this.show_email_dialog = function(send_action, vc, vc_id_selector) { $('#form').data('send-email-action', send_action || 'send_sales_purchase_email'); - var vc = $('#vc').val(); + vc = vc || $('#vc').val(); + vc_id_selector = vc_id_selector || '#' + vc + '_id'; + var vc_id = $(vc_id_selector).val(); + var data = { action: 'show_sales_purchase_email_dialog', cp_id: $('#cp_id').val(), @@ -295,7 +298,7 @@ namespace('kivi.SalesPurchase', function(ns) { quonumber: $('#quonumber').val(), type: $('#type').val(), vc: vc, - vc_id: $('#' + vc + '_id').val(), + vc_id: vc_id, project_id: $('#globalproject_id').val(), }; -- 2.20.1