DMS: Webdav-Backend: unbenutztes Modul SL::Webdav nicht einbinden.
[kivitendo-erp.git] / SL / File / Backend / Webdav.pm
index 1a2209f..f0abfd4 100644 (file)
@@ -5,7 +5,7 @@ use strict;
 use parent qw(SL::File::Backend);
 use SL::DB::File;
 
-#use SL::Webdav;
+use SL::System::Process;
 use File::Copy;
 use File::Slurp;
 use File::Basename;
@@ -73,7 +73,7 @@ sub get_mtime {
   die "no dbfile" unless $params{dbfile};
   $main::lxdebug->message(LXDebug->DEBUG2(), "version=" .$params{version});
   my ($path, undef, undef) = $self->webdav_path($params{dbfile});
-  die "no file found in backend" if !-f $path;
+  die "No file found in Backend: " . $path unless -f $path;
   my @st = stat($path);
   my $dt = DateTime->from_epoch(epoch => $st[9])->clone();
   $main::lxdebug->message(LXDebug->DEBUG2(), "dt=" .$dt);
@@ -84,7 +84,7 @@ sub get_filepath {
   my ($self, %params) = @_;
   die "no dbfile" unless $params{dbfile};
   my ($path, undef, undef) = $self->webdav_path($params{dbfile});
-  die "no file" if !-f $path;
+  die "No file found in Backend: " . $path unless -f $path;
   return $path;
 }
 
@@ -105,8 +105,7 @@ sub sync_from_backend {
 }
 
 sub enabled {
-  return 0 unless $::instance_conf->get_doc_webdav;
-  return 1;
+  return $::instance_conf->get_doc_webdav;
 }
 
 #
@@ -128,7 +127,11 @@ my %type_to_path = (
   assembly                => 'erzeugnisse',
   letter                  => 'briefe',
   general_ledger          => 'dialogbuchungen',
+  gl_transaction          => 'dialogbuchungen',
   accounts_payable        => 'kreditorenbuchungen',
+  shop_image              => 'shopbilder',
+  customer                => 'kunden',
+  vendor                  => 'lieferanten',
 );
 
 my %type_to_model = (
@@ -146,7 +149,11 @@ my %type_to_model = (
   assembly                => 'Part',
   letter                  => 'Letter',
   general_ledger          => 'GLTransaction',
+  gl_transaction          => 'GLTransaction',
   accounts_payable        => 'GLTransaction',
+  shop_image              => 'Part',
+  customer                => 'Customer',
+  vendor                  => 'Vendor',
 );
 
 my %model_to_number = (
@@ -156,7 +163,10 @@ my %model_to_number = (
   PurchaseInvoice => 'invnumber',
   Part            => 'partnumber',
   Letter          => 'letternumber',
-  GLTransaction   => 'reference'
+  GLTransaction   => 'reference',
+  ShopImage       => 'partnumber',
+  Customer        => 'customernumber',
+  Vendor          => 'vendornumber',
 );
 
 sub webdav_path {
@@ -195,17 +205,7 @@ sub webdav_path {
   return (File::Spec->catfile($path, $fname), $path, $fname);
 }
 
-sub get_rootdir {
-  my ($self) = @_;
-
-  #TODO immer noch das alte Problem:
-  #je nachdem von woher der Aufruf kommt ist man in ./users oder .
-  my $rootdir  = POSIX::getcwd();
-  my $basename = basename($rootdir);
-  my $dirname  = dirname($rootdir);
-  $rootdir = $dirname if $basename eq 'users';
-  return $rootdir;
-}
+sub get_rootdir { SL::System::Process::exe_dir() }
 
 sub _get_number_from_model {
   my ($self, $dbfile) = @_;
@@ -335,5 +335,3 @@ The synchronization must be tested and a periodical task is needed to synchroniz
 Martin Helmling E<lt>martin.helmling@opendynamic.deE<gt>
 
 =cut
-
-