Revision 96186c41
Von Bernd Bleßmann vor mehr als 3 Jahren hinzugefügt
SL/BackgroundJob/CreatePeriodicInvoices.pm | ||
---|---|---|
16 | 16 |
use SL::DB::Invoice; |
17 | 17 |
use SL::DB::PeriodicInvoice; |
18 | 18 |
use SL::DB::PeriodicInvoicesConfig; |
19 |
use SL::File; |
|
19 | 20 |
use SL::Helper::CreatePDF qw(create_pdf find_template); |
20 | 21 |
use SL::Mailer; |
21 | 22 |
use SL::Util qw(trim); |
... | ... | |
358 | 359 |
Common::copy_file_to_webdav_folder($form); |
359 | 360 |
} |
360 | 361 |
|
362 |
sub _store_pdf_in_filemanagement { |
|
363 |
my ($self, $pdf_file, $invoice) = @_; |
|
364 |
|
|
365 |
return unless $::instance_conf->get_doc_storage; |
|
366 |
|
|
367 |
# create a form for generate_attachment_filename |
|
368 |
my $form = Form->new(''); |
|
369 |
$form->{invnumber} = $invoice->invnumber; |
|
370 |
$form->{type} = 'invoice'; |
|
371 |
$form->{format} = 'pdf'; |
|
372 |
$form->{formname} = 'invoice'; |
|
373 |
$form->{language} = '_' . $invoice->language->template_code if $invoice->language; |
|
374 |
my $doc_name = $form->generate_attachment_filename(); |
|
375 |
|
|
376 |
SL::File->save(object_id => $invoice->id, |
|
377 |
object_type => 'invoice', |
|
378 |
mime_type => 'application/pdf', |
|
379 |
source => 'created', |
|
380 |
file_type => 'document', |
|
381 |
file_name => $doc_name, |
|
382 |
file_path => $pdf_file); |
|
383 |
} |
|
384 |
|
|
361 | 385 |
sub _print_invoice { |
362 | 386 |
my ($self, $data) = @_; |
363 | 387 |
|
... | ... | |
435 | 459 |
eval { |
436 | 460 |
$pdf_file_name = $self->create_pdf(%create_params); |
437 | 461 |
|
438 |
$self->_store_pdf_in_webdav($pdf_file_name, $data->{invoice}); |
|
462 |
$self->_store_pdf_in_webdav ($pdf_file_name, $data->{invoice}); |
|
463 |
$self->_store_pdf_in_filemanagement($pdf_file_name, $data->{invoice}); |
|
439 | 464 |
|
440 | 465 |
for (qw(email_subject email_body)) { |
441 | 466 |
_replace_vars( |
Auch abrufbar als: Unified diff
wiederkehrende Rechnungen: auch bei E-Mail erzeugtes Dokument im DMS speichern