X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=bin%2Fmozilla%2Fam.pl;h=02290c7b29c8617b1718830da64b3746acd09a31;hb=2efc8cbcc63c56094e0692067b7cb678c1583987;hp=77d8878ffdb1e7390b41a6e548830a8468eabded;hpb=a200453a04fc89fdf02dbe39e1d951cb1b55191c;p=kivitendo-erp.git diff --git a/bin/mozilla/am.pl b/bin/mozilla/am.pl index 77d8878ff..02290c7b2 100644 --- a/bin/mozilla/am.pl +++ b/bin/mozilla/am.pl @@ -427,13 +427,13 @@ sub list_account { $ca->{heading} = ( $ca->{charttype} eq 'H' ) ? 1:''; $ca->{link_edit_account} = qq|$form->{script}?action=edit_account&id=$ca->{id}| - .qq|&path=$form->{path}&login=$form->{login}| + .qq|&login=$form->{login}| .qq|&password=$form->{password}&callback=$callback|; } # Ajax my $list_account_details_url = - "$form->{script}?login=$form->{login}&path=$form->{path}" + "$form->{script}?login=$form->{login}" ."&password=$form->{password}&action=list_account_details&"; @@ -474,7 +474,7 @@ sub list_account_details { # construct callback $callback = - "$form->{script}?action=list_account&path=$form->{path}&login=$form->{login}&password=$form->{password}"; + "$form->{script}?action=list_account&login=$form->{login}&password=$form->{password}"; $form->header; @@ -3061,7 +3061,6 @@ sub show_am_history { $restriction .= " OR addition = '" . $_ . "'"; } } - $restriction .= (($form->{transdate} ne "" && $form->{reqdate} ne "") ? qq| AND st.itime::date >= '| . $form->{transdate} . qq|' AND st.itime::date <= '| . $form->{reqdate} . qq|'| : (($form->{transdate} ne "" && $form->{reqdate} eq "") @@ -3071,39 +3070,48 @@ sub show_am_history { : "" ) ); - + $restriction .= ($form->{mitarbeiter} eq "" ? "" + : ($form->{mitarbeiter} =~ /^[0-9]*$/ + ? " AND employee_id = " . $form->{mitarbeiter} + : " AND employee_id = " . &get_employee_id($form->{mitarbeiter}, $dbh))); + 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 trans_id AS id FROM history_erp WHERE sNumbers = '$searchSNumber' |; + my $query = qq|SELECT trans_id AS id FROM history_erp | . + ($form->{'searchid'} ? + qq| WHERE snumbers = '| . $searchNo{$form->{'what2search'}} . qq|_| . $form->{'searchid'} . qq|'| : + qq| WHERE snumbers ~ '^| . $searchNo{$form->{'what2search'}} . qq|'|); 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->{title} = $locale->text("History Search"); $form->header(); - my $daten = ""; - while(my $hash_ref = $sth->fetchrow_hashref()){ - $daten = $form->get_history($dbh,$hash_ref->{id},$restriction); + + my $i = 1; + my $daten = qq||; + while(my $hash_ref = $sth->fetchrow_hashref()){ + if($i) { + $daten .= $hash_ref->{id}; + $i = 0; + } + else { + $daten .= " OR trans_id = " . $hash_ref->{id}; + } } - $dbh->disconnect(); + + my ($sort, $sortby) = split(/\-\-/, $form->{order}); + $sort =~ s/.*\.(.*)$/$1/; + print $form->parse_html_template("/common/show_history", - {"DATEN" => $daten, - "SUCCESS" => ($daten != 0 ? 1 : 0), - "NONEWWINDOW" => 1 + {"DATEN" => $form->get_history($dbh, $daten, $restriction, $form->{order}), + "SUCCESS" => ($form->get_history($dbh, $daten, $restriction, $form->{order}) ne "0"), + "NONEWWINDOW" => 1, + uc($sort) => 1, + uc($sort)."BY" => $sortby }); - $lxdebug->leave_sub(); + $dbh->disconnect(); + $lxdebug->leave_sub(); } sub get_employee_id {