Revision b4078ad9
Von Moritz Bunkus vor mehr als 15 Jahren hinzugefügt
bin/mozilla/am.pl | ||
---|---|---|
2837 | 2837 |
"Mahnungsnummer" => "dunning_id" |
2838 | 2838 |
); |
2839 | 2839 |
|
2840 |
my $restriction; |
|
2841 |
my $tempNo = 0; |
|
2842 |
foreach(split(/\,/, $form->{einschraenkungen})) { |
|
2843 |
if($tempNo == 0) { |
|
2844 |
$restriction .= " AND addition = '" . $_ . "'"; |
|
2845 |
$tempNo = 1; |
|
2846 |
} else { |
|
2847 |
$restriction .= " OR addition = '" . $_ . "'"; |
|
2848 |
} |
|
2849 |
} |
|
2840 |
my $dbh = $form->dbconnect(\%myconfig); |
|
2850 | 2841 |
|
2851 |
$restriction .= qq| AND h.itime::date >= | . conv_dateq($form->{fromdate}) if $form->{fromdate}; |
|
2852 |
$restriction .= qq| AND h.itime::date <= | . conv_dateq($form->{todate}) if $form->{todate}; |
|
2853 |
$restriction .= qq| AND employee_id = | . $form->{mitarbeiter} if $form->{mitarbeiter} =~ m/^\d+$/; |
|
2854 |
$restriction .= qq| AND employee_id = | . get_employee_id($form->{mitarbeiter}, $dbh) if $form->{mitarbeiter}; |
|
2842 |
my $restriction = qq| AND (| . join(' OR ', map { " addition = " . $dbh->quote($_) } split(m/\,/, $form->{einschraenkungen})) . qq|)| if $form->{einschraenkungen}; |
|
2843 |
$restriction .= qq| AND h.itime::date >= | . conv_dateq($form->{fromdate}) if $form->{fromdate}; |
|
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}; |
|
2855 | 2847 |
|
2856 |
my $dbh = $form->dbconnect(\%myconfig); |
|
2857 | 2848 |
my $query = qq|SELECT trans_id AS id FROM history_erp | . |
2858 | 2849 |
( $form->{'searchid'} ? qq| WHERE snumbers = '| . $searchNo{$form->{'what2search'}} . qq|_| . $form->{'searchid'} . qq|'| |
2859 | 2850 |
: qq| WHERE snumbers ~ '^| . $searchNo{$form->{'what2search'}} . qq|'|); |
Auch abrufbar als: Unified diff
Codevereinfachungen. Bugfixes für die falsche Verwendung der logischen SQL-Operatoren bezüglich ihrer Rangfolge.