X-Git-Url: http://wagnertech.de/gitweb/gitweb.cgi/mfinanz.git/blobdiff_plain/0f0f42639c9a9c31a86521a9347f910fe0f0c3e0..7ff9fa05e670aa2e5fa76b9d8d0b39ea66a74dd1:/bin/mozilla/am.pl?ds=sidebyside diff --git a/bin/mozilla/am.pl b/bin/mozilla/am.pl index 2b7cdf8ee..bcb39d258 100644 --- a/bin/mozilla/am.pl +++ b/bin/mozilla/am.pl @@ -1491,7 +1491,11 @@ sub edit_tax { $form->header(); + #set readonly if the there are entries in acc_trans with the tax + my $readonly = $form->{tax_already_used} ? 'readonly' : ''; + my $parameters_ref = { + readonly => $readonly, }; # Ausgabe des Templates @@ -1552,12 +1556,16 @@ sub save_tax { $main::auth->assert('config'); - $form->isblank("rate", $locale->text('Taxrate missing!')); - $form->isblank("taxdescription", $locale->text('Taxdescription missing!')); - $form->isblank("taxkey", $locale->text('Taxkey missing!')); + $form->error($locale->text('Taxkey missing!')) unless length($form->{taxkey}) != 0; + $form->error($locale->text('Taxdescription missing!')) unless length($form->{taxdescription}) != 0; + $form->error($locale->text('Taxrate missing!')) unless length($form->{rate}) != 0; $form->{rate} = $form->parse_amount(\%myconfig, $form->{rate}); + if ($form->{taxkey} == 0 and $form->{rate} > 0) { + $form->error($locale->text('Taxkey 0 is reserved for rate 0')); + } + if ( $form->{rate} < 0 || $form->{rate} >= 100 ) { $form->error($locale->text('Tax Percent is a number between 0 and 100')); }