]> wagnertech.de Git - mfinanz.git/blobdiff - SL/IR.pm
Bugfixes und Code-Reorganisierung beim "Webdav"-Feature. Beim Anlegen von Verzeichnis...
[mfinanz.git] / SL / IR.pm
index ae3a3d4e1ea02c00d6a60a97b1af0ce827c4153c..af80fce2c5d743ee34a93e3a80e05afb4e932658 100644 (file)
--- a/SL/IR.pm
+++ b/SL/IR.pm
@@ -35,6 +35,7 @@
 package IR;
 
 use SL::AM;
+use SL::Common;
 use SL::DBUtils;
 
 sub post_invoice {
@@ -665,9 +666,7 @@ sub post_invoice {
               WHERE amount = 0|;
   $dbh->do($query) || $form->dberror($query);
 
-  if ($form->{webdav}) {
-    &webdav_folder($myconfig, $form);
-  }
+  Common::webdav_folder($form) if ($main::webdav);
 
   my $rc = $dbh->commit;
   $dbh->disconnect;
@@ -963,10 +962,7 @@ sub retrieve_invoice {
     }
     $sth->finish;
 
-    if ($form->{webdav}) {
-      &webdav_folder($myconfig, $form);
-    }
-
+    Common::webdav_folder($form) if ($main::webdav);
   }
 
   my $rc = $dbh->commit;
@@ -1288,38 +1284,6 @@ sub item_links {
   $main::lxdebug->leave_sub();
 }
 
-sub webdav_folder {
-  $main::lxdebug->enter_sub();
-
-  my ($myconfig, $form) = @_;
-
-SWITCH: {
-    $path = "webdav/rechnungen/" . $form->{invnumber}, last SWITCH
-      if ($form->{vc} eq "customer");
-    $path = "webdav/einkaufsrechnungen/" . $form->{invnumber}, last SWITCH
-      if ($form->{vc} eq "vendor");
-  }
-
-  if (!-d $path) {
-    mkdir($path, 0770) or die "can't make directory $!\n";
-  } else {
-    if ($form->{id}) {
-      @files = <$path/*>;
-      foreach $file (@files) {
-
-        $file =~ /\/([^\/]*)$/;
-        $fname = $1;
-        $ENV{'SCRIPT_NAME'} =~ /\/([^\/]*)\//;
-        $lxerp = $1;
-        $link  = "http://" . $ENV{'SERVER_NAME'} . "/" . $lxerp . "/" . $file;
-        $form->{WEBDAV}{$fname} = $link;
-      }
-    }
-  }
-
-  $main::lxdebug->leave_sub();
-}
-
 sub post_payment {
   $main::lxdebug->enter_sub();