X-Git-Url: http://wagnertech.de/gitweb/gitweb.cgi/mfinanz.git/blobdiff_plain/327ee3ca044d3b7fcd47214772d6756d5f0b5056..29254bae64b881dba588f7a02027dac0d1c7b022:/bin/mozilla/ap.pl diff --git a/bin/mozilla/ap.pl b/bin/mozilla/ap.pl index 77120a3bc..53dd785ed 100644 --- a/bin/mozilla/ap.pl +++ b/bin/mozilla/ap.pl @@ -1207,6 +1207,13 @@ sub setup_ap_display_form_action_bar { my $is_storno = IS->is_storno(\%::myconfig, $::form, 'ap', $::form->{id}); my $has_storno = IS->has_storno(\%::myconfig, $::form, 'ap'); + 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 => [ @@ -1221,7 +1228,7 @@ sub setup_ap_display_form_action_bar { action => [ t8('Post'), submit => [ '#form', { action => "post" } ], - checks => [ 'kivi.validate_form', 'kivi.AP.check_fields_before_posting' ], + checks => [ 'kivi.validate_form', 'kivi.AP.check_fields_before_posting', 'kivi.AP.check_duplicate_invnumber' ], disabled => $is_closed ? t8('The billing period has already been locked.') : $is_storno ? t8('A canceled invoice cannot be posted.') : ($::form->{id} && $change_never) ? t8('Changing invoices has been disabled in the configuration.') @@ -1251,6 +1258,7 @@ sub setup_ap_display_form_action_bar { : $has_storno ? t8('This invoice has been canceled already.') : $is_storno ? t8('Reversal invoices cannot be canceled.') : $::form->{totalpaid} ? t8('Invoices with payments cannot be canceled.') + : $has_sepa_exports ? t8('This invoice has been linked with a sepa export, undo this first.') : undef, ], action => [ t8('Delete'), @@ -1261,6 +1269,7 @@ sub setup_ap_display_form_action_bar { : $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, ], ], # end of combobox "Storno"