Das Feld Einlagern unter Erzeugnis erfassen hat derzeit keine Funktion - Laut Holger...
[kivitendo-erp.git] / SL / AP.pm
index 1b7c1d8..e2709f7 100644 (file)
--- a/SL/AP.pm
+++ b/SL/AP.pm
@@ -96,10 +96,7 @@ sub post_transaction {
       qq|ORDER BY c.accno|;
     $sth = $dbh->prepare($query);
     $sth->execute($form->{"tax_id_$i"}) || $form->dberror($query . " (" . $form->{"tax_id_$i"} . ")");
-    ($form->{AP_amounts}{"tax_$i"}, $form->{"taxkey_$i"}, $form->{"taxrate_$i"}) =
-      $sth->fetchrow_array;
-    $form->{AP_amounts}{"tax_$i"}{taxkey}    = $form->{"taxkey_$i"};
-    $form->{AP_amounts}{"amount_$i"}{taxkey} = $form->{"taxkey_$i"};
+    ($form->{AP_amounts}{"tax_$i"}, $form->{"taxkey_$i"}, $form->{"taxrate_$i"}) = $sth->fetchrow_array();
 
     $sth->finish;
     if ($form->{taxincluded} *= 1) {
@@ -212,7 +209,6 @@ sub post_transaction {
       if ($form->{"amount_$i"} != 0) {
         my $project_id;
         $project_id = conv_i($form->{"project_id_$i"});
-        $taxkey = $form->{AP_amounts}{"amount_$i"}{taxkey};
 
         # insert detail records in acc_trans
         $query =
@@ -222,7 +218,7 @@ sub post_transaction {
           qq|  ?, ?, ?, ?)|;
         @values = ($form->{id}, $form->{AP_amounts}{"amount_$i"},
                    $form->{"amount_$i"}, conv_date($form->{transdate}),
-                   $project_id, $taxkey);
+                   $project_id, $form->{"taxkey_$i"});
         do_query($form, $dbh, $query, @values);
 
         if ($form->{"tax_$i"} != 0) {
@@ -234,7 +230,7 @@ sub post_transaction {
             qq|  ?, ?, ?, ?)|;
           @values = ($form->{id}, $form->{AP_amounts}{"tax_$i"},
                      $form->{"tax_$i"}, conv_date($form->{transdate}),
-                     $project_id, $taxkey);
+                     $project_id, $form->{"taxkey_$i"});
           do_query($form, $dbh, $query, @values);
         }
 
@@ -582,6 +578,7 @@ sub post_payment {
 
   ($form->{defaultcurrency}) = selectrow_query($form, $dbh, qq|SELECT curr FROM defaults|);
   $form->{defaultcurrency}   = (split m/:/, $form->{defaultcurrency})[0];
+  $form->{currency}          = $form->{defaultcurrency} if ($form->{defaultcurrency} && ($form->{currency} =~ m/^\s*$/));
 
   $form->{exchangerate}      = $form->format_amount($myconfig, $form->{exchangerate});