From b3259be1755d03539dfa8312f379bd0190526f25 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Jan=20B=C3=BCren?= Date: Sat, 2 Mar 2019 08:40:50 +0100 Subject: [PATCH] =?utf8?q?Manuelle=20Zahlungen=20verbieten,=20falls=20mit?= =?utf8?q?=20Kontoauszug=20verkn=C3=BCpft.?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Falls die Änderbarkeit von Zahlungen nicht auf niemals steht, entsprechend Überbuchen / manuelles Ändern verbieten. Der Fehlertext weißt zusätzlich auf die Funktion im Bankbewegungs-Bericht hin --- bin/mozilla/ap.pl | 35 +++++++++++++++++++++++------------ bin/mozilla/ar.pl | 16 +++++++++++++--- bin/mozilla/ir.pl | 32 +++++++++++++++++++++----------- bin/mozilla/is.pl | 16 +++++++++++++--- 4 files changed, 70 insertions(+), 29 deletions(-) diff --git a/bin/mozilla/ap.pl b/bin/mozilla/ap.pl index 187322afe..039f5a963 100644 --- a/bin/mozilla/ap.pl +++ b/bin/mozilla/ap.pl @@ -43,6 +43,7 @@ use SL::Helper::Flash qw(flash); use SL::IR; use SL::IS; use SL::ReportGenerator; +use SL::DB::BankTransactionAccTrans; use SL::DB::Currency; use SL::DB::Default; use SL::DB::PurchaseInvoice; @@ -1231,12 +1232,19 @@ sub setup_ap_display_form_action_bar { my $may_edit_create = $::auth->assert('vendor_invoice_edit', 1); my $has_sepa_exports; - if ($::form->{id}) { my $invoice = SL::DB::Manager::PurchaseInvoice->find_by(id => $::form->{id}); $has_sepa_exports = 1 if ($invoice->find_sepa_export_items()->[0]); } + my $is_linked_bank_transaction; + if ($::form->{id} + && SL::DB::Default->get->payments_changeable != 0 + && SL::DB::Manager::BankTransactionAccTrans->find_by(ap_id => $::form->{id})) { + + $is_linked_bank_transaction = 1; + } + for my $bar ($::request->layout->get('actionbar')) { $bar->add( action => [ @@ -1258,15 +1266,17 @@ sub setup_ap_display_form_action_bar { : $is_storno ? t8('A canceled invoice cannot be posted.') : ($::form->{id} && $change_never) ? t8('Changing invoices has been disabled in the configuration.') : ($::form->{id} && $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.') : undef, ], action => [ t8('Post Payment'), submit => [ '#form', { action => "post_payment" } ], checks => [ 'kivi.validate_form' ], - disabled => !$may_edit_create ? t8('You must not change this AP transaction.') - : !$::form->{id} ? t8('This invoice has not been posted yet.') - : undef, + disabled => !$may_edit_create ? t8('You must not change this AP transaction.') + : !$::form->{id} ? t8('This invoice has not been posted yet.') + : $is_linked_bank_transaction ? t8('This transaction is linked with a bank transaction. Please undo and redo the bank transaction booking if needed.') + : undef, ], action => [ t8('Mark as paid'), submit => [ '#form', { action => "mark_as_paid" } ], @@ -1294,14 +1304,15 @@ sub setup_ap_display_form_action_bar { action => [ t8('Delete'), submit => [ '#form', { action => "delete" } ], confirm => t8('Do you really want to delete this object?'), - disabled => !$may_edit_create ? t8('You must not change this AP transaction.') - : !$::form->{id} ? t8('This invoice has not been posted yet.') - : $change_never ? t8('Changing invoices has been disabled in the configuration.') - : $change_on_same_day_only ? t8('Invoices can only be changed on the day they are posted.') - : $has_storno ? t8('This invoice has been canceled already.') - : $is_closed ? t8('The billing period has already been locked.') - : $has_sepa_exports ? t8('This invoice has been linked with a sepa export, undo this first.') - : undef, + disabled => !$may_edit_create ? t8('You must not change this AP transaction.') + : !$::form->{id} ? t8('This invoice has not been posted yet.') + : $change_never ? t8('Changing invoices has been disabled in the configuration.') + : $change_on_same_day_only ? t8('Invoices can only be changed on the day they are posted.') + : $has_storno ? t8('This invoice has been canceled already.') + : $is_closed ? t8('The billing period has already been locked.') + : $has_sepa_exports ? t8('This invoice has been linked with a sepa export, undo this first.') + : $is_linked_bank_transaction ? t8('This transaction is linked with a bank transaction. Please undo and redo the bank transaction booking if needed.') + : undef, ], ], # end of combobox "Storno" diff --git a/bin/mozilla/ar.pl b/bin/mozilla/ar.pl index 19f0058d1..15e756e93 100644 --- a/bin/mozilla/ar.pl +++ b/bin/mozilla/ar.pl @@ -41,6 +41,7 @@ use SL::Controller::Base; use SL::FU; use SL::GL; use SL::IS; +use SL::DB::BankTransactionAccTrans; use SL::DB::Business; use SL::DB::Chart; use SL::DB::Currency; @@ -1276,6 +1277,13 @@ sub setup_ar_form_header_action_bar { my $has_storno = IS->has_storno(\%::myconfig, $::form, 'ar'); my $may_edit_create = $::auth->assert('ar_transactions', 1); + my $is_linked_bank_transaction; + if ($::form->{id} + && SL::DB::Default->get->payments_changeable != 0 + && SL::DB::Manager::BankTransactionAccTrans->find_by(ar_id => $::form->{id})) { + + $is_linked_bank_transaction = 1; + } for my $bar ($::request->layout->get('actionbar')) { $bar->add( action => [ @@ -1297,14 +1305,16 @@ sub setup_ar_form_header_action_bar { : $is_storno ? t8('A canceled invoice cannot be posted.') : ($::form->{id} && $change_never) ? t8('Changing invoices has been disabled in the configuration.') : ($::form->{id} && $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.') : undef, ], action => [ t8('Post Payment'), submit => [ '#form', { action => "post_payment" } ], - disabled => !$may_edit_create ? t8('You must not change this AR transaction.') - : !$::form->{id} ? t8('This invoice has not been posted yet.') - : undef, + disabled => !$may_edit_create ? t8('You must not change this AR transaction.') + : !$::form->{id} ? t8('This invoice has not been posted yet.') + : $is_linked_bank_transaction ? t8('This transaction is linked with a bank transaction. Please undo and redo the bank transaction booking if needed.') + : undef, ], action => [ t8('Mark as paid'), submit => [ '#form', { action => "mark_as_paid" } ], diff --git a/bin/mozilla/ir.pl b/bin/mozilla/ir.pl index 79aa473dc..c550d5d64 100644 --- a/bin/mozilla/ir.pl +++ b/bin/mozilla/ir.pl @@ -35,6 +35,7 @@ use SL::FU; use SL::IR; use SL::IS; +use SL::DB::BankTransactionAccTrans; use SL::DB::Default; use SL::DB::Department; use SL::DB::PurchaseInvoice; @@ -244,12 +245,18 @@ sub setup_ir_action_bar { my $may_edit_create = $::auth->assert('vendor_invoice_edit', 1); my $has_sepa_exports; - if ($form->{id}) { my $invoice = SL::DB::Manager::PurchaseInvoice->find_by(id => $form->{id}); $has_sepa_exports = 1 if ($invoice->find_sepa_export_items()->[0]); } + my $is_linked_bank_transaction; + if ($::form->{id} + && SL::DB::Default->get->payments_changeable != 0 + && SL::DB::Manager::BankTransactionAccTrans->find_by(ap_id => $::form->{id})) { + + $is_linked_bank_transaction = 1; + } for my $bar ($::request->layout->get('actionbar')) { $bar->add( action => [ @@ -272,15 +279,17 @@ sub setup_ir_action_bar { : $form->{storno} ? t8('A canceled invoice cannot be posted.') : ($form->{id} && $change_never) ? t8('Changing invoices has been disabled in the configuration.') : ($form->{id} && $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.') : undef, ], action => [ t8('Post Payment'), submit => [ '#form', { action => "post_payment" } ], checks => [ 'kivi.validate_form' ], - disabled => !$may_edit_create ? t8('You must not change this invoice.') - : !$form->{id} ? t8('This invoice has not been posted yet.') - : undef, + disabled => !$may_edit_create ? t8('You must not change this invoice.') + : !$form->{id} ? t8('This invoice has not been posted yet.') + : $is_linked_bank_transaction ? t8('This transaction is linked with a bank transaction. Please undo and redo the bank transaction booking if needed.') + : undef, ], action => [ t8('Mark as paid'), @@ -309,13 +318,14 @@ sub setup_ir_action_bar { submit => [ '#form', { action => "delete" } ], checks => [ 'kivi.validate_form' ], confirm => t8('Do you really want to delete this object?'), - disabled => !$may_edit_create ? t8('You must not change this invoice.') - : !$form->{id} ? t8('This invoice has not been posted yet.') - : $form->{locked} ? t8('The billing period has already been locked.') - : $change_never ? t8('Changing invoices has been disabled in the configuration.') - : $change_on_same_day_only ? t8('Invoices can only be changed on the day they are posted.') - : $has_sepa_exports ? t8('This invoice has been linked with a sepa export, undo this first.') - : $has_storno ? t8('Can only delete the "Storno zu" part of the cancellation pair.') + disabled => !$may_edit_create ? t8('You must not change this invoice.') + : !$form->{id} ? t8('This invoice has not been posted yet.') + : $form->{locked} ? t8('The billing period has already been locked.') + : $change_never ? t8('Changing invoices has been disabled in the configuration.') + : $change_on_same_day_only ? t8('Invoices can only be changed on the day they are posted.') + : $has_sepa_exports ? t8('This invoice has been linked with a sepa export, undo this first.') + : $has_storno ? t8('Can only delete the "Storno zu" part of the cancellation pair.') + : $is_linked_bank_transaction ? t8('This transaction is linked with a bank transaction. Please undo and redo the bank transaction booking if needed.') : undef, ], ], # end of combobox "Storno" diff --git a/bin/mozilla/is.pl b/bin/mozilla/is.pl index abbcef771..2c50d7ee9 100644 --- a/bin/mozilla/is.pl +++ b/bin/mozilla/is.pl @@ -43,6 +43,7 @@ use List::Util qw(max sum); use List::UtilsBy qw(sort_by); use English qw(-no_match_vars); +use SL::DB::BankTransactionAccTrans; use SL::DB::Default; use SL::DB::Customer; use SL::DB::Department; @@ -278,6 +279,13 @@ sub setup_is_action_bar { my $payments_balanced = ($::form->{oldtotalpaid} == 0); my $has_storno = ($::form->{storno} && !$::form->{storno_id}); my $may_edit_create = $::auth->assert('invoice_edit', 1); + my $is_linked_bank_transaction; + if ($::form->{id} + && SL::DB::Default->get->payments_changeable != 0 + && SL::DB::Manager::BankTransactionAccTrans->find_by(ar_id => $::form->{id})) { + + $is_linked_bank_transaction = 1; + } for my $bar ($::request->layout->get('actionbar')) { $bar->add( @@ -302,15 +310,17 @@ sub setup_is_action_bar { : $form->{storno} ? t8('A canceled invoice cannot be posted.') : ($form->{id} && $change_never) ? t8('Changing invoices has been disabled in the configuration.') : ($form->{id} && $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.') : undef, ], action => [ t8('Post Payment'), submit => [ '#form', { action => "post_payment" } ], checks => [ 'kivi.validate_form' ], - disabled => !$may_edit_create ? t8('You must not change this invoice.') - : !$form->{id} ? t8('This invoice has not been posted yet.') - : undef, + disabled => !$may_edit_create ? t8('You must not change this invoice.') + : !$form->{id} ? t8('This invoice has not been posted yet.') + : $is_linked_bank_transaction ? t8('This transaction is linked with a bank transaction. Please undo and redo the bank transaction booking if needed.') + : undef, ], action => [ t8('Mark as paid'), submit => [ '#form', { action => "mark_as_paid" } ], -- 2.20.1