X-Git-Url: http://wagnertech.de/gitweb/gitweb.cgi/mfinanz.git/blobdiff_plain/25160f38f3485069e768f84e7fa7d2adec8415bb..a0f6a00c1db8152633841777a95f5420b56b42ee:/bin/mozilla/am.pl diff --git a/bin/mozilla/am.pl b/bin/mozilla/am.pl index 3396d9316..b01f5f6bf 100644 --- a/bin/mozilla/am.pl +++ b/bin/mozilla/am.pl @@ -3134,33 +3134,36 @@ sub show_am_history { ); my $dbh = $form->dbconnect(\%myconfig); - + my $searchSNumber = $searchNo{$form->{'what2search'}} . qq|_| . $form->{'searchid'}; $restriction .= ($form->{mitarbeiter} eq "" ? "" : ($form->{mitarbeiter} =~ /^[0-9]*$/ ? " AND employee_id = " . $form->{mitarbeiter} : " AND employee_id = " . &get_employee_id($form->{mitarbeiter}, $dbh))); - - my $query = qq|SELECT id FROM $search{$form->{what2search}} - WHERE $searchNo{$form->{'what2search'}} ILIKE '$form->{"searchid"}' - |; - - my $sth = $dbh->prepare($query); + my $query = qq|SELECT trans_id AS id FROM history_erp WHERE sNumbers = '$searchSNumber' |; + + my $sth = $dbh->prepare($query); $sth->execute() || $form->dberror($query); + if($sth->fetch() <= 0) { + $sth->finish(); + my $query = qq|SELECT id FROM $search{$form->{what2search}} + WHERE $searchNo{$form->{'what2search'}} ILIKE '$form->{"searchid"}' + |; + } + $sth->execute() || $form->dberror($query); $form->{title} = $locale->text("History Search"); $form->header(); - + my @daten; while(my $hash_ref = $sth->fetchrow_hashref()){ - print $form->parse_html_template("/common/show_history", - {"DATEN" => $form->get_history($dbh,$hash_ref->{id},$restriction), - "SUCCESS" => ($form->get_history($dbh,$hash_ref->{id},$restriction) != 0), - "NONEWWINDOW" => "1" - } - ); - } + push(@daten, $form->get_history($dbh,$hash_ref->{id},$restriction)); + } $dbh->disconnect(); - + print $form->parse_html_template("/common/show_history", + {"DATEN" => @daten, + "SUCCESS" => (length(@daten) > 0), + "NONEWWINDOW" => 1 + }); $lxdebug->leave_sub(); }