From 0bf92081282bc1cad1d7cec16e55f13ca584ff11 Mon Sep 17 00:00:00 2001 From: Moritz Bunkus Date: Mon, 18 Apr 2016 14:45:09 +0200 Subject: [PATCH] Brieffunktion: beim Drucken im WebDAV speichern --- SL/Controller/Letter.pm | 13 +++++++++++-- doc/changelog | 5 +++-- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/SL/Controller/Letter.pm b/SL/Controller/Letter.pm index 2af59b07d..9ca6bc76c 100644 --- a/SL/Controller/Letter.pm +++ b/SL/Controller/Letter.pm @@ -4,6 +4,7 @@ use strict; use parent qw(SL::Controller::Base); use Carp; +use File::Basename; use POSIX qw(strftime); use SL::Controller::Helper::GetModels; use SL::Controller::Helper::ReportGenerator; @@ -247,6 +248,14 @@ sub action_print_letter { return !$err; } + my $webdav_copy_args = Form->new(''); + %{ $webdav_copy_args } = ( + %{ $::form }, + tmpdir => dirname($pdf_file_name), + tmpfile => basename($pdf_file_name), + cwd => POSIX::getcwd(), + ); + if (!$::form->{printer_id} || $::form->{media} eq 'screen') { my $file = IO::File->new($pdf_file_name, 'r') || croak("Cannot open file '$pdf_file_name'"); @@ -263,7 +272,7 @@ sub action_print_letter { $::locale->with_raw_io(\*STDOUT, sub { print while <$file> }); $file->close; - Common::copy_file_to_webdav_folder($::form) if $::instance_conf->get_webdav_documents; + Common::copy_file_to_webdav_folder($webdav_copy_args) if $::instance_conf->get_webdav_documents; unlink $pdf_file_name; return 1; } @@ -275,7 +284,7 @@ sub action_print_letter { binmode $out; print $out scalar(read_file($pdf_file_name)); close $out; - Common::copy_file_to_webdav_folder($::form) if $::instance_conf->get_webdav_documents; + Common::copy_file_to_webdav_folder($webdav_copy_args) if $::instance_conf->get_webdav_documents; flash_later('info', t8('The documents have been sent to the printer \'#1\'.', $printer->printer_description)); $self->redirect_to(action => 'edit', id => $letter->{id}, 'printer_id' => $::form->{printer_id}); diff --git a/doc/changelog b/doc/changelog index 38edef00e..fc5b24240 100644 --- a/doc/changelog +++ b/doc/changelog @@ -7,8 +7,9 @@ einere neue Features und Detailverbesserungen: - Auftrag um Druckvariante Gelangensbestätigung erweitert. - - + - Beim Speichern und Drucken von Briefen werden diese im + WebDAV-Verzeichnis gespeichert, sofern das Feature in der + Mandantenkonfiguration aktiv ist. 2016-03-12 - Release 3.4.0 -- 2.20.1