X-Git-Url: http://wagnertech.de/gitweb/gitweb.cgi/mfinanz.git/blobdiff_plain/a32a0746c2ae41dfca264883e3da9864a95915d0..56d0b88fb434343256ba3cda50534356f6c44493:/SL/BackgroundJob/MassRecordCreationAndPrinting.pm diff --git a/SL/BackgroundJob/MassRecordCreationAndPrinting.pm b/SL/BackgroundJob/MassRecordCreationAndPrinting.pm index 6ebe08648..9b374f657 100644 --- a/SL/BackgroundJob/MassRecordCreationAndPrinting.pm +++ b/SL/BackgroundJob/MassRecordCreationAndPrinting.pm @@ -11,6 +11,8 @@ use SL::DB::Invoice; use SL::DB::Printer; use SL::SessionFile; use SL::Template; +use SL::Locale::String qw(t8); +use SL::Webdav; use constant WAITING_FOR_EXECUTION => 0; use constant CONVERTING_DELIVERY_ORDERS => 1; @@ -106,6 +108,24 @@ sub convert_invoices_to_pdf { push @pdf_file_names, $ctrl->create_pdf(%create_params); + # copy file to webdav folder + if ($::instance_conf->get_webdav_documents) { + my $webdav = SL::Webdav->new( + type => 'invoice', + number => $invoice->invnumber, + ); + my $webdav_file = SL::Webdav::File->new( + webdav => $webdav, + filename => t8('Invoice') . '_' . $invoice->invnumber . '.pdf', + ); + eval { + $webdav_file->store(file => $pdf_file_names[-1]); + 1; + } or do { + push @{ $data->{print_errors} }, { id => $invoice->id, number => $invoice->invnumber, message => $@ }; + } + } + $data->{num_printed}++; 1;