Revision 651e8d51
Von Moritz Bunkus vor mehr als 15 Jahren hinzugefügt
bin/mozilla/am.pl | ||
---|---|---|
2842 | 2842 |
my $restriction = qq| AND (| . join(' OR ', map { " addition = " . $dbh->quote($_) } split(m/\,/, $form->{einschraenkungen})) . qq|)| if $form->{einschraenkungen}; |
2843 | 2843 |
$restriction .= qq| AND h.itime::date >= | . conv_dateq($form->{fromdate}) if $form->{fromdate}; |
2844 | 2844 |
$restriction .= qq| AND h.itime::date <= | . conv_dateq($form->{todate}) if $form->{todate}; |
2845 |
$restriction .= qq| AND employee_id = | . $form->{mitarbeiter} if $form->{mitarbeiter} =~ m/^\d+$/; |
|
2846 |
$restriction .= qq| AND employee_id = | . get_employee_id($form->{mitarbeiter}, $dbh) if $form->{mitarbeiter}; |
|
2845 |
if ($form->{mitarbeiter} =~ m/^\d+$/) { |
|
2846 |
$restriction .= qq| AND employee_id = | . $form->{mitarbeiter}; |
|
2847 |
} elsif ($form->{mitarbeiter}) { |
|
2848 |
$restriction .= qq| AND employee_id = (SELECT id FROM employee WHERE name ILIKE | . $dbh->quote('%' . $form->{mitarbeiter} . '%') . qq|)|; |
|
2849 |
} |
|
2847 | 2850 |
|
2848 | 2851 |
my $query = qq|SELECT trans_id AS id FROM history_erp | . |
2849 | 2852 |
( $form->{'searchid'} ? qq| WHERE snumbers = '| . $searchNo{$form->{'what2search'}} . qq|_| . $form->{'searchid'} . qq|'| |
... | ... | |
2871 | 2874 |
$lxdebug->leave_sub(); |
2872 | 2875 |
} |
2873 | 2876 |
|
2874 |
sub get_employee_id { |
|
2875 |
$lxdebug->enter_sub(); |
|
2876 |
|
|
2877 |
$auth->assert('config'); |
|
2878 |
|
|
2879 |
my $query = qq|SELECT id FROM employee WHERE name = '| . $_[0] . qq|'|; |
|
2880 |
my $sth = $_[1]->prepare($query); |
|
2881 |
$sth->execute() || $form->dberror($query); |
|
2882 |
my $return = $sth->fetch(); |
|
2883 |
$sth->finish(); |
|
2884 |
return ${$return}[0]; |
|
2885 |
$lxdebug->leave_sub(); |
|
2886 |
} |
|
2887 |
|
|
2888 | 2877 |
sub swap_units { |
2889 | 2878 |
$lxdebug->enter_sub(); |
2890 | 2879 |
|
Auch abrufbar als: Unified diff
Suchfeld "Mitarbeiter" in der Historiensuchmaschine wieder funktionabel gemacht.