use SL::SessionFile::Random;
use SL::PriceSource;
use SL::Form;
+use SL::Webdav;
use SL::DB::Order;
use SL::DB::Customer;
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);
}
+ 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);
}