X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=bin%2Fmozilla%2Fap.pl;h=53dd785ed950fc57d229949ea1b951edb9415acb;hb=36bdd4875c67f916e4a885191f7870d301ae2c11;hp=b20584140896443482f90857f2c20061065a41e0;hpb=8b217e89e09ec0d18a6dc747a62a0c38dc7b9572;p=kivitendo-erp.git diff --git a/bin/mozilla/ap.pl b/bin/mozilla/ap.pl index b20584140..53dd785ed 100644 --- a/bin/mozilla/ap.pl +++ b/bin/mozilla/ap.pl @@ -307,7 +307,7 @@ 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 $form->{taxincluded} = ($form->{id}) ? $form->{taxincluded} : "checked"; @@ -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"