X-Git-Url: http://wagnertech.de/gitweb/gitweb.cgi/mfinanz.git/blobdiff_plain/ec8a10a0909d2f0a90de0a14b4d69e9599899d6e..4341dfafb3e017d00a843496a4c671fe5601db74:/bin/mozilla/ap.pl diff --git a/bin/mozilla/ap.pl b/bin/mozilla/ap.pl index bfcf468a8..53dd785ed 100644 --- a/bin/mozilla/ap.pl +++ b/bin/mozilla/ap.pl @@ -307,7 +307,6 @@ sub create_links { $form->{$_} = $saved{$_} for keys %saved; $form->{rowcount} = 1; - $form->{AP_chart_id} = $form->{acc_trans} && $form->{acc_trans}->{AP} ? $form->{acc_trans}->{AP}->[0]->{chart_id} : $form->{AP_links}->{AP}->[0]->{chart_id}; $form->{AP_chart_id} = $form->{acc_trans} && $form->{acc_trans}->{AP} ? $form->{acc_trans}->{AP}->[0]->{chart_id} : $::instance_conf->get_ap_chart_id || $form->{AP_links}->{AP}->[0]->{chart_id}; # build the popup menus @@ -1208,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 => [ @@ -1222,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.') @@ -1252,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'), @@ -1262,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"