X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;ds=sidebyside;f=bin%2Fmozilla%2Fam.pl;h=e141696f80ab7f26c88f6da9572ef1b463436672;hb=e86e30de944c4bbe4b42f43d933e0a28a83408dd;hp=10ab28005516b843d6012ece3da6dde65ad3d6e5;hpb=99e420aa730ca1d640804e8ce4074d8abb62e927;p=kivitendo-erp.git
diff --git a/bin/mozilla/am.pl b/bin/mozilla/am.pl
index 10ab28005..e141696f8 100644
--- a/bin/mozilla/am.pl
+++ b/bin/mozilla/am.pl
@@ -42,7 +42,9 @@ use SL::User;
use SL::USTVA;
use SL::Iconv;
use SL::TODO;
-use SL::Printer;
+use SL::DB::Printer;
+use SL::DB::Tax;
+use SL::DB::Language;
use CGI;
require "bin/mozilla/common.pl";
@@ -144,7 +146,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;
@@ -336,7 +338,7 @@ sub account_header {
# account where AR_tax or AP_tax is set are not orphaned if they are used as
# tax-o-matic account
- if ( $form->{id} && !$form->{orphaned} && ($form->{link} =~ m/(AP_tax|AR_tax)/) ) {
+ if ( $form->{id} && $form->{orphaned} && ($form->{link} =~ m/(AP_tax|AR_tax)/) ) {
if (SL::DB::Manager::Tax->find_by(chart_id => $form->{id})) {
$form->{orphaned} = 0;
}
@@ -394,6 +396,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!'))
@@ -426,10 +439,6 @@ sub save_as_new_account {
}
$form->{id} = 0;
- if ($form->{"original_accno"} &&
- ($form->{"accno"} eq $form->{"original_accno"})) {
- $form->error($locale->text('Account Number already used!'));
- }
$form->redirect($locale->text('Account saved!'))
if (AM->save_account(\%myconfig, \%$form));
$form->error($locale->text('Cannot save account!'));
@@ -466,7 +475,7 @@ sub list_account {
$ca->{link_edit_account} = $link_edit_account . '&id=' . E($ca->{id});
}
- $form->use_stylesheet("list_accounts.css");
+ $::request->{layout}->use_stylesheet("list_accounts.css");
$form->{title} = $locale->text('Chart of Accounts');
$form->header;
@@ -742,7 +751,7 @@ sub language_header {
print $::form->parse_html_template('am/language_header', {
numberformats => [ '1,000.00', '1000.00', '1.000,00', '1000,00' ],
- dateformats => [ qw(mm-dd-yy mm/dd/yy dd-mm-yy dd/mm/yy dd.mm.yy yyyy-mm-dd) ],
+ dateformats => [ qw(mm/dd/yy dd/mm/yy dd.mm.yy yyyy-mm-dd) ],
});
$::lxdebug->leave_sub;
@@ -830,330 +839,56 @@ sub edit_buchungsgruppe {
}
sub list_buchungsgruppe {
- $main::lxdebug->enter_sub();
-
- my $form = $main::form;
- my %myconfig = %main::myconfig;
- my $locale = $main::locale;
-
- $main::auth->assert('config');
-
- AM->buchungsgruppe(\%myconfig, \%$form);
-
- $form->{callback} = "am.pl?action=list_buchungsgruppe";
-
- my $callback = $form->escape($form->{callback});
-
- $form->{title} = $locale->text('Buchungsgruppen');
-
- my @column_index = qw(up down description inventory_accno
- income_accno_0 expense_accno_0
- income_accno_1 expense_accno_1
- income_accno_2 expense_accno_2
- income_accno_3 expense_accno_3 );
- my %column_header;
- $column_header{up} =
- qq|
|
- . qq| |
- . qq| | |;
- $column_header{down} =
- qq||
- . qq| |
- . qq| | |;
- $column_header{description} =
- qq||
- . $locale->text('Description')
- . qq| | |;
- $column_header{inventory_accno} =
- qq||
- . $locale->text('Bestandskonto')
- . qq| | |;
- $column_header{income_accno_0} =
- qq||
- . $locale->text('National Revenues')
- . qq| | |;
- $column_header{expense_accno_0} =
- qq||
- . $locale->text('National Expenses')
- . qq| | |;
- $column_header{income_accno_1} =
- qq||
- . $locale->text('Revenues EU with UStId')
- . qq| | |;
- $column_header{expense_accno_1} =
- qq||
- . $locale->text('Expenses EU with UStId')
- . qq| | |;
- $column_header{income_accno_2} =
- qq||
- . $locale->text('Revenues EU without UStId')
- . qq| | |;
- $column_header{expense_accno_2} =
- qq||
- . $locale->text('Expenses EU without UStId')
- . qq| | |;
- $column_header{income_accno_3} =
- qq||
- . $locale->text('Foreign Revenues')
- . qq| | |;
- $column_header{expense_accno_3} =
- qq||
- . $locale->text('Foreign Expenses')
- . qq| | |;
- $form->header;
-
- print qq|
-
-
-
-
- $form->{title} |
-
-
-
-
-
-
-|;
-
- map { print "$column_header{$_}\n" } @column_index;
-
- print qq|
-
-|;
-
- my $swap_link = qq|am.pl?action=swap_buchungsgruppen&|;
-
- my $row = 0;
- my ($i, %column_data);
- foreach my $ref (@{ $form->{ALL} }) {
-
- $i++;
- $i %= 2;
-
- print qq|
-
-|;
-
- if ($row) {
- my $pref = $form->{ALL}->[$row - 1];
- $column_data{up} =
- qq|| .
- qq|| .
- qq| | .
- qq| | |;
- } else {
- $column_data{up} = qq| | |;
- }
-
- if ($row == (scalar(@{ $form->{ALL} }) - 1)) {
- $column_data{down} = qq| | |;
- } else {
- my $nref = $form->{ALL}->[$row + 1];
- $column_data{down} =
- qq|| .
- qq|| .
- qq| | .
- qq| | |;
- }
-
- $column_data{description} = qq|$ref->{description} | |;
- $column_data{inventory_accno} = qq|$ref->{inventory_accno} | |;
- $column_data{income_accno_0} =
- qq|$ref->{income_accno_0} | |;
- $column_data{expense_accno_0} = qq|$ref->{expense_accno_0} | |;
- $column_data{income_accno_1} =
- qq|$ref->{income_accno_1} | |;
- $column_data{expense_accno_1} = qq|$ref->{expense_accno_1} | |;
- $column_data{income_accno_2} =
- qq|$ref->{income_accno_2} | |;
- $column_data{expense_accno_2} = qq|$ref->{expense_accno_2} | |;
- $column_data{income_accno_3} =
- qq|$ref->{income_accno_3} | |;
- $column_data{expense_accno_3} = qq|$ref->{expense_accno_3} | |;
-
- map { print "$column_data{$_}\n" } @column_index;
-
- print qq|
-
-|;
-
- $row++;
- }
-
- print qq|
-
- |
-
-
-
|
-
-
-
-
-
+ $::form->{callback} = "am.pl?action=list_buchungsgruppe";
+ $::form->{title} = $::locale->text('Buchungsgruppen');
+ $::form->header;
-
-