X-Git-Url: http://wagnertech.de/gitweb/gitweb.cgi/mfinanz.git/blobdiff_plain/39bdd9e00b88bd6a32276b1a25dfb158a6f382c2..3715333a1e32b0c54b5bac2f878f133c76f386b5:/bin/mozilla/gl.pl diff --git a/bin/mozilla/gl.pl b/bin/mozilla/gl.pl index 886d756f8..dbaddc596 100644 --- a/bin/mozilla/gl.pl +++ b/bin/mozilla/gl.pl @@ -158,9 +158,15 @@ sub save_record_template { my $template = $::form->{record_template_id} ? SL::DB::RecordTemplate->new(id => $::form->{record_template_id})->load : SL::DB::RecordTemplate->new; my $js = SL::ClientJS->new(controller => SL::Controller::Base->new); my $new_name = $template->template_name_to_use($::form->{record_template_new_template_name}); - $js->dialog->close('#record_template_dialog'); + + # bank transactions need amounts for assignment + my $can_save = 0; + $can_save = 1 if ($::form->{credit_1} > 0 && $::form->{debit_2} > 0 && $::form->{credit_2} == 0 && $::form->{debit_1} == 0); + $can_save = 1 if ($::form->{credit_2} > 0 && $::form->{debit_1} > 0 && $::form->{credit_1} == 0 && $::form->{debit_2} == 0); + return $js->flash('error', t8('Can only save template if amounts,i.e. 1 for debit and credit are set.'))->render unless $can_save; + my @items = grep { $_->{chart_id} && (($_->{tax_id} // '') ne '') } map {