From: Thomas Kasulke Date: Fri, 25 May 2007 12:11:39 +0000 (+0000) Subject: Bindestriche und ID aus den PopupMenus entfernt und in der FOrm.pm die Speicherung... X-Git-Tag: release-2.4.3^2~254 X-Git-Url: http://wagnertech.de/git?a=commitdiff_plain;h=e7367fb51e706abc8c54495e1623a5e1d2aca7fa;p=kivitendo-erp.git Bindestriche und ID aus den PopupMenus entfernt und in der FOrm.pm die Speicherung der Historie angepasst, damit nur der aktuell eingeloggte Bearbeiter gespeichert wird und somit Manipulationen vermieden werden können. --- diff --git a/SL/Form.pm b/SL/Form.pm index 4472dfcc6..921832edd 100644 --- a/SL/Form.pm +++ b/SL/Form.pm @@ -2496,12 +2496,12 @@ sub save_history { &get_employee($self, $dbh); } - my $query = - qq|INSERT INTO history_erp (trans_id, employee_id, addition, what_done, snumbers) | . - qq|VALUES (?, ?, ?, ?, ?)|; - my @values = (conv_i($self->{id}), conv_i($self->{employee_id}), - $self->{addition}, $self->{what_done}, "$self->{snumbers}"); - do_query($self, $dbh, $query, @values); +my $query = + qq|INSERT INTO history_erp (trans_id, employee_id, addition, what_done, snumbers) | . + qq|VALUES (?, (SELECT id FROM employee WHERE login = ?), ?, ?, ?)|; + my @values = (conv_i($self->{id}), $self->{login}, + $self->{addition}, $self->{what_done}, "$self->{snumbers}"); + do_query($self, $dbh, $query, @values); $main::lxdebug->leave_sub(); } diff --git a/bin/mozilla/ir.pl b/bin/mozilla/ir.pl index c9624ccb3..9102b4377 100644 --- a/bin/mozilla/ir.pl +++ b/bin/mozilla/ir.pl @@ -351,7 +351,7 @@ sub form_header { my $i = 0; foreach my $item (@{ $form->{"ALL_VENDORS"} }) { push(@values, $item->{name}.qq|--|.$item->{"id"}); - $labels{$item->{"id"}} = $item->{"name"}.qq|--|.$item->{"id"}; + $labels{$item->{name}.qq|--|.$item->{"id"}} = $item->{"name"}; } my $vendors = qq| | . $locale->text('Vendor') . qq| diff --git a/bin/mozilla/is.pl b/bin/mozilla/is.pl index 7c0055582..2cbf9cd3f 100644 --- a/bin/mozilla/is.pl +++ b/bin/mozilla/is.pl @@ -374,7 +374,7 @@ sub form_header { @values = (); foreach my $item (@{ $form->{"ALL_CUSTOMERS"} }) { push(@values, $item->{name}.qq|--|.$item->{"id"}); - $labels{$item->{"id"}} = $item->{name}.qq|--|.$item->{"id"}; + $labels{$item->{name}.qq|--|.$item->{"id"}} = $item->{"name"}; } my $customers = qq| diff --git a/bin/mozilla/oe.pl b/bin/mozilla/oe.pl index ccc9ef173..10152d736 100644 --- a/bin/mozilla/oe.pl +++ b/bin/mozilla/oe.pl @@ -428,8 +428,8 @@ sub form_header { @values = (); foreach my $item (@{ $form->{($form->{vc} eq "customer" ? "ALL_CUSTOMERS" : "ALL_VENDORS")}}) { - push(@values, $item->{name}.qq|--|.$item->{"id"}); - $labels{$item->{"id"}} = $item->{name}.qq|--|.$item->{"id"}; + push(@values, $item->{"name"}.qq|--|.$item->{"id"}); + $labels{$item->{"name"}.qq|--|.$item->{"id"}} = $item->{name}; } $vc = qq| @@ -438,7 +438,7 @@ sub form_header { | . $locale->text(ucfirst($form->{vc})) . qq| | . (($myconfig{vclimit} <= scalar(@values)) - ? qq|{vc}"}) . qq|" name="$form->{vc}">| + ? qq|{vc}"} =~ /^(.*)\-\-.*$/)) . qq|" name="$form->{vc}">| : (NTI($cgi->popup_menu('-name' => "$form->{vc}", '-default' => $form->{"old$form->{vc}"}, '-onChange' => 'document.getElementById(\'update_button\').click();', '-values' => \@values, '-labels' => \%labels, '-style' => 'width: 250px')))) . qq| @@ -1386,6 +1386,7 @@ sub search { $form->get_lists("projects" => { "key" => "ALL_PROJECTS", "all" => 1 }, + "employees" => "ALL_EMPLOYEES", $vc => "ALL_" . uc($vc)); my %labels = (); @@ -1398,24 +1399,40 @@ sub search { NTI($cgi->popup_menu('-name' => 'project_id', '-values' => \@values, '-labels' => \%labels)); + #employees + %labels = (); + @values = (); + foreach my $item (@{ $form->{"ALL_EMPLOYEES"} }) { + push(@values, $item->{"id"}); + $labels{$item->{"id"}} = $item->{"name"} ne "" ? $item->{"name"} : $item->{"login"}; + } + + my $employee = qq| + + | . $locale->text('Employee') . qq| + | . + NTI($cgi->popup_menu('-name' => 'employee_id', '-default' => $form->{"employee_id"}, + '-values' => \@values, '-labels' => \%labels)) . qq| + + |; + %labels = (); @values = (""); foreach my $item (@{ $form->{($form->{vc} eq "customer" ? "ALL_CUSTOMERS" : "ALL_VENDORS")}}) { push(@values, $item->{name}.qq|--|.$item->{"id"}); - $labels{$item->{"id"}} = $item->{name}.qq|--|.$item->{"id"}; + $labels{$item->{name}.qq|--|.$item->{"id"}} = $item->{"name"}; } my $vc_label = $form->{vc} eq "customer" ? $locale->text('Customer') : $locale->text('Vendor'); $vc = $myconfig{vclimit} <= scalar(@values) - ? qq|{vc}"}) . qq|" name="$form->{vc}">| + ? qq|{vc}"} =~ /^(.*)\-\-.*$/)) . qq|" name="$form->{vc}">| : NTI($cgi->popup_menu('-name' => "$form->{vc}", '-default' => $form->{"old$form->{vc}"}, '-onChange' => 'document.getElementById(\'update_button\').click();', '-values' => \@values, '-labels' => \%labels)); - $form->header; print qq| @@ -1440,6 +1457,7 @@ sub search { $ordlabel + $employee | . $locale->text('Transaction description') . qq|