]> wagnertech.de Git - mfinanz.git/blobdiff - SL/Controller/BankTransaction.pm
ClientJS: Ziel-Argument bestimmter Funktionen vorne trimmen
[mfinanz.git] / SL / Controller / BankTransaction.pm
index 918d6aac1f98b77378e7dd50dcd2df326f9355de..a41957d243e65d41fc3d90bfcc46d1edcfe34ee9 100644 (file)
@@ -24,6 +24,7 @@ use SL::DB::Tax;
 use SL::DB::Draft;
 use SL::DB::BankAccount;
 use SL::Presenter;
+use SL::DB::Helper::Payment qw(validate_payment_type);
 use List::Util qw(max);
 
 use Rose::Object::MakeMethods::Generic
@@ -216,7 +217,7 @@ sub action_ajax_payment_suggestion {
 
   my $bt = SL::DB::Manager::BankTransaction->find_by( id => $::form->{bt_id} );
   my $invoice = SL::DB::Manager::Invoice->find_by( id => $::form->{prop_id} );
-  $invoice = SL::DB::Manager::PurchaseInvoice->find_By( id => $::form->{prop_id} ) unless $invoice;
+  $invoice = SL::DB::Manager::PurchaseInvoice->find_by( id => $::form->{prop_id} ) unless $invoice;
 
   die unless $bt and $invoice;
 
@@ -373,8 +374,9 @@ sub action_save_invoices {
 
     foreach my $invoice (@invoices) {
       my $payment_type;
-      if ( @$skonto_hash{"$bt_id"} ) {
-        $payment_type = shift( @$skonto_hash{"$bt_id"} );
+      if ( defined $skonto_hash->{"$bt_id"} ) {
+        $payment_type = shift(@{ $skonto_hash->{"$bt_id"} });
+        SL::DB::Helper::Payment->validate_payment_type($payment_type);
       } else {
         $payment_type = 'without_skonto';
       };