Merge branch 'erzeugnisnummern'
[kivitendo-erp.git] / SL / Common.pm
index 09f9468..159609d 100644 (file)
@@ -43,7 +43,7 @@ sub unique_id {
 }
 
 sub tmpname {
-  return "/tmp/lx-office-tmp-" . unique_id();
+  return "/tmp/kivitendo-tmp-" . unique_id();
 }
 
 sub retrieve_parts {
@@ -336,7 +336,7 @@ sub webdav_folder {
   my ($form) = @_;
 
   return $main::lxdebug->leave_sub()
-    unless ($::lx_office_conf{system}->{webdav} && $form->{id});
+    unless ($::lx_office_conf{features}->{webdav} && $form->{id});
 
   my ($path, $number);
 
@@ -372,9 +372,8 @@ sub webdav_folder {
     mkdir_with_parents($path);
 
   } else {
-    my $base_path = substr($ENV{'SCRIPT_NAME'}, 1);
+    my $base_path = $ENV{'SCRIPT_NAME'};
     $base_path =~ s|[^/]+$||;
-    $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) {
@@ -390,7 +389,7 @@ sub webdav_folder {
 
         push @{ $form->{WEBDAV} }, {
           'name' => $fname,
-          'link' => "$base_path/$file",
+          'link' => $base_path . $file,
           'type' => $is_directory ? $main::locale->text('Directory') : $main::locale->text('File'),
         };
       }
@@ -442,6 +441,9 @@ sub get_vc_details {
   $query = qq|SELECT * FROM contacts WHERE (cp_cv_id = ?)|;
   $form->{CONTACTS} = selectall_hashref_query($form, $dbh, $query, $vc_id);
 
+  # Only show default pricegroup for customer, not vendor, which is why this is outside the main query
+  ($form->{pricegroup}) = selectrow_query($form, $dbh, qq|SELECT pricegroup FROM pricegroup WHERE id = ?|, $form->{klass});
+
   $dbh->disconnect();
 
   $main::lxdebug->leave_sub();
@@ -497,8 +499,8 @@ sub save_email_status {
 
   $intnotes .= "\n\n" if ($intnotes);
 
-  my $cc  = $main::locale->text('Cc') . ": $form->{cc}\n"   if $form->{cc};
-  my $bcc = $main::locale->text('Bcc') . ": $form->{bcc}\n" if $form->{bcc};
+  my $cc  = $form->{cc}  ? $main::locale->text('Cc') . ": $form->{cc}\n"   : '';
+  my $bcc = $form->{bcc} ? $main::locale->text('Bcc') . ": $form->{bcc}\n" : '';
   my $now = scalar localtime;
 
   $intnotes .= $main::locale->text('[email]') . "\n"