X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=SL%2FForm.pm;h=04ac43c41bfa4d3b7d7ef6ffa30c32e52a8d5855;hb=73a58f3dceeb378343ceb151942828eea686b75a;hp=8ae6ed41f3e38243cf55c9101afa1d86c6f5e267;hpb=40b16805562b0bf57d5a5c66c194a9d6cfc855ef;p=kivitendo-erp.git diff --git a/SL/Form.pm b/SL/Form.pm index 8ae6ed41f..04ac43c41 100644 --- a/SL/Form.pm +++ b/SL/Form.pm @@ -472,6 +472,7 @@ sub header { $layout->use_javascript("$_.js") for (qw( jquery jquery-ui jquery.cookie jquery.checkall jquery.download + jquery/jquery.form client_js common part_selection switchmenuframe autocomplete_part ), "jquery/ui/i18n/jquery.ui.datepicker-$::myconfig{countrycode}"); @@ -1074,7 +1075,7 @@ sub parse_template { close OUT if $self->{OUT}; - my $copy_to_webdav = $::instance_conf->get_webdav && $::instance_conf->get_webdav_documents && !$self->{preview}; + my $copy_to_webdav = $::instance_conf->get_webdav && $::instance_conf->get_webdav_documents && !$self->{preview} && $self->{tmpdir} && $self->{tmpfile} && $self->{type}; if ($self->{media} eq 'file') { copy(join('/', $self->{cwd}, $userspath, $self->{tmpfile}), $out =~ m|^/| ? $out : join('/', $self->{cwd}, $out)) if $template->uses_temp_file; @@ -1155,16 +1156,22 @@ sub parse_template { seek IN, 0, 0; } else { - $self->{attachment_filename} = ($self->{attachment_filename}) - ? $self->{attachment_filename} - : $self->generate_attachment_filename(); - - # launch application - print qq|Content-Type: | . $template->get_mime_type() . qq| -Content-Disposition: attachment; filename="$self->{attachment_filename}" -Content-Length: $numbytes + my %headers = ('-type' => $template->get_mime_type, + '-connection' => 'close', + '-charset' => 'UTF-8'); + + $self->{attachment_filename} ||= $self->generate_attachment_filename; + + if ($self->{attachment_filename}) { + %headers = ( + %headers, + '-attachment' => $self->{attachment_filename}, + '-content-length' => $numbytes, + '-charset' => '', + ); + } -|; + print $::request->cgi->header(%headers); $::locale->with_raw_io(\*STDOUT, sub { print while }); } @@ -1415,7 +1422,7 @@ sub date_closed { $main::lxdebug->enter_sub(); my ($self, $date, $myconfig) = @_; - my $dbh = $self->dbconnect($myconfig); + my $dbh = $self->get_standard_dbh; my $query = "SELECT 1 FROM defaults WHERE ? < closedto"; my $sth = prepare_execute_query($self, $dbh, $query, conv_date($date)); @@ -1448,7 +1455,7 @@ sub date_max_future { $main::lxdebug->enter_sub(); my ($self, $date, $myconfig) = @_; - my $dbh = $self->dbconnect($myconfig); + my $dbh = $self->get_standard_dbh; my $query = "SELECT 1 FROM defaults WHERE ? - current_date > max_future_booking_interval"; my $sth = prepare_execute_query($self, $dbh, $query, conv_date($date)); @@ -1937,7 +1944,7 @@ sub get_duedate { : $self->{vendor_id} ? SL::DB::Vendor ->new(id => $self->{vendor_id}) ->load->payment : croak("Missing field in \$::form: payment_id, customer_id or vendor_id"); - my $duedate = $terms->calc_date(reference_date => $reference_date)->to_kivitendo; + my $duedate = $terms ? $terms->calc_date(reference_date => $reference_date)->to_kivitendo : undef; $main::lxdebug->leave_sub();