]> wagnertech.de Git - mfinanz.git/blobdiff - SL/Form.pm
Individuelle Lieferadresse hinzufügen: cp_gender nicht vergessen
[mfinanz.git] / SL / Form.pm
index f162f20955dd94a846d9e52ae3973e78c16c46cc..bf126cb55bd9c0f6ca5359a0232e1b83cc38c073 100644 (file)
@@ -115,11 +115,6 @@ sub new {
   return $self;
 }
 
-sub read_cgi_input {
-  my ($self) = @_;
-  SL::Request::read_cgi_input($self);
-}
-
 sub _flatten_variables_rec {
   $main::lxdebug->enter_sub(2);
 
@@ -1037,9 +1032,10 @@ sub parse_template {
     copy(join('/', $self->{cwd}, $userspath, $self->{tmpfile}), $out =~ m|^/| ? $out : join('/', $self->{cwd}, $out)) if $template->uses_temp_file;
 
     if ($copy_to_webdav) {
-      my $error = Common::copy_file_to_webdav_folder($self);
-      chdir("$self->{cwd}");
-      $self->error($error) if $error;
+      if (my $error = Common::copy_file_to_webdav_folder($self)) {
+        chdir("$self->{cwd}");
+        $self->error($error);
+      }
     }
 
     if (!$self->{preview} && $self->doc_storage_enabled)
@@ -1056,9 +1052,10 @@ sub parse_template {
   }
 
   if ($copy_to_webdav) {
-    my $error = Common::copy_file_to_webdav_folder($self);
-    chdir("$self->{cwd}");
-    $self->error($error) if $error;
+    if (my $error = Common::copy_file_to_webdav_folder($self)) {
+      chdir("$self->{cwd}");
+      $self->error($error);
+    }
   }
 
   if ( !$self->{preview} && $ext_for_format eq 'pdf' && $self->doc_storage_enabled) {
@@ -1870,7 +1867,7 @@ sub add_shipto {
   my @values;
 
   foreach my $item (qw(name department_1 department_2 street zipcode city country gln
-                       contact cp_gender phone fax email)) {
+                       contact phone fax email)) {
     if ($self->{"shipto$item"}) {
       $shipto = 1 if ($self->{$item} ne $self->{"shipto$item"});
     }
@@ -1879,6 +1876,12 @@ sub add_shipto {
 
   return if !$shipto;
 
+  # shiptocp_gender only makes sense, if any other shipto attribute is set.
+  # Because shiptocp_gender is set to 'm' by default in forms
+  # it must not be considered above to decide if shiptos has to be added or
+  # updated, but must be inserted or updated as well in case.
+  push(@values, $self->{shiptocp_gender});
+
   my $shipto_id = $self->{shipto_id};
 
   if ($self->{shipto_id}) {