From b231d03716d0dcd795749c49bb5c3c6095111ede Mon Sep 17 00:00:00 2001 From: =?utf8?q?Jan=20B=C3=BCren?= Date: Mon, 16 Apr 2018 13:45:21 +0200 Subject: [PATCH] =?utf8?q?Stornos=20bei=20EK-Rechnungen=20verbieten,=20sol?= =?utf8?q?ange=20SEPA-Exports=20verkn=C3=BCpft=20sind?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- bin/mozilla/ir.pl | 12 +++++++++++- locale/de/all | 1 + 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/bin/mozilla/ir.pl b/bin/mozilla/ir.pl index 66e9b08a1..64180c2a9 100644 --- a/bin/mozilla/ir.pl +++ b/bin/mozilla/ir.pl @@ -221,6 +221,13 @@ sub setup_ir_action_bar { my $change_never = $::instance_conf->get_ir_changeable == 0; my $change_on_same_day_only = $::instance_conf->get_ir_changeable == 2 && ($form->current_date(\%::myconfig) ne $form->{gldate}); + 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]); + } + for my $bar ($::request->layout->get('actionbar')) { $bar->add( action => [ @@ -263,7 +270,9 @@ sub setup_ir_action_bar { submit => [ '#form', { action => "storno" } ], checks => [ 'kivi.validate_form' ], confirm => t8('Do you really want to cancel this invoice?'), - disabled => !$form->{id} ? t8('This invoice has not been posted yet.') : undef, + disabled => !$form->{id} ? t8('This invoice has not been posted yet.') + : $has_sepa_exports ? t8('This invoice has been linked with a sepa export, undo this first.') + : undef, ], action => [ t8('Delete'), submit => [ '#form', { action => "delete" } ], @@ -273,6 +282,7 @@ sub setup_ir_action_bar { : $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.') : undef, ], ], # end of combobox "Storno" diff --git a/locale/de/all b/locale/de/all index 16278eda8..3939d588a 100755 --- a/locale/de/all +++ b/locale/de/all @@ -3474,6 +3474,7 @@ $self->{texts} = { 'This has been changed in this version.' => 'Ab dieser Version ist dies nicht mehr so.', 'This invoice has already been posted.' => 'Die Rechnung wurde bereits gebucht.', 'This invoice has been canceled already.' => 'Die Rechnung wurde bereits storniert.', + 'This invoice has been linked with a sepa export, undo this first.' => 'Diese Rechnung ist mit einem SEPA-Export verknüpft. Bitte diese Verknüpfung zuerst aufheben.', 'This invoice has not been posted yet.' => 'Die Rechnung wurde noch nicht gebucht.', 'This invoice\'s dunning level: #1' => 'Mahnstufe dieser Rechnung: #1', 'This is a very critical problem.' => 'Dieses Problem ist sehr schwerwiegend.', -- 2.20.1