Revision ac1a9e8e
Von Moritz Bunkus vor fast 8 Jahren hinzugefügt
SL/Controller/Letter.pm | ||
---|---|---|
301 | 301 |
$self->action_add(skip_drafts => 1); |
302 | 302 |
} |
303 | 303 |
|
304 |
sub action_edit_email { |
|
305 |
my ($self) = @_; |
|
306 |
|
|
307 |
my $letter = $self->_update; |
|
308 |
$self->export_letter_to_form($letter); |
|
309 |
|
|
310 |
$::form->{formname} = "letter"; |
|
311 |
$::form->{type} = "letter"; |
|
312 |
$::form->{letternumber} = $self->letter->letternumber; |
|
313 |
|
|
314 |
my @hiddens = map { |
|
315 |
my $value = $letter->$_; |
|
316 |
$value = $value->to_kivitendo if ref($_) =~ m{Date}; |
|
317 |
|
|
318 |
{ name => "letter.$_", value => $value } |
|
319 |
} ($letter->meta->columns); |
|
320 |
|
|
321 |
my %vars = ( |
|
322 |
script => 'controller.pl', |
|
323 |
title => t8('Send letter via e-mail'), |
|
324 |
email => $letter->contact ? $letter->contact->cp_email : '', |
|
325 |
subject => $::form->generate_email_subject, |
|
326 |
a_filename => $::form->generate_attachment_filename, |
|
327 |
HIDDEN => \@hiddens, |
|
328 |
SHOW_BCC => $::auth->assert('email_bcc', 'may fail'), |
|
329 |
); |
|
330 |
|
|
331 |
$::request->layout->use_javascript("kivi.SalesPurchase.js"); |
|
332 |
$self->setup_edit_email_action_bar; |
|
333 |
$self->render('letter/edit_email', %vars); |
|
334 |
} |
|
335 |
|
|
336 | 304 |
sub action_send_email { |
337 | 305 |
my ($self) = @_; |
338 | 306 |
|
339 | 307 |
$::form->{media} = 'email'; |
340 |
$self->action_print_letter( |
|
341 |
email => { |
|
342 |
to => $::form->{email}, |
|
343 |
map { ($_ => $::form->{$_}) } qw(cc bcc subject attachment_filename message) |
|
344 |
} |
|
345 |
); |
|
308 |
$self->action_print_letter(email => $::form->{email_form}); |
|
346 | 309 |
} |
347 | 310 |
|
348 | 311 |
### internal methods |
... | ... | |
377 | 340 |
options => { no_postscript => 1, |
378 | 341 |
no_opendocument => 1, |
379 | 342 |
no_html => 1, |
380 |
no_queue => 1 }), |
|
343 |
no_queue => 1, |
|
344 |
show_headers => 1, |
|
345 |
}), |
|
381 | 346 |
|
382 | 347 |
); |
383 | 348 |
} |
... | ... | |
695 | 660 |
], |
696 | 661 |
action => [ |
697 | 662 |
t8('E-mail'), |
698 |
submit => [ '#form', { action => 'Letter/edit_email' } ],
|
|
663 |
call => [ 'kivi.SalesPurchase.show_email_dialog', 'Letter/send_email' ],
|
|
699 | 664 |
disabled => !$self->letter->id ? t8('The object has not been saved yet.') : undef, |
700 | 665 |
], |
701 | 666 |
], |
... | ... | |
703 | 668 |
} |
704 | 669 |
} |
705 | 670 |
|
706 |
sub setup_edit_email_action_bar { |
|
707 |
my ($self, %params) = @_; |
|
708 |
|
|
709 |
for my $bar ($::request->layout->get('actionbar')) { |
|
710 |
$bar->add( |
|
711 |
action => [ |
|
712 |
t8('Continue'), |
|
713 |
submit => [ '#form', { action => 'Letter/send_email' } ], |
|
714 |
checks => [ 'kivi.SalesPurchase.check_required_email_fields' ], |
|
715 |
accesskey => 'enter', |
|
716 |
], |
|
717 |
); |
|
718 |
} |
|
719 |
} |
|
720 |
|
|
721 | 671 |
sub setup_list_action_bar { |
722 | 672 |
my ($self, %params) = @_; |
723 | 673 |
|
js/kivi.SalesPurchase.js | ||
---|---|---|
245 | 245 |
$('#send_email_dialog').children().remove().appendTo('#email_inputs'); |
246 | 246 |
$('#send_email_dialog').dialog('close'); |
247 | 247 |
|
248 |
kivi.submit_form_with_action('#form', 'send_sales_purchase_email');
|
|
248 |
kivi.submit_form_with_action('#form', $('#form').data('send-email-action'));
|
|
249 | 249 |
|
250 | 250 |
return true; |
251 | 251 |
}; |
... | ... | |
265 | 265 |
return true; |
266 | 266 |
}; |
267 | 267 |
|
268 |
this.show_email_dialog = function() { |
|
268 |
this.show_email_dialog = function(send_action) { |
|
269 |
$('#form').data('send-email-action', send_action || 'send_sales_purchase_email'); |
|
270 |
|
|
269 | 271 |
kivi.popup_dialog({ |
270 | 272 |
id: 'send_email_dialog', |
271 | 273 |
url: 'io.pl', |
locale/de/all | ||
---|---|---|
2581 | 2581 |
'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', |
2582 | 2582 |
'Send email' => 'E-Mail verschicken', |
2583 | 2583 |
'Send invoice via email' => 'Rechnung via E-Mail verschicken', |
2584 |
'Send letter via e-mail' => 'Brief via E-Mail verschicken', |
|
2585 | 2584 |
'Sender' => 'AbsenderIn', |
2586 | 2585 |
'Sending E-mail: ' => 'E-Mail versenden: ', |
2587 | 2586 |
'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.', |
templates/webpages/letter/edit.html | ||
---|---|---|
133 | 133 |
<!-- /central block --> |
134 | 134 |
</td> |
135 | 135 |
</tr> |
136 |
<tr> |
|
137 |
<td colspan=3><hr size="3" noshade></td> |
|
138 |
</tr> |
|
139 |
<tr> |
|
140 |
<td> |
|
141 |
[% print_options %] |
|
142 |
</td> |
|
143 |
</tr> |
|
144 | 136 |
</table> |
145 | 137 |
|
138 |
<div id="email_inputs" class="hidden"></div> |
|
139 |
<div id="print_options" class="hidden"> |
|
140 |
[% print_options %] |
|
141 |
</div> |
|
142 |
|
|
146 | 143 |
</div> |
147 | 144 |
[% PROCESS 'webdav/_list.html' %] |
148 | 145 |
<div id="ui-tabs-1"> |
Auch abrufbar als: Unified diff
ActionBar: Brieffunktion: E-Mail-Versand über Dialog