From: Moritz Bunkus Date: Wed, 6 May 2009 13:33:15 +0000 (+0000) Subject: Suchfeld "Mitarbeiter" in der Historiensuchmaschine wieder funktionabel gemacht. X-Git-Tag: release-2.6.0beta2~15 X-Git-Url: http://wagnertech.de/git?a=commitdiff_plain;h=651e8d51f656789ec224ce12986ed9d45b652434;p=kivitendo-erp.git Suchfeld "Mitarbeiter" in der Historiensuchmaschine wieder funktionabel gemacht. --- diff --git a/bin/mozilla/am.pl b/bin/mozilla/am.pl index fafe65684..b38236052 100644 --- a/bin/mozilla/am.pl +++ b/bin/mozilla/am.pl @@ -2842,8 +2842,11 @@ sub show_am_history { my $restriction = qq| AND (| . join(' OR ', map { " addition = " . $dbh->quote($_) } split(m/\,/, $form->{einschraenkungen})) . qq|)| if $form->{einschraenkungen}; $restriction .= qq| AND h.itime::date >= | . conv_dateq($form->{fromdate}) if $form->{fromdate}; $restriction .= qq| AND h.itime::date <= | . conv_dateq($form->{todate}) if $form->{todate}; - $restriction .= qq| AND employee_id = | . $form->{mitarbeiter} if $form->{mitarbeiter} =~ m/^\d+$/; - $restriction .= qq| AND employee_id = | . get_employee_id($form->{mitarbeiter}, $dbh) if $form->{mitarbeiter}; + if ($form->{mitarbeiter} =~ m/^\d+$/) { + $restriction .= qq| AND employee_id = | . $form->{mitarbeiter}; + } elsif ($form->{mitarbeiter}) { + $restriction .= qq| AND employee_id = (SELECT id FROM employee WHERE name ILIKE | . $dbh->quote('%' . $form->{mitarbeiter} . '%') . qq|)|; + } my $query = qq|SELECT trans_id AS id FROM history_erp | . ( $form->{'searchid'} ? qq| WHERE snumbers = '| . $searchNo{$form->{'what2search'}} . qq|_| . $form->{'searchid'} . qq|'| @@ -2871,20 +2874,6 @@ sub show_am_history { $lxdebug->leave_sub(); } -sub get_employee_id { - $lxdebug->enter_sub(); - - $auth->assert('config'); - - my $query = qq|SELECT id FROM employee WHERE name = '| . $_[0] . qq|'|; - my $sth = $_[1]->prepare($query); - $sth->execute() || $form->dberror($query); - my $return = $sth->fetch(); - $sth->finish(); - return ${$return}[0]; - $lxdebug->leave_sub(); -} - sub swap_units { $lxdebug->enter_sub(); diff --git a/locale/de/am b/locale/de/am index ebce22afb..90ea10a3f 100644 --- a/locale/de/am +++ b/locale/de/am @@ -410,7 +410,6 @@ $self->{subs} = { 'edit_warehouse' => 'edit_warehouse', 'form_footer' => 'form_footer', 'format_dates' => 'format_dates', - 'get_employee_id' => 'get_employee_id', 'gl_transaction' => 'gl_transaction', 'language_header' => 'language_header', 'lead_header' => 'lead_header',