X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=bin%2Fmozilla%2Fam.pl;h=ebe7ed1879b1260722e9157a0408ef26a9904c79;hb=a27cd427a2689b49a7642884edd2d24555305a4b;hp=f9d299ff57d456a5408db7739c1249fdc9b53081;hpb=8a40e3dd0f638557b8c666fe708ccbc1ac709c4e;p=kivitendo-erp.git diff --git a/bin/mozilla/am.pl b/bin/mozilla/am.pl index f9d299ff5..ebe7ed187 100644 --- a/bin/mozilla/am.pl +++ b/bin/mozilla/am.pl @@ -144,7 +144,7 @@ sub account_header { rate => '', taxkey_id => '', pos_ustva => '', - startdate => '', + startdate => $form->{account_exists} ? '' : DateTime->new(year => 1970, month => 1, day => 1)->to_lxoffice, }; push @{ $form->{ACCOUNT_TAXKEYS} }, $newtaxkey_ref; @@ -394,6 +394,17 @@ sub save_account { if ($form->{charttype} eq 'A'){ $form->isblank("category", $locale->text('Account Type missing!')); + + my $found_valid_taxkey = 0; + foreach my $i (0 .. 10) { # 10 is maximum count of taxkeys in form + if ($form->{"taxkey_startdate_$i"} and !$form->{"taxkey_del_$i"}) { + $found_valid_taxkey = 1; + last; + } + } + if ($found_valid_taxkey == 0) { + $form->error($locale->text('A valid taxkey is missing!')); + } } $form->redirect($locale->text('Account saved!')) @@ -940,7 +951,7 @@ sub edit_defaults { # default language my $all_languages = SL::DB::Manager::Language->get_all; -# EÜR = cash, Bilanzierung = accrual +# cash = IST-Versteuerung, accrual = SOLL-Versteuerung foreach my $key (keys %{ $form->{IC} }) { foreach my $accno (sort keys %{ $form->{IC}->{$key} }) { @@ -1062,7 +1073,7 @@ sub config { } $form->{STYLESHEETS} = []; - foreach my $item (qw(lx-office-erp.css Win2000.css Mobile.css kivitendo.css)) { + foreach my $item (qw(lx-office-erp.css Mobile.css kivitendo.css)) { push @{ $form->{STYLESHEETS} }, { 'name' => $item, 'value' => $item, @@ -1450,6 +1461,13 @@ sub add_tax { _get_taxaccount_selection(); + $form->{asset} = 1; + $form->{liability} = 1; + $form->{equity} = 1; + $form->{revenue} = 1; + $form->{expense} = 1; + $form->{costs} = 1; + $form->header(); my $parameters_ref = { @@ -1474,8 +1492,16 @@ sub edit_tax { $form->{title} = $locale->text('Edit'); AM->get_tax(\%myconfig, \%$form); + _get_taxaccount_selection(); + $form->{asset} = $form->{chart_categories} =~ 'A' ? 1 : 0; + $form->{liability} = $form->{chart_categories} =~ 'L' ? 1 : 0; + $form->{equity} = $form->{chart_categories} =~ 'Q' ? 1 : 0; + $form->{revenue} = $form->{chart_categories} =~ 'I' ? 1 : 0; + $form->{expense} = $form->{chart_categories} =~ 'E' ? 1 : 0; + $form->{costs} = $form->{chart_categories} =~ 'C' ? 1 : 0; + $form->{rate} = $form->format_amount(\%myconfig, $form->{rate}, 2); $form->header(); @@ -1541,12 +1567,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')); }