From d53cd96129bd8a2ac1f5bb5a34f88e87d723d751 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Jan=20B=C3=BCren?= Date: Wed, 16 Mar 2022 09:27:06 +0100 Subject: [PATCH] =?utf8?q?Mit=20Bankimport=20abgeglichen=20Dialog-Buchunge?= =?utf8?q?n=20schreibsch=C3=BCtzen?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- bin/mozilla/gl.pl | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/bin/mozilla/gl.pl b/bin/mozilla/gl.pl index f74d28d7b..faca8ce0d 100644 --- a/bin/mozilla/gl.pl +++ b/bin/mozilla/gl.pl @@ -40,6 +40,7 @@ use List::Util qw(first sum); use SL::DB::ApGl; use SL::DB::RecordTemplate; +use SL::DB::ReconciliationLink; use SL::DB::BankTransactionAccTrans; use SL::DB::Tax; use SL::FU; @@ -974,7 +975,7 @@ sub setup_gl_action_bar { my $form = $::form; my $change_never = $::instance_conf->get_gl_changeable == 0; my $change_on_same_day_only = $::instance_conf->get_gl_changeable == 2 && ($form->current_date(\%::myconfig) ne $form->{gldate}); - my ($is_linked_bank_transaction, $is_linked_ap_transaction); + my ($is_linked_bank_transaction, $is_linked_ap_transaction, $is_reconciled_bank_transaction); if ($form->{id} && SL::DB::Manager::BankTransactionAccTrans->find_by(gl_id => $form->{id})) { $is_linked_bank_transaction = 1; @@ -982,8 +983,13 @@ sub setup_gl_action_bar { if ($form->{id} && SL::DB::Manager::ApGl->find_by(gl_id => $form->{id})) { $is_linked_ap_transaction = 1; } - - + # dont edit reconcilated bookings! + if ($form->{id}) { + my @acc_trans = map { $_->acc_trans_id } @{ SL::DB::Manager::AccTransaction->get_all( where => [ trans_id => $form->{id} ] ) }; + if (scalar @acc_trans && scalar @{ SL::DB::Manager::ReconciliationLink->get_all(where => [ acc_trans_id => [ @acc_trans ] ]) }) { + $is_reconciled_bank_transaction = 1; + } + } my $create_post_action = sub { # $_[0]: description # $_[1]: after_action @@ -996,6 +1002,7 @@ sub setup_gl_action_bar { : ($form->{id} && $change_on_same_day_only) ? t8('General ledger transactions can only be changed on the day they are posted.') : $is_linked_bank_transaction ? t8('This transaction is linked with a bank transaction. Please undo and redo the bank transaction booking if needed.') : $is_linked_ap_transaction ? t8('This transaction is linked with a AP transaction. Please undo and redo the AP transaction booking if needed.') + : $is_reconciled_bank_transaction ? t8('This transaction is reconciled with a bank transaction. Please undo the reconciliation if needed.') : undef, ], }; @@ -1028,6 +1035,7 @@ sub setup_gl_action_bar { : $form->{storno} ? t8('A canceled general ledger transaction cannot be canceled again.') : $is_linked_bank_transaction ? t8('This transaction is linked with a bank transaction. Please undo and redo the bank transaction booking if needed.') : $is_linked_ap_transaction ? t8('This transaction is linked with a AP transaction. Please undo and redo the AP transaction booking if needed.') + : $is_reconciled_bank_transaction ? t8('This transaction is reconciled with a bank transaction. Please undo the reconciliation if needed.') : undef, ], action => [ t8('Delete'), @@ -1039,6 +1047,7 @@ sub setup_gl_action_bar { : $change_on_same_day_only ? t8('Invoices can only be changed on the day they are posted.') : $is_linked_bank_transaction ? t8('This transaction is linked with a bank transaction. Please undo and redo the bank transaction booking if needed.') : $is_linked_ap_transaction ? t8('This transaction is linked with a AP transaction. Please undo and redo the AP transaction booking if needed.') + : $is_reconciled_bank_transaction ? t8('This transaction is reconciled with a bank transaction. Please undo the reconciliation if needed.') : $form->{storno} ? t8('A canceled general ledger transaction cannot be deleted.') : undef, ], -- 2.20.1