From ac1a9e8e357375b2426041eefee1f555fc5139b5 Mon Sep 17 00:00:00 2001 From: Moritz Bunkus Date: Mon, 16 Jan 2017 15:33:34 +0100 Subject: [PATCH] =?utf8?q?ActionBar:=20Brieffunktion:=20E-Mail-Versand=20?= =?utf8?q?=C3=BCber=20Dialog?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- SL/Controller/Letter.pm | 60 +++-------------------------- js/kivi.SalesPurchase.js | 6 ++- locale/de/all | 1 - templates/webpages/letter/edit.html | 13 +++---- 4 files changed, 14 insertions(+), 66 deletions(-) diff --git a/SL/Controller/Letter.pm b/SL/Controller/Letter.pm index d0ef0c953..d299eea1e 100644 --- a/SL/Controller/Letter.pm +++ b/SL/Controller/Letter.pm @@ -301,48 +301,11 @@ sub action_delete_drafts { $self->action_add(skip_drafts => 1); } -sub action_edit_email { - my ($self) = @_; - - my $letter = $self->_update; - $self->export_letter_to_form($letter); - - $::form->{formname} = "letter"; - $::form->{type} = "letter"; - $::form->{letternumber} = $self->letter->letternumber; - - my @hiddens = map { - my $value = $letter->$_; - $value = $value->to_kivitendo if ref($_) =~ m{Date}; - - { name => "letter.$_", value => $value } - } ($letter->meta->columns); - - my %vars = ( - script => 'controller.pl', - title => t8('Send letter via e-mail'), - email => $letter->contact ? $letter->contact->cp_email : '', - subject => $::form->generate_email_subject, - a_filename => $::form->generate_attachment_filename, - HIDDEN => \@hiddens, - SHOW_BCC => $::auth->assert('email_bcc', 'may fail'), - ); - - $::request->layout->use_javascript("kivi.SalesPurchase.js"); - $self->setup_edit_email_action_bar; - $self->render('letter/edit_email', %vars); -} - sub action_send_email { my ($self) = @_; $::form->{media} = 'email'; - $self->action_print_letter( - email => { - to => $::form->{email}, - map { ($_ => $::form->{$_}) } qw(cc bcc subject attachment_filename message) - } - ); + $self->action_print_letter(email => $::form->{email_form}); } ### internal methods @@ -377,7 +340,9 @@ sub _display { options => { no_postscript => 1, no_opendocument => 1, no_html => 1, - no_queue => 1 }), + no_queue => 1, + show_headers => 1, + }), ); } @@ -695,7 +660,7 @@ sub setup_display_action_bar { ], action => [ t8('E-mail'), - submit => [ '#form', { action => 'Letter/edit_email' } ], + call => [ 'kivi.SalesPurchase.show_email_dialog', 'Letter/send_email' ], disabled => !$self->letter->id ? t8('The object has not been saved yet.') : undef, ], ], @@ -703,21 +668,6 @@ sub setup_display_action_bar { } } -sub setup_edit_email_action_bar { - my ($self, %params) = @_; - - for my $bar ($::request->layout->get('actionbar')) { - $bar->add( - action => [ - t8('Continue'), - submit => [ '#form', { action => 'Letter/send_email' } ], - checks => [ 'kivi.SalesPurchase.check_required_email_fields' ], - accesskey => 'enter', - ], - ); - } -} - sub setup_list_action_bar { my ($self, %params) = @_; diff --git a/js/kivi.SalesPurchase.js b/js/kivi.SalesPurchase.js index 5dc81f50c..c19c10a68 100644 --- a/js/kivi.SalesPurchase.js +++ b/js/kivi.SalesPurchase.js @@ -245,7 +245,7 @@ namespace('kivi.SalesPurchase', function(ns) { $('#send_email_dialog').children().remove().appendTo('#email_inputs'); $('#send_email_dialog').dialog('close'); - kivi.submit_form_with_action('#form', 'send_sales_purchase_email'); + kivi.submit_form_with_action('#form', $('#form').data('send-email-action')); return true; }; @@ -265,7 +265,9 @@ namespace('kivi.SalesPurchase', function(ns) { return true; }; - this.show_email_dialog = function() { + this.show_email_dialog = function(send_action) { + $('#form').data('send-email-action', send_action || 'send_sales_purchase_email'); + kivi.popup_dialog({ id: 'send_email_dialog', url: 'io.pl', diff --git a/locale/de/all b/locale/de/all index 7f858ec19..0cc5f0ede 100755 --- a/locale/de/all +++ b/locale/de/all @@ -2581,7 +2581,6 @@ $self->{texts} = { 'Send a blind copy of all outgoing emails to current user\'s email address?' => 'Eine blinde Kopie aller ausgehenden E-Mails wird an den angemeldeten Nutzer geschickt', 'Send email' => 'E-Mail verschicken', 'Send invoice via email' => 'Rechnung via E-Mail verschicken', - 'Send letter via e-mail' => 'Brief via E-Mail verschicken', 'Sender' => 'AbsenderIn', 'Sending E-mail: ' => 'E-Mail versenden: ', 'Sent emails can be optionally stored in the database with or without their attachments.' => 'Gesendete E-Mails können optional mit oder ohne ihre Anhänge in der Datenbank gespeichert werden.', diff --git a/templates/webpages/letter/edit.html b/templates/webpages/letter/edit.html index a31d3913e..027abe898 100644 --- a/templates/webpages/letter/edit.html +++ b/templates/webpages/letter/edit.html @@ -133,16 +133,13 @@ - -
- - - - [% print_options %] - - + + + [% PROCESS 'webdav/_list.html' %]
-- 2.20.1