qq|SELECT h.employee_id, h.itime::timestamp(0) AS itime, h.addition, h.what_done, emp.name, h.snumbers, h.trans_id AS id | .
qq|FROM history_erp h | .
qq|LEFT JOIN employee emp ON (emp.id = h.employee_id) | .
- qq|WHERE trans_id = ? |. $order
- . $restriction;
-
+ qq|WHERE trans_id = | . $trans_id
+ . $restriction . qq| |
+ . $order;
+
my $sth = $dbh->prepare($query) || $self->dberror($query);
- $sth->execute($trans_id) || $self->dberror("$query ($trans_id)");
+ $sth->execute() || $self->dberror("$query");
while(my $hash_ref = $sth->fetchrow_hashref()) {
$hash_ref->{addition} = $main::locale->text($hash_ref->{addition});
$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 "")
: ""
)
);
+ $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,$form->{order});
+
+ 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 {
sub show_history {
$lxdebug->enter_sub();
my $dbh = $form->dbconnect(\%myconfig);
-
+ my ($sort, $sortby) = split(/\-\-/, $form->{order});
+ $sort =~ s/.*\.(.*)/$1/;
+
$form->{title} = $locale->text("History");
$form->header();
print $form->parse_html_template( "common/show_history", {
- "DATEN" => $form->get_history($dbh,$form->{input_name}),
- "SUCCESS" => ($form->get_history($dbh,$form->{input_name}) ne "0")
+ "DATEN" => $form->get_history($dbh,$form->{input_name},"",$form->{order}),
+ "SUCCESS" => ($form->get_history($dbh,$form->{input_name}) ne "0"),
+ uc($sort) => 1,
+ uc($sort)."BY" => $sortby
} );
$dbh->disconnect();
'new Window' => 'neues Fenster',
'none (pricegroup)' => 'keine',
'number' => 'Nummer',
+ 'order' => 'Reihenfolge',
'packing_list' => 'Versandliste',
'pick_list' => 'Entnahmeliste',
'plural first char' => 'P',
<script type="text/javascript" src="js/jscalendar/calendar-setup.js"></script>
<script type="text/javascript" src="js/show_am_history.js"></script>
-<form method="post" onSubmit="javascript:set_history_uri();"<!--action="<TMPL_VAR NAME=script ESCAPE=HTML>"-->>
+<form method="post" onSubmit="javascript:set_history_uri();">
<input type="hidden" name="login" value="<TMPL_VAR NAME=login ESCAPE=HTML>">
<input type="hidden" name="password" value="<TMPL_VAR NAME=password ESCAPE=HTML>">
var tempString = "";
function addForm(last, remove) {
if(last == "INIT") {
- tempString = "<select id='selectForm'>";
+ tempString = "<select id='selectForm'><option></option>";
for(i=0;i<defaults.length;i++) {
tempString += "\<option value\=\'" + defaults[i] + "\'\ onClick=\"javascript:addForm(\'" + defaults[i] + "\', " + i + ");\">" + translated[defaults[i]] + "\<\/option\>" + "\n";
}
document.getElementById('inputText').innerHTML += ((document.getElementById('inputText').innerHTML == "") ? ("<b>Sie haben bereits die folgenden Einschränkungen vorgenommen:</b><br>") : ("<br>")) + translated[last];
if(defaults.length > 0) {
document.getElementById('einschraenkungen').value += ((document.getElementById('einschraenkungen').value == "") ? ("") : (",")) + last;
- tempString = "<select id='selectForm'>";
+ tempString = "<select id='selectForm'><option></option>";
for(i=0;i<defaults.length;i++) {
tempString += "\<option value\=\'" + defaults[i] + "\'\ onClick=\"javascript:addForm(\'" + defaults[i] + "\', " + i + ");\">" + translated[defaults[i]] + "\<\/option\>" + "\n";
}
<script type="text/javascript" src="js/jscalendar/calendar-setup.js"></script>
<script type="text/javascript" src="js/show_am_history.js"></script>
-<form method="post" onSubmit="javascript:set_history_uri();"<!--action="<TMPL_VAR NAME=script ESCAPE=HTML>"-->>
+<form method="post" onSubmit="javascript:set_history_uri();">
<input type="hidden" name="login" value="<TMPL_VAR NAME=login ESCAPE=HTML>">
<input type="hidden" name="password" value="<TMPL_VAR NAME=password ESCAPE=HTML>">
var tempString = "";
function addForm(last, remove) {
if(last == "INIT") {
- tempString = "<select id='selectForm'>";
+ tempString = "<select id='selectForm'><option></option>";
for(i=0;i<defaults.length;i++) {
tempString += "\<option value\=\'" + defaults[i] + "\'\ onClick=\"javascript:addForm(\'" + defaults[i] + "\', " + i + ");\">" + translated[defaults[i]] + "\<\/option\>" + "\n";
}
document.getElementById('inputText').innerHTML += ((document.getElementById('inputText').innerHTML == "") ? ("<b><translate>You've already chosen the following limitations:</translate></b><br>") : ("<br>")) + translated[last];
if(defaults.length > 0) {
document.getElementById('einschraenkungen').value += ((document.getElementById('einschraenkungen').value == "") ? ("") : (",")) + last;
- tempString = "<select id='selectForm'>";
+ tempString = "<select id='selectForm'><option></option>";
for(i=0;i<defaults.length;i++) {
tempString += "\<option value\=\'" + defaults[i] + "\'\ onClick=\"javascript:addForm(\'" + defaults[i] + "\', " + i + ");\">" + translated[defaults[i]] + "\<\/option\>" + "\n";
}
<table>
<tr>
<th class=listtop>
- <a href="javascript:orderBy('h.itime');">Zeitpunkt</a>
+ <a href="javascript:orderBy('h.itime');">Zeitpunkt</a> <TMPL_IF NAME=ITIME><a title="Reihenfolge"><TMPL_IF NAME=ITIMEBY>∨<TMPL_ELSE>∧</TMPL_IF></a></TMPL_IF>
</th>
<th class=listtop>
- <a href="javascript:orderBy('emp.name');">Mitarbeiter</a>
+ <a href="javascript:orderBy('emp.name');">Mitarbeiter</a> <TMPL_IF NAME=NAME><a title="Reihenfolge"><TMPL_IF NAME=NAMEBY>∨<TMPL_ELSE>∧</TMPL_IF></a></TMPL_IF>
</th>
<th class=listtop>
- <a href="javascript:orderBy('h.addition');">Aktion</a>
+ <a href="">Aktion</a>
</th>
<th class=listtop>
- <a href="javascript:orderBy('h.what_done');">Zusatz</a>
+ <a href="">Zusatz</a>
</th>
<th class=listtop>
- <a href="javascript:orderBy('h.trans_id');">ID-Nummer (intern)</a>
+ <a href="javascript:orderBy('h.trans_id');">ID-Nummer (intern)</a> <TMPL_IF NAME=TRANS_ID><a title="Reihenfolge"><TMPL_IF NAME=TRANS_IDBY>∨<TMPL_ELSE>∧</TMPL_IF></a></TMPL_IF>
</th>
<th class=listtop>
- <a href="javascript:orderBy('h.snumbers');">Buchungsnummer</a>
+ <a href="javascript:orderBy('h.snumbers');">Buchungsnummer</a> <TMPL_IF NAME=SNUMBERS><a title="Reihenfolge"><TMPL_IF NAME=SNUMBERSBY>∨<TMPL_ELSE>∧</TMPL_IF></a></TMPL_IF>
</th>
</tr>
<TMPL_LOOP NAME=DATEN>
<table>
<tr>
<th class=listtop>
- <a href="javascript:orderBy('h.itime');"><translate>Zeitpunkt</translate></a>
+ <a href="javascript:orderBy('h.itime');"><translate>Zeitpunkt</translate></a> <TMPL_IF NAME=ITIME><a title="<translate>order</translate>"><TMPL_IF NAME=ITIMEBY>∨<TMPL_ELSE>∧</TMPL_IF></a></TMPL_IF>
</th>
<th class=listtop>
- <a href="javascript:orderBy('emp.name');"><translate>Mitarbeiter</translate></a>
+ <a href="javascript:orderBy('emp.name');"><translate>Mitarbeiter</translate></a> <TMPL_IF NAME=NAME><a title="<translate>order</translate>"><TMPL_IF NAME=NAMEBY>∨<TMPL_ELSE>∧</TMPL_IF></a></TMPL_IF>
</th>
<th class=listtop>
- <a href="javascript:orderBy('h.addition');"><translate>Aktion</translate></a>
+ <a href=""><translate>Aktion</translate></a>
</th>
<th class=listtop>
- <a href="javascript:orderBy('h.what_done');"><translate>Zusatz</translate></a>
+ <a href=""><translate>Zusatz</translate></a>
</th>
<th class=listtop>
- <a href="javascript:orderBy('h.trans_id');"><translate>ID-Nummer</translate></a>
+ <a href="javascript:orderBy('h.trans_id');"><translate>ID-Nummer</translate></a> <TMPL_IF NAME=TRANS_ID><a title="<translate>order</translate>"><TMPL_IF NAME=TRANS_IDBY>∨<TMPL_ELSE>∧</TMPL_IF></a></TMPL_IF>
</th>
<th class=listtop>
- <a href="javascript:orderBy('h.snumbers');"><translate>Belegnummer</translate></a>
+ <a href="javascript:orderBy('h.snumbers');"><translate>Belegnummer</translate></a> <TMPL_IF NAME=SNUMBERS><a title="<translate>order</translate>"><TMPL_IF NAME=SNUMBERSBY>∨<TMPL_ELSE>∧</TMPL_IF></a></TMPL_IF>
</th>
</tr>
<TMPL_LOOP NAME=DATEN>