From 168218647abacbfb5599be7beae82ae832cf2efb Mon Sep 17 00:00:00 2001 From: Thomas Kasulke Date: Fri, 25 May 2007 10:15:07 +0000 Subject: [PATCH] =?utf8?q?fix=20von=20salesmen=20und=20employee=20bzw.=20s?= =?utf8?q?plit=20in=20zwei=20eigenst=C3=A4ndige=20Funktionen=20durch=20get?= =?utf8?q?=5Flist=20aufgerufen.=20Fixing=20von=20Bug=20658?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- SL/Form.pm | 20 ++++++++++++++++++-- bin/mozilla/oe.pl | 46 +++++++++++++++++++++------------------------- 2 files changed, 39 insertions(+), 27 deletions(-) diff --git a/SL/Form.pm b/SL/Form.pm index 3719515c3..4472dfcc6 100644 --- a/SL/Form.pm +++ b/SL/Form.pm @@ -1409,8 +1409,8 @@ sub get_employee { my ($self, $dbh) = @_; my $query = qq|SELECT id, name FROM employee WHERE login = ?|; - ($self->{employee_id}, $self->{employee}) = selectrow_query($self, $dbh, $query, $self->{login}); - $self->{employee_id} *= 1; + ($self->{"employee_id"}, $self->{"employee"}) = selectrow_query($self, $dbh, $query, $self->{login}); + $self->{"employee_id"} *= 1; $main::lxdebug->leave_sub(); } @@ -1620,6 +1620,18 @@ sub _get_employees { $main::lxdebug->leave_sub(); } +sub _get_salesmen { + $main::lxdebug->enter_sub(); + + my ($self, $dbh, $key) = @_; + + $key = "all_salesmen" unless ($key); + $self->{$key} = + selectall_hashref_query($self, $dbh, qq|SELECT * FROM employee|); + + $main::lxdebug->leave_sub(); +} + sub _get_business_types { $main::lxdebug->enter_sub(); @@ -1779,6 +1791,10 @@ sub get_lists { if ($params{"employees"}) { $self->_get_employees($dbh, $params{"employees"}); } + + if ($params{"salesmen"}) { + $self->_get_salesmen($dbh, $params{"salesmen"}); + } if ($params{"business_types"}) { $self->_get_business_types($dbh, $params{"business_types"}); diff --git a/bin/mozilla/oe.pl b/bin/mozilla/oe.pl index e03e83eb1..ccc9ef173 100644 --- a/bin/mozilla/oe.pl +++ b/bin/mozilla/oe.pl @@ -374,7 +374,7 @@ sub form_header { } # set option selected - foreach $item ($form->{vc}, currency, department, employee, ($form->{vc} eq "customer" ? customer : vendor)) { + foreach $item ($form->{vc}, currency, department, ($form->{vc} eq "customer" ? customer : vendor)) { $form->{"select$item"} =~ s/ selected//; $form->{"select$item"} =~ s/option>\Q$form->{$item}\E/option selected>$form->{$item}/; @@ -396,7 +396,8 @@ sub form_header { "projects" => { "key" => "ALL_PROJECTS", "all" => 0, "old_id" => \@old_project_ids }, - "employees" => "ALL_SALESMEN", + "employees" => "ALL_EMPLOYEES", + "salesmen" => "ALL_SALESMEN", "taxzones" => "ALL_TAXZONES", "payments" => "ALL_PAYMENTS", "currencies" => "ALL_CURRENCIES", @@ -487,21 +488,20 @@ sub form_header { NTI($cgi->popup_menu('-name' => 'globalproject_id', '-values' => \@values, '-labels' => \%labels, '-default' => $form->{"globalproject_id"})); - - $salesman = ""; + + my $salesmen = ""; + %labels = (); + @values = (); if ($form->{type} =~ /^sales_/) { - %labels = (); - @values = (""); - foreach my $item (@{ $form->{ALL_SALESMEN} }) { - push(@values, $item->{id}); - $labels{$item->{id}} = $item->{name} ne "" ? $item->{name} : $item->{login}; + foreach my $item (@{ $form->{"ALL_SALESMEN"} }) { + push(@values, $item->{"id"}); + $labels{$item->{"id"}} = ($item->{"name"} ne "" ? $item->{"name"} : $item->{"login"}); } - - $salesman = + $salesmen = qq| | . $locale->text('Salesman') . qq| | . - NTI($cgi->popup_menu('-name' => 'salesman_id', '-default' => $form->{salesman_id}, + NTI($cgi->popup_menu('-name' => 'salesman_id', '-default' => $form->{"salesman_id"} ? $form->{"salesman_id"} : $form->{"employee_id"}, '-values' => \@values, '-labels' => \%labels)) . qq| |; @@ -509,16 +509,16 @@ sub form_header { %labels = (); @values = (); - foreach my $item (@{ $form->{"ALL_SALESMEN"} }) { + foreach my $item (@{ $form->{"ALL_EMPLOYEES"} }) { push(@values, $item->{"id"}); - $labels{$item->{"id"}} = $item->{"name"}; + $labels{$item->{"id"}} = $item->{"name"} ne "" ? $item->{"name"} : $item->{"login"}; } - my $employees = qq| + my $employee = qq| | . $locale->text('Employee') . qq| | . - NTI($cgi->popup_menu('-name' => 'employee', '-default' => $form->{"employee"}, + NTI($cgi->popup_menu('-name' => 'employee_id', '-default' => $form->{"employee_id"}, '-values' => \@values, '-labels' => \%labels)) . qq| |; @@ -707,16 +707,12 @@ sub form_header { if ($form->{type} eq 'sales_order') { if ($form->{selectemployee}) { - $employee = qq| - {customer_klass}> - $employees -|; + $employee .= qq| + |; } } else { - $employee = qq| - {customer_klass}> - $employees -|; + $employee .= qq| + |; } if ($form->{resubmit} && ($form->{format} eq "html")) { $onload = @@ -821,7 +817,7 @@ print qq| $openclosed $employee - $salesman + $salesmen $ordnumber -- 2.20.1
| . $locale->text('Project Number') . qq|