Revision bf980f4c
Von Martin Helmling martin.helmling@octosoft.eu vor mehr als 7 Jahren hinzugefügt
SL/File/Backend/Filesystem.pm | ||
---|---|---|
85 | 85 |
die "unknown version" if $params{version} && |
86 | 86 |
($params{version} < 0 || $params{version} > $params{dbfile}->backend_data) ; |
87 | 87 |
my $path = $self->_filesystem_path($params{dbfile},$params{version}); |
88 |
die "no file found in backend" if !-f $path; |
|
88 |
die "no file found in backend or configuration to filesystem is wrong" if !-f $path;
|
|
89 | 89 |
my @st = stat($path); |
90 | 90 |
my $dt = DateTime->from_epoch(epoch => $st[9])->clone(); |
91 | 91 |
$main::lxdebug->message(LXDebug->DEBUG2(), "dt=" .$dt); |
... | ... | |
109 | 109 |
} |
110 | 110 |
|
111 | 111 |
sub enabled { |
112 |
return 0 unless $::instance_conf->get_doc_files || $::instance_conf->get_doc_files_rootpath;
|
|
113 |
$main::lxdebug->message(LXDebug->DEBUG2(), "root path=" . $::instance_conf->get_doc_files_rootpath . " isdir=" .( -d $::instance_conf->get_doc_files_rootpath?"YES":"NO"));
|
|
114 |
return 0 unless -d $::instance_conf->get_doc_files_rootpath;
|
|
112 |
return 0 unless $::instance_conf->get_doc_files; |
|
113 |
return 0 unless $::lx_office_conf{paths}->{document_path};
|
|
114 |
return 0 unless -d $::lx_office_conf{paths}->{document_path};
|
|
115 | 115 |
return 1; |
116 | 116 |
} |
117 | 117 |
|
... | ... | |
123 | 123 |
sub _filesystem_path { |
124 | 124 |
my ($self, $dbfile, $version) = @_; |
125 | 125 |
|
126 |
die "No files backend enabled" unless $::instance_conf->get_doc_files || $::instance_conf->get_doc_files_rootpath;
|
|
126 |
die "No files backend enabled" unless $::instance_conf->get_doc_files || $::lx_office_conf{paths}->{document_path};
|
|
127 | 127 |
|
128 | 128 |
# use filesystem with depth 3 |
129 | 129 |
$version = $dbfile->backend_data if !$version || $version < 1 || $version > $dbfile->backend_data; |
130 | 130 |
my $iddir = sprintf("%04d", $dbfile->id % 1000); |
131 |
my $path = File::Spec->catdir($::instance_conf->get_doc_files_rootpath, $iddir, $dbfile->id);
|
|
131 |
my $path = File::Spec->catdir($::lx_office_conf{paths}->{document_path}, $::auth->client->{id}, $iddir, $dbfile->id);
|
|
132 | 132 |
$main::lxdebug->message(LXDebug->DEBUG2(), "file path=" .$path." id=" .$dbfile->id." version=".$version." basename=".$dbfile->id . '_' . $version); |
133 | 133 |
if (!-d $path) { |
134 | 134 |
File::Path::make_path($path, { chmod => 0770 }); |
config/kivitendo.conf.default | ||
---|---|---|
102 | 102 |
# if set the export to geierlein is enabled |
103 | 103 |
# geierlein_path = geierlein |
104 | 104 |
|
105 |
# |
|
106 |
# document path for FileSystem FileManagement: |
|
107 |
# (must be reachable read/write but not executable from webserver) |
|
108 |
# document_path = /var/local/kivi_documents |
|
109 |
# |
|
110 |
|
|
105 | 111 |
[mail_delivery] |
106 | 112 |
# Delivery method can be 'sendmail' or 'smtp'. For 'method = sendmail' the |
107 | 113 |
# parameter 'mail_delivery.sendmail' is used as the executable to call. If |
doc/dokumentation.xml | ||
---|---|---|
6530 | 6530 |
</mediaobject> |
6531 | 6531 |
</screenshot> |
6532 | 6532 |
<para>Die einzelnen Backends sind einzeln einschaltbar. Spezifische Backend-Konfigurierungen sind hier |
6533 |
noch ergänzbar. Für das Backend Dateisystem ist das Wurzelverzeichnis für den Mandanten einzugeben.</para>
|
|
6533 |
noch ergänzbar.</para> |
|
6534 | 6534 |
</sect4> |
6535 | 6535 |
<sect4> |
6536 | 6536 |
<title>Reiter "Allgemeine Dokumentenanhänge"</title> |
... | ... | |
6569 | 6569 |
<para>Es ist daran gedacht, statt dem default Eintrag später für bestimmte Benutzer ('login') bestimmte Quellen zuzulassen, |
6570 | 6570 |
dies wird nach Bedarf implementiert.</para> |
6571 | 6571 |
</sect3> |
6572 |
</sect2> |
|
6572 |
<sect3 id="file_management.kiviconfig" xreflabel="kivitendo-Konfigurationsdatei"> |
|
6573 |
<title>kivitendo-Konfigurationsdatei</title> |
|
6574 |
<para>Dort ist im Abschnitt [paths] der relative oder absolute Pfad zum Dokumentenwurzelverzeichnis einzutragen. |
|
6575 |
Dieser muss für den Webserver schreib- und lesbar sein, jedoch nicht ausführbar.</para> |
|
6576 |
<programlisting> |
|
6577 |
[paths] |
|
6578 |
document_path = /var/local/kivi_documents |
|
6579 |
</programlisting> |
|
6580 |
<para>Unter diesem Wurzelverzeichnis wird pro Mandant automatisch ein Unterverzeichnis mit der ID des Mandanten angelegt</para> |
|
6581 |
</sect3> |
|
6582 |
</sect2> |
|
6573 | 6583 |
</sect1> |
6574 | 6584 |
</chapter> |
6575 | 6585 |
|
sql/Pg-upgrade2/filemanagement_filesystem.pl | ||
---|---|---|
1 |
# @tag: filemanagement_filesystem |
|
2 |
# @description: add directory for filemanagment |
|
3 |
# @depends: filemanagement_feature |
|
4 |
package SL::DBUpgrade2::filemanagement_filesystem; |
|
5 |
|
|
6 |
use strict; |
|
7 |
use utf8; |
|
8 |
use File::Path qw(make_path); |
|
9 |
|
|
10 |
use parent qw(SL::DBUpgrade2::Base); |
|
11 |
|
|
12 |
sub run { |
|
13 |
my ($self) = @_; |
|
14 |
|
|
15 |
my $directory = $::instance_conf->get_doc_files_rootpath; |
|
16 |
|
|
17 |
if ( $directory && !-d $directory ) { |
|
18 |
mkdir $directory; |
|
19 |
if (! -d $directory) { |
|
20 |
return 0; |
|
21 |
} |
|
22 |
} |
|
23 |
return 1; |
|
24 |
} |
|
25 |
|
|
26 |
1; |
templates/webpages/client_config/_features.html | ||
---|---|---|
75 | 75 |
<td>[% L.yes_no_tag('defaults.doc_files', SELF.defaults.doc_files) %]</td> |
76 | 76 |
<td>[% LxERP.t8('Use File Storage backend') %]</td> |
77 | 77 |
</tr> |
78 |
<tr> |
|
79 |
<td align="right">[% LxERP.t8('Root path for file storage') %]</td> |
|
80 |
<td>[% L.input_tag('defaults.doc_files_rootpath',SELF.defaults.doc_files_rootpath, style=style, onchange="verifyRootPath(this);") %]</td> |
|
81 |
<td>[% LxERP.t8('This is the root directory for the File storage backend, must be writable for webserver. If you have more than one client you need another direcctory. All other directories must be created by hand and reachable from the webserver') %]</td> |
|
82 |
</tr> |
|
83 | 78 |
<tr> |
84 | 79 |
<td align="right">[% LxERP.t8('WebDAV') %]</td> |
85 | 80 |
<td>[% L.yes_no_tag('defaults.doc_webdav', SELF.defaults.doc_webdav) %]</td> |
Auch abrufbar als: Unified diff
Filesystem Wurzelverzeichnis nun in kivitendo.conf
Das Rootverzeichnis für die Dokumente ist nun nicht mehr per Mandantenkonfig einstellbar
sondern ist unter [paths] in kivitendo.conf zu setzen.
Siehe auch Doku und kivitendo.conf.default
behebt nochmals #525 (redmine)