From 56d0b88fb434343256ba3cda50534356f6c44493 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Jan=20B=C3=BCren?= Date: Wed, 30 Sep 2015 19:29:24 +0200 Subject: [PATCH] MRCP.pm. Falls Webdav Archivierung auch PDF in Webdav kopieren MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Beim Massenwandeln prinizipiell auch den WebDAV Ordner und die Datei plus Zeitstempel erstellen. Entsprechende Fehlermeldungen an die Oberfläche zurückgeben, wie allen anderen Meldungen in MRCP auch. --- .../MassRecordCreationAndPrinting.pm | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) 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; -- 2.20.1