Beim Wechsel des Lieferanten das Konto und den Steuerschlüssel richtig vorbelegen.
[kivitendo-erp.git] / bin / mozilla / ap.pl
index f44805e..75631fa 100644 (file)
@@ -800,7 +800,6 @@ $follow_ups_block
                 <input class=submit type=submit name=action value="| . $locale->text('Delete') . qq|">
 |;
     }
-    print(STDERR "TOTALPAID $total_paid\n");
     # ToDO: - insert a global check for stornos, so that a storno is only possible a limited time after saving it
     print qq| <input class=submit type=submit name=action value="| . $locale->text('Storno') . qq|"> |
       if ($form->{id} && !IS->has_storno(\%myconfig, $form, 'ap') && !IS->is_storno(\%myconfig, $form, 'ap', $form->{id}) && (($total_paid == 0) || ($total_paid eq "")));
@@ -856,7 +855,7 @@ sub update {
   map { $form->{$_} = $form->parse_amount(\%myconfig, $form->{$_}) }
     qw(exchangerate creditlimit creditremaining);
 
-  @flds  = qw(amount AP_amount projectnumber oldprojectnumber project_id);
+  @flds  = qw(amount AP_amount projectnumber oldprojectnumber project_id taxchart);
   $count = 0;
   for $i (1 .. $form->{rowcount}) {
     $form->{"amount_$i"} =
@@ -890,9 +889,16 @@ sub update {
   $form->{exchangerate} = $form->{forex} if $form->{forex};
 
   $form->{invdate} = $form->{transdate};
-  $save_AP = $form->{AP};
+  my %saved_variables = map +( $_ => $form->{$_} ), qw(AP AP_amount_1 taxchart_1);
+
   &check_name("vendor");
-  $form->{AP} = $save_AP;
+
+  $form->{AP} = $saved_variables{AP};
+  if ($saved_variables{AP_amount_1} =~ m/.--./) {
+    map { $form->{$_} = $saved_variables{$_} } qw(AP_amount_1 taxchart_1);
+  } else {
+    delete $form->{taxchart_1};
+  }
 
   $form->{rowcount} = $count + 1;