From 7e0ea1c23859d1839c9ce4574de45ec7fcf92c15 Mon Sep 17 00:00:00 2001 From: Udo Spallek Date: Thu, 12 Jul 2007 22:52:01 +0000 Subject: [PATCH] Diverse Bugs im Zusammenhang mit Steuerautomatiken, mit chart_id=0 oder mit rate=0. Beides sollte jedoch moeglich sein fuer Konten wie 'steuerfrei'. --- SL/AM.pm | 13 ++++++------- bin/mozilla/am.pl | 5 ++--- locale/de/all | 1 - locale/de/am | 1 - templates/webpages/am/edit_tax_de.html | 8 +++----- templates/webpages/am/edit_tax_master.html | 8 +++----- 6 files changed, 14 insertions(+), 22 deletions(-) diff --git a/SL/AM.pm b/SL/AM.pm index 3737c130c..515b226e9 100644 --- a/SL/AM.pm +++ b/SL/AM.pm @@ -2068,10 +2068,9 @@ sub taxes { t.taxkey, t.taxdescription, round(t.rate * 100, 2) AS rate, - c.accno AS taxnumber, - c.description AS account_description + (SELECT accno FROM chart WHERE id = chart_id) AS taxnumber, + (SELECT description FROM chart WHERE id = chart_id) AS account_description FROM tax t - JOIN chart c on (chart_id = c.id) ORDER BY taxkey|; $sth = $dbh->prepare($query); @@ -2146,7 +2145,7 @@ sub get_tax { # see if it is used by a taxkey $query = qq|SELECT count(*) FROM taxkeys - WHERE tax_id = ?|; + WHERE tax_id = ? AND chart_id >0|; ($form->{orphaned}) = selectrow_query($form, $dbh, $query, $form->{id}); @@ -2156,8 +2155,8 @@ sub get_tax { if (!$form->{orphaned} ) { $query = qq|SELECT DISTINCT c.id, c.accno FROM taxkeys tk - LEFT JOIN tax t ON (t.id = tk.tax_id) - LEFT JOIN chart c ON (c.id = tk.chart_id) + JOIN tax t ON (t.id = tk.tax_id) + JOIN chart c ON (c.id = tk.chart_id) WHERE tk.tax_id = ?|; $sth = $dbh->prepare($query); @@ -2187,7 +2186,7 @@ sub save_tax { $form->{rate} = $form->{rate} / 100; my @values = ($form->{taxkey}, $form->{taxdescription}, $form->{rate}, $form->{chart_id}, $form->{chart_id} ); - if ($form->{id}) { + if ($form->{id} ne "") { $query = qq|UPDATE tax SET taxkey = ?, taxdescription = ?, diff --git a/bin/mozilla/am.pl b/bin/mozilla/am.pl index 7f9887753..b0d0eba71 100644 --- a/bin/mozilla/am.pl +++ b/bin/mozilla/am.pl @@ -3216,18 +3216,17 @@ sub _get_taxaccount_selection{ sub save_tax { $lxdebug->enter_sub(); - $form->isblank("chart_id", $locale->text('Tax-O-Matic account missing!')); $form->isblank("rate", $locale->text('Taxrate missing!')); $form->isblank("taxdescription", $locale->text('Taxdescription missing!')); $form->isblank("taxkey", $locale->text('Taxkey missing!')); $form->{rate} = $form->parse_amount(\%myconfig, $form->{rate}); - if ( $form->{rate} <= 0 || $form->{rate} >= 100 ) { + if ( $form->{rate} < 0 || $form->{rate} >= 100 ) { $form->error($locale->text('Tax Percent is a number between 0 and 100')); } - if ( $form->{rate} <= 0.99 && $form->{rate} >= 0 ) { + if ( $form->{rate} <= 0.99 && $form->{rate} > 0 ) { $form->error($locale->text('Tax Percent is a number between 0 and 100')); } diff --git a/locale/de/all b/locale/de/all index 82c4a9968..6103e469f 100644 --- a/locale/de/all +++ b/locale/de/all @@ -1085,7 +1085,6 @@ aktualisieren wollen?', 'Tax paid' => 'Vorsteuer', 'Tax saved!' => 'Steuer gespeichert!', 'Tax-O-Matic' => 'Steuer', - 'Tax-O-Matic account missing!' => 'Automatikkonto fehlt!', 'Tax-o-matic Account' => 'Automatikbuchung auf Konto', 'Taxaccount_coa' => 'Automatikkonto', 'Taxation' => 'Versteuerungs Verfahren', diff --git a/locale/de/am b/locale/de/am index 8e32167ba..9497b505c 100644 --- a/locale/de/am +++ b/locale/de/am @@ -252,7 +252,6 @@ $self->{texts} = { 'Tax deleted!' => 'Steuer gelöscht!', 'Tax saved!' => 'Steuer gespeichert!', 'Tax-O-Matic' => 'Steuer', - 'Tax-O-Matic account missing!' => 'Automatikkonto fehlt!', 'Tax-o-matic Account' => 'Automatikbuchung auf Konto', 'Taxdescription missing!' => 'Steuername fehlt!', 'Taxkey missing!' => 'Steuerschlüssel fehlt!', diff --git a/templates/webpages/am/edit_tax_de.html b/templates/webpages/am/edit_tax_de.html index 13ac9a459..f69ef97f3 100644 --- a/templates/webpages/am/edit_tax_de.html +++ b/templates/webpages/am/edit_tax_de.html @@ -23,12 +23,11 @@ Automatikkonto - + - [% IF id %] [% UNLESS orphaned %]
Konten, die mit dieser Steuer verknüpft sind: @@ -37,7 +36,6 @@ [% END %]
[% END %] - [% END %] @@ -45,9 +43,9 @@ - [% IF orphaned %][% IF id %] + [% IF orphaned %] - [% END %][% END %] + [% END %] diff --git a/templates/webpages/am/edit_tax_master.html b/templates/webpages/am/edit_tax_master.html index 5242b2acf..5f48c7d18 100644 --- a/templates/webpages/am/edit_tax_master.html +++ b/templates/webpages/am/edit_tax_master.html @@ -23,12 +23,11 @@ tax_chartaccno - + - [% IF id %] [% UNLESS orphaned %]
Chartaccounts connected to this Tax: @@ -37,7 +36,6 @@ [% END %]
[% END %] - [% END %] @@ -45,9 +43,9 @@ - [% IF orphaned %][% IF id %] + [% IF orphaned %] - [% END %][% END %] + [% END %] -- 2.20.1