$::form->{$_} = $form_defaults->{$_} for keys %{ $form_defaults // {} };
flash('info', $::locale->text("The record template '#1' has been loaded.", $template->template_name));
+ flash('info', $::locale->text("Payment bookings disallowed. After the booking this record may be " .
+ "suggested with the amount of '#1' or otherwise has to be choosen manually." .
+ " No automatic payment booking will be done to chart '#2'.",
+ $form_defaults->{paid_1_suggestion},
+ $form_defaults->{AP_paid_1_suggestion},
+ )) if $::form->{no_payment_bookings};
update(
keep_rows_without_amount => 1,
$form->{"tax_$i"} = $form->format_amount(\%myconfig, $form->{"tax_$i"}, 2);
my ($default_taxchart, $taxchart_to_use);
- my $amount_chart_id = $form->{"AP_amount_chart_id_$i"} || $default_ap_amount_chart_id;
- my $chart_has_changed = $::form->{"previous_AP_amount_chart_id_$i"} && ($amount_chart_id != $::form->{"previous_AP_amount_chart_id_$i"});
- my @taxcharts = GL->get_active_taxes_for_chart($amount_chart_id, $transdate);
+ my $amount_chart_id = $form->{"AP_amount_chart_id_$i"} || $default_ap_amount_chart_id;
+ my @taxcharts = GL->get_active_taxes_for_chart($amount_chart_id, $transdate);
foreach my $item (@taxcharts) {
my $key = $item->id . "--" . $item->rate;
$taxchart_to_use = $item if $key eq $form->{"taxchart_$i"};
}
- $taxchart_to_use = $default_taxchart // $first_taxchart if $chart_has_changed || !$taxchart_to_use;
+ $taxchart_to_use //= $default_taxchart // $first_taxchart;
my $selected_taxchart = $taxchart_to_use->id . '--' . $taxchart_to_use->rate;
$form->{"selected_taxchart_$i"} = $selected_taxchart;
$form->{"AP_amount_chart_id_$i"} = $amount_chart_id;
if (($form->{previous_vendor_id} || $form->{vendor_id}) != $form->{vendor_id}) {
IR->get_vendor(\%::myconfig, $form);
+ if (($form->{rowcount} == 1) && ($form->{amount_1} == 0)) {
+ my $last_used_ap_chart = SL::DB::Vendor->load_cached($form->{vendor_id})->last_used_ap_chart;
+ $form->{"AP_amount_chart_id_1"} = $last_used_ap_chart->id if $last_used_ap_chart;
+ }
}
$form->{rowcount} = $count + ($params{dont_add_new_row} ? 0 : 1);
$form->{what_done} = "invoice";
$form->save_history;
}
- # /saving the history
- # Dieser Text wird niemals ausgegeben: Probleme beim redirect?
+ # no restore_from_session_id needed. we like to have a newly generated
+ # list of invoices for bank transactions
+ print $form->redirect_header($form->{callback}) if ($form->{callback} =~ /BankTransaction/);
$form->redirect($locale->text('AP transaction posted.')) unless $inline;
} else {
$form->error($locale->text('Cannot post transaction!'));
'ustid' => { 'text' => $locale->text('USt-IdNr.'), },
'taxzone' => { 'text' => $locale->text('Tax rate'), },
'payment_terms' => { 'text' => $locale->text('Payment Terms'), },
- 'charts' => { 'text' => $locale->text('Buchungskonto'), },
+ 'charts' => { 'text' => $locale->text('Chart'), },
'direct_debit' => { 'text' => $locale->text('direct debit'), },
);