From e83fcf3aa3394efdf2293ea60d5510fcfbf41b52 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Jan=20B=C3=BCren?= Date: Fri, 1 Mar 2019 14:55:06 +0100 Subject: [PATCH] Dialogbuchungen aus Bankbewegungen teilweise Verbuchungen erlauben MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Da vorher nur komplette Bankbewegungen verbucht werden konnten, war es nicht sinnvoll Teilbeträge im Dialog zu buchen. Das Verfahren ist jetzt geändert und übergeben wird der aktuelle Rest-Betrag der Bankbewegung --- SL/Controller/BankTransaction.pm | 3 +-- bin/mozilla/gl.pl | 4 +++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/SL/Controller/BankTransaction.pm b/SL/Controller/BankTransaction.pm index 2ec9563c2..2b338318f 100644 --- a/SL/Controller/BankTransaction.pm +++ b/SL/Controller/BankTransaction.pm @@ -569,7 +569,6 @@ sub save_single_bank_transaction { my $payment_received = $bank_transaction->amount > 0; my $payment_sent = $bank_transaction->amount < 0; - croak("No amount left to assign") if ($not_assigned_amount <= 0); foreach my $invoice_id (@{ $params{invoice_ids} }) { my $invoice = SL::DB::Manager::Invoice->find_by(id => $invoice_id) || SL::DB::Manager::PurchaseInvoice->find_by(id => $invoice_id); @@ -860,7 +859,7 @@ sub load_gl_record_template_url { controller => 'gl.pl', action => 'load_record_template', id => $template->id, - 'form_defaults.amount_1' => abs($self->transaction->amount), # always positive + 'form_defaults.amount_1' => abs($self->transaction->not_assigned_amount), # always positive 'form_defaults.transdate' => $self->transaction->transdate_as_date, 'form_defaults.callback' => $self->callback, 'form_defaults.bt_id' => $self->transaction->id, diff --git a/bin/mozilla/gl.pl b/bin/mozilla/gl.pl index c39facd0b..5f65720b9 100644 --- a/bin/mozilla/gl.pl +++ b/bin/mozilla/gl.pl @@ -1365,7 +1365,9 @@ sub post_transaction { die "guru meditation error: Can only assign amount to one bank account booking" if scalar @{ $payment } > 1; # credit/debit * -1 matches the sign for bt.amount and bt.invoice_amount - die "Can only assign the full bank amount to a single general ledger booking" unless $bt->amount == $payment->[0]->amount * -1; + die "Can only assign the full (partial) bank amount to a single general ledger booking" + unless $bt->not_assigned_amount == $payment->[0]->amount * -1; + $bt->update_attributes(invoice_amount => $bt->invoice_amount + ($payment->[0]->amount * -1)); # create record_link -- 2.20.1