]> wagnertech.de Git - mfinanz.git/blobdiff - SL/Common.pm
WebDAV-Pfad für Mandaten gefixt
[mfinanz.git] / SL / Common.pm
index ff6c7218abb0f302d845093d41a5913674e69758..b58d877c65eb4dbeaa691ea57bcc4ba0f5325890 100644 (file)
@@ -11,6 +11,7 @@ package Common;
 use utf8;
 use strict;
 
+use Carp;
 use Time::HiRes qw(gettimeofday);
 use Data::Dumper;
 
@@ -85,7 +86,7 @@ sub retrieve_parts {
   }
 
   if ($form->{no_services}) {
-    $filter .= qq| AND (inventory_accno_id is not NULL or assembly=TRUE)|; # @mb hier nochmal optimieren ... nach kurzer ruecksprache alles i.o.
+    $filter .= qq| AND (inventory_accno_id is not NULL or assembly=TRUE)|;
   }
 
   substr($filter, 1, 3) = "WHERE" if ($filter);
@@ -94,7 +95,8 @@ sub retrieve_parts {
   $order_dir = $order_dir ? "ASC" : "DESC";
 
   my $query =
-    qq|SELECT id, partnumber, description, ean | .
+    qq|SELECT id, partnumber, description, ean, | .
+    qq|       warehouse_id, bin_id | .
     qq|FROM parts $filter | .
     qq|ORDER BY $order_by $order_dir|;
   my $sth = $dbh->prepare($query);
@@ -353,6 +355,8 @@ sub webdav_folder {
   return $main::lxdebug->leave_sub()
     unless ($::lx_office_conf{features}->{webdav} && $form->{id});
 
+  croak "No client set in \$::auth" unless $::auth->client;
+
   my ($path, $number);
 
   $form->{WEBDAV} = [];
@@ -381,7 +385,7 @@ sub webdav_folder {
 
   $number =~ s|[/\\]|_|g;
 
-  $path = "webdav/${path}/${number}";
+  $path = "webdav/" . $::auth->client->{id} . "/${path}/${number}";
 
   if (!-d $path) {
     mkdir_with_parents($path);
@@ -389,7 +393,6 @@ sub webdav_folder {
   } else {
     my $base_path = $ENV{'SCRIPT_NAME'};
     $base_path =~ s|[^/]+$||;
-    # wo kommt der wert für dir her? es wird doch gar nichts übergeben? fix für strict my $dir jb 21.2.
     if (opendir my $dir, $path) {
       foreach my $file (sort { lc $a cmp lc $b } readdir $dir) {
         next if (($file eq '.') || ($file eq '..'));
@@ -501,6 +504,8 @@ sub save_email_status {
   } elsif ($form->{script} eq 'ir.pl') {
     $table = 'ap';
 
+  } elsif ($form->{script} eq 'do.pl') {
+    $table = 'delivery_orders';
   }
 
   return $main::lxdebug->leave_sub() if (!$form->{id} || !$table || !$form->{formname});