From: Moritz Bunkus Date: Tue, 24 Apr 2007 10:30:29 +0000 (+0000) Subject: In allen Einkaufs- und Verkaufsmasken die Drop-Down-Box für die Steuerzone bei jedem... X-Git-Tag: release-2.4.3^2~467 X-Git-Url: http://wagnertech.de/git?a=commitdiff_plain;h=ddbe3ea5ec297a58acc9ee3afc17156fb97be7f2;p=kivitendo-erp.git In allen Einkaufs- und Verkaufsmasken die Drop-Down-Box für die Steuerzone bei jedem Formularaufbau neu generieren. Dadurch bleibt auch der bisher selektierte Eintrag selektiert, was er vorher nicht tat (sprang immer auf "Inland" zurück). --- diff --git a/SL/CT.pm b/SL/CT.pm index ad92d4c34..91fe2c022 100644 --- a/SL/CT.pm +++ b/SL/CT.pm @@ -101,10 +101,6 @@ sub populate_drop_down_boxes { $query = qq|SELECT id, description FROM business ORDER BY id|; $form->{all_business} = selectall_hashref_query($form, $dbh, $query); - # get tax zones - $query = qq|SELECT id, description FROM tax_zones|; - $form->{TAXZONE} = selectall_hashref_query($form, $dbh, $query); - # get shipto address $query = qq|SELECT shipto_id, shiptoname, shiptodepartment_1 | . diff --git a/SL/Form.pm b/SL/Form.pm index 252c4c159..98b2a4e4d 100644 --- a/SL/Form.pm +++ b/SL/Form.pm @@ -1517,6 +1517,20 @@ sub _get_taxcharts { $main::lxdebug->leave_sub(); } +sub _get_taxzones { + $main::lxdebug->enter_sub(); + + my ($self, $dbh, $key) = @_; + + $key = "all_taxzones" unless ($key); + + my $query = qq|SELECT * FROM tax_zones ORDER BY id|; + + $self->{$key} = selectall_hashref_query($self, $dbh, $query); + + $main::lxdebug->leave_sub(); +} + sub _get_employees { $main::lxdebug->enter_sub(); @@ -1597,6 +1611,10 @@ sub get_lists { $self->_get_taxcharts($dbh, $params{"taxcharts"}); } + if ($params{"taxzones"}) { + $self->_get_taxzones($dbh, $params{"taxzones"}); + } + if ($params{"employees"}) { $self->_get_employees($dbh, $params{"employees"}); } @@ -1870,10 +1888,6 @@ sub create_links { $query = qq|SELECT id, taxkey, taxdescription FROM tax|; $self->{TAXKEY} = selectall_hashref_query($self, $dbh, $query); - # get tax zones - $query = qq|SELECT id, description FROM tax_zones|; - $self->{TAXZONE} = selectall_hashref_query($self, $dbh, $query); - if (($module eq "AP") || ($module eq "AR")) { # get tax rates and description $query = qq|SELECT * FROM tax|; diff --git a/SL/OE.pm b/SL/OE.pm index 0c14f177f..8e0cfb955 100644 --- a/SL/OE.pm +++ b/SL/OE.pm @@ -870,10 +870,6 @@ sub retrieve { Common::webdav_folder($form) if ($main::webdav); - # get tax zones - $query = qq|SELECT id, description FROM tax_zones|; - $form->{TAXZONE} = selectall_hashref_query($form, $dbh, $query); - my $rc = $dbh->commit; $dbh->disconnect; diff --git a/bin/mozilla/ct.pl b/bin/mozilla/ct.pl index 706860a1f..5bffd7c29 100644 --- a/bin/mozilla/ct.pl +++ b/bin/mozilla/ct.pl @@ -601,7 +601,8 @@ sub edit { sub form_header { $lxdebug->enter_sub(); - $form->get_lists("employees" => "ALL_SALESMEN"); + $form->get_lists("employees" => "ALL_SALESMEN", + "taxzones" => "ALL_TAXZONES"); $form->{taxincluded} = ($form->{taxincluded}) ? "checked" : ""; $form->{creditlimit} = @@ -644,23 +645,19 @@ sub form_header { } } - if (@{ $form->{TAXZONE} }) { - foreach $item (@{ $form->{TAXZONE} }) { - if ($item->{id} == $form->{taxzone_id}) { - $form->{selecttaxzone} .= - ""; - } else { - $form->{selecttaxzone} .= - ""; - } - - } - } else { - $form->{selecttaxzone} =~ s/ selected//g; - if ($form->{taxzone_id} ne "") { - $form->{selecttaxzone} =~ s/value=$form->{taxzone_id}/value=$form->{taxzone_id} selected/; - } + %labels = (); + @values = (); + foreach my $item (@{ $form->{"ALL_TAXZONES"} }) { + push(@values, $item->{"id"}); + $labels{$item->{"id"}} = $item->{"description"}; } - $taxzone = qq| - - | . $locale->text('Steuersatz') . qq| - - - |; - + if (!$form->{"id"}) { + $taxzone = qq| + + | . $locale->text('Steuersatz') . qq| + | . + NTI($cgi->popup_menu('-name' => 'taxzone_id', '-default' => $form->{"taxzone_id"}, + '-values' => \@values, '-labels' => \%labels)) . qq| + + |; + } else { + $taxzone = qq| + + | . $locale->text('Steuersatz') . qq| + + + | . H($labels{$form->{"taxzone_id"}}) . qq| + + |; + } $vendor = ($form->{selectvendor}) diff --git a/bin/mozilla/is.pl b/bin/mozilla/is.pl index 7da90713e..3d4857276 100644 --- a/bin/mozilla/is.pl +++ b/bin/mozilla/is.pl @@ -334,33 +334,6 @@ sub form_header { my $pjx = new CGI::Ajax( 'set_duedate' => $set_duedate_url ); push(@ { $form->{AJAX} }, $pjx); - if (@{ $form->{TAXZONE} }) { - $form->{selecttaxzone} = ""; - foreach $item (@{ $form->{TAXZONE} }) { - if ($item->{id} == $form->{taxzone_id}) { - $form->{selecttaxzone} .= - ""; - } else { - $form->{selecttaxzone} .= - ""; - } - - } - } else { - $form->{selecttaxzone} =~ s/ selected//g; - if ($form->{taxzone_id} ne "") { - $form->{selecttaxzone} =~ s/value=\"$form->{taxzone_id}\"/value=\"$form->{taxzone_id}\" selected/; - } - } - - $taxzone = qq| - - | . $locale->text('Steuersatz') . qq| - - - |; - my @old_project_ids = ($form->{"globalproject_id"}); map({ push(@old_project_ids, $form->{"project_id_$_"}) if ($form->{"project_id_$_"}); } (1..$form->{"rowcount"})); @@ -370,7 +343,8 @@ sub form_header { "projects" => { "key" => "ALL_PROJECTS", "all" => 0, "old_id" => \@old_project_ids }, - "employees" => "ALL_SALESMEN"); + "employees" => "ALL_SALESMEN", + "taxzones" => "ALL_TAXZONES"); my %labels; my @values = (undef); @@ -425,6 +399,34 @@ sub form_header { . qq| |; + %labels = (); + @values = (); + foreach my $item (@{ $form->{"ALL_TAXZONES"} }) { + push(@values, $item->{"id"}); + $labels{$item->{"id"}} = $item->{"description"}; + } + + if (!$form->{"id"}) { + $taxzone = qq| + + | . $locale->text('Steuersatz') . qq| + | . + NTI($cgi->popup_menu('-name' => 'taxzone_id', '-default' => $form->{"taxzone_id"}, + '-values' => \@values, '-labels' => \%labels)) . qq| + + |; + + } else { + $taxzone = qq| + + | . $locale->text('Steuersatz') . qq| + + + | . H($labels{$form->{"taxzone_id"}}) . qq| + + |; + } + # set option selected foreach $item (qw(AR customer currency department employee)) { $form->{"select$item"} =~ s/ selected//; diff --git a/bin/mozilla/oe.pl b/bin/mozilla/oe.pl index 8058585b9..1e0c8a6c6 100644 --- a/bin/mozilla/oe.pl +++ b/bin/mozilla/oe.pl @@ -431,7 +431,8 @@ sub form_header { "projects" => { "key" => "ALL_PROJECTS", "all" => 0, "old_id" => \@old_project_ids }, - "employees" => "ALL_SALESMEN"); + "employees" => "ALL_SALESMEN", + "taxzones" => "ALL_TAXZONES"); my %labels; my @values = (undef); @@ -489,6 +490,23 @@ sub form_header { |; } + + %labels = (); + @values = (); + foreach my $item (@{ $form->{"ALL_TAXZONES"} }) { + push(@values, $item->{"id"}); + $labels{$item->{"id"}} = $item->{"description"}; + } + + $taxzone = qq| + + | . $locale->text('Steuersatz') . qq| + | . + NTI($cgi->popup_menu('-name' => 'taxzone_id', '-default' => $form->{"taxzone_id"}, + '-values' => \@values, '-labels' => \%labels)) . qq| + + |; + $form->{exchangerate} = $form->format_amount(\%myconfig, $form->{exchangerate}); @@ -560,34 +578,6 @@ sub form_header { |; } - if (@{ $form->{TAXZONE} }) { - $form->{selecttaxzone} = ""; - foreach $item (@{ $form->{TAXZONE} }) { - if ($item->{id} == $form->{taxzone_id}) { - $form->{selecttaxzone} .= - ""; - } else { - $form->{selecttaxzone} .= - ""; - } - - } - } else { - $form->{selecttaxzone} =~ s/ selected//g; - if ($form->{taxzone_id} ne "") { - $form->{selecttaxzone} =~ s/value=$form->{taxzone_id}>/value=$form->{taxzone_id} selected>/; - } - } - - $taxzone = qq| - - | . $locale->text('Steuersatz') . qq| - - - |; - - if ($form->{type} !~ /_quotation$/) { $ordnumber = qq|