Kreditoren/Debitoren-Buchung zuletzt bebuchtes Konto laden
authorJan Büren <jan@kivitendo-premium.de>
Fri, 24 Mar 2017 14:20:30 +0000 (15:20 +0100)
committerJan Büren <jan@kivitendo-premium.de>
Fri, 24 Mar 2017 14:20:30 +0000 (15:20 +0100)
Wenn nur ein Konto ohne Wert vorhanden ist, gehen wir davon aus,
dass der Anwender einen anderen Kunden/Lieferanten buchen möchten und
hier das zuletzt bebuchte Konto als Default möchte

bin/mozilla/ap.pl
bin/mozilla/ar.pl

index aad1fca..802e52a 100644 (file)
@@ -634,6 +634,10 @@ sub update {
 
   if (($form->{previous_vendor_id} || $form->{vendor_id}) != $form->{vendor_id}) {
     IR->get_vendor(\%::myconfig, $form);
+    if (($form->{rowcount} == 1) && ($form->{amount_1} == 0)) {
+      my $last_used_ap_chart = SL::DB::Vendor->load_cached($form->{vendor_id})->last_used_ap_chart;
+      $form->{"AP_amount_chart_id_1"} = $last_used_ap_chart->id if $last_used_ap_chart;
+    }
   }
 
   $form->{rowcount} = $count + ($params{dont_add_new_row} ? 0 : 1);
index ec9ea95..0f020a3 100644 (file)
@@ -611,6 +611,10 @@ sub update {
 
   if (($form->{previous_customer_id} || $form->{customer_id}) != $form->{customer_id}) {
     IS->get_customer(\%myconfig, $form);
+    if (($form->{rowcount} == 1) && ($form->{amount_1} == 0)) {
+      my $last_used_ar_chart = SL::DB::Customer->load_cached($form->{customer_id})->last_used_ar_chart;
+      $form->{"AR_amount_chart_id_1"} = $last_used_ar_chart->id if $last_used_ar_chart;
+    }
   }
 
   $form->{invtotal} =