From: Bernd Bleßmann Date: Wed, 11 Nov 2015 12:20:51 +0000 (+0100) Subject: Auftrags-Controller: Webdav X-Git-Url: http://wagnertech.de/git?a=commitdiff_plain;h=41229db38e57ad893178df32d7a30045ef77f5fd;p=kivitendo-erp.git Auftrags-Controller: Webdav --- diff --git a/SL/Controller/Order.pm b/SL/Controller/Order.pm index 6f422134a..9310f9110 100644 --- a/SL/Controller/Order.pm +++ b/SL/Controller/Order.pm @@ -9,6 +9,7 @@ use SL::Locale::String; use SL::SessionFile::Random; use SL::PriceSource; use SL::Form; +use SL::Webdav; use SL::DB::Order; use SL::DB::Customer; @@ -134,6 +135,24 @@ sub action_create_pdf { my $pdf_filename = $form->generate_attachment_filename(); + # copy file to webdav folder + if ($self->order->ordnumber && $::instance_conf->get_webdav_documents) { + my $webdav = SL::Webdav->new( + type => $self->type, + number => $self->order->ordnumber, + ); + my $webdav_file = SL::Webdav::File->new( + webdav => $webdav, + filename => $pdf_filename, + ); + eval { + $webdav_file->store(data => \$pdf); + 1; + } or do { + $self->js->flash('error', t8('Storing PDF to webdav folder failed: #1', $@)); + } + } + $self->js ->run('download_pdf', $pdf_filename, $key) ->flash('info', t8('The PDF has been created'))->render($self); @@ -669,6 +688,19 @@ sub _pre_render { } + if ($self->order->ordnumber && $::instance_conf->get_webdav) { + my $webdav = SL::Webdav->new( + type => $self->type, + number => $self->order->ordnumber, + ); + my $webdav_path = $webdav->webdav_path; + my @all_objects = $webdav->get_all_objects; + @{ $self->{template_args}->{WEBDAV} } = map { { name => $_->filename, + type => t8('File'), + link => File::Spec->catdir($webdav_path, $_->filename), + } } @all_objects; + } + $::request->{layout}->use_javascript("${_}.js") for qw(ckeditor/ckeditor ckeditor/adapters/jquery); }