$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
options => { no_postscript => 1,
no_opendocument => 1,
no_html => 1,
- no_queue => 1 }),
+ no_queue => 1,
+ show_headers => 1,
+ }),
);
}
],
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,
],
],
}
}
-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) = @_;
$('#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;
};
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',
'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.',