From: Jan Büren Date: Wed, 30 Sep 2015 17:29:24 +0000 (+0200) Subject: MRCP.pm. Falls Webdav Archivierung auch PDF in Webdav kopieren X-Git-Tag: release-3.4.1~688 X-Git-Url: http://wagnertech.de/git?a=commitdiff_plain;h=56d0b88fb434343256ba3cda50534356f6c44493;p=kivitendo-erp.git MRCP.pm. Falls Webdav Archivierung auch PDF in Webdav kopieren 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. --- 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;