Verbesserung der Suchfunktionen der Historie und Visualisierung der Sortierreihenfolge.
authorThomas Kasulke <t.kasulke@linet-services.de>
Wed, 16 May 2007 14:25:47 +0000 (14:25 +0000)
committerThomas Kasulke <t.kasulke@linet-services.de>
Wed, 16 May 2007 14:25:47 +0000 (14:25 +0000)
SL/Form.pm
bin/mozilla/am.pl
bin/mozilla/common.pl
locale/de/all
templates/webpages/common/search_history_de.html
templates/webpages/common/search_history_master.html
templates/webpages/common/show_history_de.html
templates/webpages/common/show_history_master.html

index 537372a..7803fc3 100644 (file)
@@ -2488,12 +2488,13 @@ sub get_history {
       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});
index 3b47b8e..6294a18 100644 (file)
@@ -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,38 +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,$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 {
index 7f557fb..7c8b1e5 100644 (file)
@@ -538,12 +538,16 @@ sub reformat_numbers {
 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();
index aa7c06b..8a58212 100644 (file)
@@ -1226,6 +1226,7 @@ gestartet',
   'new Window'                  => 'neues Fenster',
   'none (pricegroup)'           => 'keine',
   'number'                      => 'Nummer',
+  'order'                       => 'Reihenfolge',
   'packing_list'                => 'Versandliste',
   'pick_list'                   => 'Entnahmeliste',
   'plural first char'           => 'P',
index bee9fee..775d1bc 100644 (file)
@@ -4,7 +4,7 @@
 <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>">
@@ -70,7 +70,7 @@
                                        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&auml;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";
                                                                }
index 46cc67a..d067a04 100644 (file)
@@ -4,7 +4,7 @@
 <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>">
@@ -70,7 +70,7 @@
                                        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";
                                                                }
index aa3ec40..a0b0e40 100644 (file)
 <table>
        <tr>
                <th class=listtop>
-                       &nbsp;<a href="javascript:orderBy('h.itime');">Zeitpunkt</a>&nbsp;
+                       &nbsp;<a href="javascript:orderBy('h.itime');">Zeitpunkt</a>&nbsp;<TMPL_IF NAME=ITIME><a title="Reihenfolge"><TMPL_IF NAME=ITIMEBY>&or;<TMPL_ELSE>&and;</TMPL_IF></a></TMPL_IF>&nbsp;
                </th>
                <th class=listtop>
-                       &nbsp;<a href="javascript:orderBy('emp.name');">Mitarbeiter</a>&nbsp;
+                       &nbsp;<a href="javascript:orderBy('emp.name');">Mitarbeiter</a>&nbsp;<TMPL_IF NAME=NAME><a title="Reihenfolge"><TMPL_IF NAME=NAMEBY>&or;<TMPL_ELSE>&and;</TMPL_IF></a></TMPL_IF>&nbsp;
                </th>
                <th class=listtop>
-                       &nbsp;<a href="javascript:orderBy('h.addition');">Aktion</a>&nbsp;
+                       &nbsp;<a href="">Aktion</a>&nbsp;
                </th>
                <th class=listtop>
-      &nbsp;<a href="javascript:orderBy('h.what_done');">Zusatz</a>&nbsp;
+      &nbsp;<a href="">Zusatz</a>&nbsp;
     </th>
     <th class=listtop>
-      &nbsp;<a href="javascript:orderBy('h.trans_id');">ID-Nummer (intern)</a>&nbsp;
+      &nbsp;<a href="javascript:orderBy('h.trans_id');">ID-Nummer (intern)</a>&nbsp;<TMPL_IF NAME=TRANS_ID><a title="Reihenfolge"><TMPL_IF NAME=TRANS_IDBY>&or;<TMPL_ELSE>&and;</TMPL_IF></a></TMPL_IF>&nbsp;
     </th>
     <th class=listtop>
-      &nbsp;<a href="javascript:orderBy('h.snumbers');">Buchungsnummer</a>&nbsp;
+      &nbsp;<a href="javascript:orderBy('h.snumbers');">Buchungsnummer</a>&nbsp;<TMPL_IF NAME=SNUMBERS><a title="Reihenfolge"><TMPL_IF NAME=SNUMBERSBY>&or;<TMPL_ELSE>&and;</TMPL_IF></a></TMPL_IF>&nbsp;
     </th>
        </tr>
 <TMPL_LOOP NAME=DATEN>
index b02d51e..a5db56a 100644 (file)
 <table>
        <tr>
                <th class=listtop>
-                       &nbsp;<a href="javascript:orderBy('h.itime');"><translate>Zeitpunkt</translate></a>&nbsp;
+                       &nbsp;<a href="javascript:orderBy('h.itime');"><translate>Zeitpunkt</translate></a>&nbsp;<TMPL_IF NAME=ITIME><a title="<translate>order</translate>"><TMPL_IF NAME=ITIMEBY>&or;<TMPL_ELSE>&and;</TMPL_IF></a></TMPL_IF>&nbsp;
                </th>
                <th class=listtop>
-                       &nbsp;<a href="javascript:orderBy('emp.name');"><translate>Mitarbeiter</translate></a>&nbsp;
+                       &nbsp;<a href="javascript:orderBy('emp.name');"><translate>Mitarbeiter</translate></a>&nbsp;<TMPL_IF NAME=NAME><a title="<translate>order</translate>"><TMPL_IF NAME=NAMEBY>&or;<TMPL_ELSE>&and;</TMPL_IF></a></TMPL_IF>&nbsp;
                </th>
                <th class=listtop>
-                       &nbsp;<a href="javascript:orderBy('h.addition');"><translate>Aktion</translate></a>&nbsp;
+                       &nbsp;<a href=""><translate>Aktion</translate></a>&nbsp;
                </th>
                <th class=listtop>
-      &nbsp;<a href="javascript:orderBy('h.what_done');"><translate>Zusatz</translate></a>&nbsp;
+      &nbsp;<a href=""><translate>Zusatz</translate></a>&nbsp;
     </th>
     <th class=listtop>
-      &nbsp;<a href="javascript:orderBy('h.trans_id');"><translate>ID-Nummer</translate></a>&nbsp;
+      &nbsp;<a href="javascript:orderBy('h.trans_id');"><translate>ID-Nummer</translate></a>&nbsp;<TMPL_IF NAME=TRANS_ID><a title="<translate>order</translate>"><TMPL_IF NAME=TRANS_IDBY>&or;<TMPL_ELSE>&and;</TMPL_IF></a></TMPL_IF>&nbsp;
     </th>
     <th class=listtop>
-      &nbsp;<a href="javascript:orderBy('h.snumbers');"><translate>Belegnummer</translate></a>&nbsp;
+      &nbsp;<a href="javascript:orderBy('h.snumbers');"><translate>Belegnummer</translate></a>&nbsp;<TMPL_IF NAME=SNUMBERS><a title="<translate>order</translate>"><TMPL_IF NAME=SNUMBERSBY>&or;<TMPL_ELSE>&and;</TMPL_IF></a></TMPL_IF>&nbsp;
     </th>
        </tr>
 <TMPL_LOOP NAME=DATEN>