Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision c9b4e6bc

Von Martin Helmling martin.helmling@octosoft.eu vor etwa 7 Jahren hinzugefügt

  • ID c9b4e6bc629fb185b380cda69bca5d3460bc58e0
  • Vorgänger 5334e94b
  • Nachfolger cff4d333

Filemanagement: Zentralisierte Prüfung ob bei Drucken im DMS gespeichert wird

Prüfung aller Mandanteneinstellung vor Speicherung im DMS,

fixt #286

Unterschiede anzeigen:

SL/Form.pm
1067 1067
  # therefore copy to webdav, even if we do not have the webdav feature enabled (just archive)
1068 1068
  my $copy_to_webdav =  $::instance_conf->get_webdav_documents && !$self->{preview} && $self->{tmpdir} && $self->{tmpfile} && $self->{type};
1069 1069

  
1070
  if ( $ext_for_format eq 'pdf' && $::instance_conf->get_doc_storage ) {
1070
  if ( $ext_for_format eq 'pdf' && $self->doc_storage_enabled ) {
1071 1071
    $self->append_general_pdf_attachments(filepath =>  $self->{tmpdir}."/".$self->{tmpfile},
1072 1072
                                          type     =>  $self->{type});
1073 1073
  }
1074 1074
  if ($self->{media} eq 'file') {
1075 1075
    copy(join('/', $self->{cwd}, $userspath, $self->{tmpfile}), $out =~ m|^/| ? $out : join('/', $self->{cwd}, $out)) if $template->uses_temp_file;
1076 1076
    Common::copy_file_to_webdav_folder($self)                                                                         if $copy_to_webdav;
1077
    if (!$self->{preview} && $::instance_conf->get_doc_storage)
1077
    if (!$self->{preview} && $self->doc_storage_enabled)
1078 1078
    {
1079 1079
      $self->{attachment_filename} ||= $self->generate_attachment_filename;
1080 1080
      $self->store_pdf($self);
......
1089 1089

  
1090 1090
  Common::copy_file_to_webdav_folder($self) if $copy_to_webdav;
1091 1091

  
1092
  if ( !$self->{preview} && $ext_for_format eq 'pdf' && $::instance_conf->get_doc_storage) {
1092
  if ( !$self->{preview} && $ext_for_format eq 'pdf' && $self->doc_storage_enabled) {
1093 1093
    $self->{attachment_filename} ||= $self->generate_attachment_filename;
1094 1094
    my $file_obj = $self->store_pdf($self);
1095 1095
    $self->{print_file_id} = $file_obj->id if $file_obj;
SL/Helper/File.pm
3 3
use strict;
4 4

  
5 5
use Exporter 'import';
6
our @EXPORT_OK = qw(store_pdf append_general_pdf_attachments);
6
our @EXPORT_OK = qw(store_pdf append_general_pdf_attachments doc_storage_enabled);
7 7
our %EXPORT_TAGS = (all => \@EXPORT_OK,);
8 8
use SL::File;
9 9

  
10
sub doc_storage_enabled {
11
  return 0 unless $::instance_conf->get_doc_storage;
12
  return 1 if     $::instance_conf->get_doc_storage_for_documents eq 'Filesystem' && $::instance_conf->get_doc_files;
13
  return 1 if     $::instance_conf->get_doc_storage_for_documents eq 'Webdav'     && $::instance_conf->get_doc_webdav;
14
  return 0;
15
}
16

  
10 17
sub store_pdf {
11 18
  my ($self, $form) = @_;
12
  return unless $::instance_conf->get_doc_storage;
19
  return unless $self->doc_storage_enabled;
13 20
  my $type = $form->{type};
14 21
  $type = $form->{formname}        if $form->{formname} && !$form->{type};
15 22
  $type = $form->{attachment_type} if $form->{attachment_type};
......
72 79

  
73 80
SL::Helper::File - Helper for $::Form to store generated PDF-Documents
74 81

  
75

  
76 82
=head1 SYNOPSIS
77 83

  
78 84
# This Helper is used by SL::Form to store new generated PDF-Files and append general attachments to this documents.

Auch abrufbar als: Unified diff