history_search auf Buchungsnummern etcpp angepasst, so dass man auch gelöschte Daten...
authorThomas Kasulke <t.kasulke@linet-services.de>
Mon, 23 Apr 2007 10:52:18 +0000 (10:52 +0000)
committerThomas Kasulke <t.kasulke@linet-services.de>
Mon, 23 Apr 2007 10:52:18 +0000 (10:52 +0000)
Anpassungen innerhalb der Variablenübergabe:
$form->{snumbers} muß beim speichern der history gesetzt werden (z.B. $form->{snumbers} = qq|invnumber_| . $form->{invnumber}; )

12 files changed:
bin/mozilla/am.pl
bin/mozilla/ap.pl
bin/mozilla/ar.pl
bin/mozilla/ct.pl
bin/mozilla/gl.pl
bin/mozilla/ic.pl
bin/mozilla/io.pl
bin/mozilla/ir.pl
bin/mozilla/is.pl
bin/mozilla/oe.pl
bin/mozilla/pe.pl
bin/mozilla/rp.pl

index 3396d93..b01f5f6 100644 (file)
@@ -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();
 }
 
index c5393a7..43a025f 100644 (file)
@@ -1075,6 +1075,7 @@ sub post {
   if (AP->post_transaction(\%myconfig, \%$form)) {
     # saving the history
     if(!exists $form->{addition} && $form->{id} ne "") {
+      $form->{snumber} = qq|invnumber_| . $form->{invnumber};
       $form->{addition} = "POSTED";
       $form->save_history($form->dbconnect(\%myconfig));
     }
@@ -1093,6 +1094,7 @@ sub post_as_new {
   $form->{postasnew} = 1;
   # saving the history
   if(!exists $form->{addition} && $form->{id} ne "") {
+    $form->{snumber} = qq|invnumber_| . $form->{invnumber};
        $form->{addition} = "POSTED AS NEW";
        $form->save_history($form->dbconnect(\%myconfig));
   }
@@ -1157,6 +1159,7 @@ sub yes {
   if (AP->delete_transaction(\%myconfig, \%$form, $spool)) {
     # saving the history
     if(!exists $form->{addition}) {
+      $form->{snumber} = qq|invnumber_| . $form->{invnumber};
          $form->{addition} = "DELETED";
       $form->save_history($form->dbconnect(\%myconfig));
     }
index bb46fca..05c541b 100644 (file)
@@ -79,6 +79,7 @@ sub add {
 
   # saving the history
   if(!exists $form->{addition} && ($form->{id} ne "")) {
+    $form->{snumber} = qq|invnumber_| . $form->{invnumber};
        $form->{addition} = "ADDED";
        $form->save_history($form->dbconnect(\%myconfig));
   }
@@ -1092,6 +1093,7 @@ sub post {
   if (AR->post_transaction(\%myconfig, \%$form)) {
     # saving the history
     if(!exists $form->{addition} && $form->{id} ne "") {
+      $form->{snumber} = qq|invnumber_| . $form->{invnumber};
          $form->{addition} = "POSTED";
          $form->save_history($form->dbconnect(\%myconfig));
     }
@@ -1110,6 +1112,7 @@ sub post_as_new {
   $form->{postasnew} = 1;
   # saving the history
   if(!exists $form->{addition} && $form->{id} ne "") {
+    $form->{snumber} = qq|invnumber_| . $form->{invnumber};
        $form->{addition} = "POSTED AS NEW";
        $form->save_history($form->dbconnect(\%myconfig));
   }
@@ -1174,6 +1177,7 @@ sub yes {
   if (AR->delete_transaction(\%myconfig, \%$form, $spool)) {
     # saving the history
     if(!exists $form->{addition}) {
+      $form->{snumber} = qq|invnumber_| . $form->{invnumber};
          $form->{addition} = "DELETED";
          $form->save_history($form->dbconnect(\%myconfig));
     }
index 6c119be..fec4e35 100644 (file)
@@ -1284,6 +1284,7 @@ sub save_and_ap_transaction {
   $form->{script} = "ap.pl";
   # saving the history
   if(!exists $form->{addition}) {
+    $form->{snumber} = qq|invnumber_| . $form->{invnumber};
        $form->{addition} = "SAVED";
        $form->save_history($form->dbconnect(\%myconfig));
   }
@@ -1298,6 +1299,7 @@ sub save_and_ar_transaction {
   $form->{script} = "ar.pl";
   # saving the history
   if(!exists $form->{addition}) {
+    $form->{snumber} = qq|invnumber_| . $form->{invnumber};
        $form->{addition} = "SAVED";
        $form->save_history($form->dbconnect(\%myconfig));
   }
@@ -1313,6 +1315,7 @@ sub save_and_invoice {
   $form->{type} = "invoice";
   # saving the history
   if(!exists $form->{addition}) {
+    $form->{snumber} = qq|invnumber_| . $form->{invnumber};
        $form->{addition} = "SAVED";
        $form->save_history($form->dbconnect(\%myconfig));
   }
@@ -1328,6 +1331,7 @@ sub save_and_rfq {
   $form->{type}   = "request_quotation";
   # saving the history
   if(!exists $form->{addition}) {
+    $form->{snumber} = qq|ordnumber_| . $form->{ordnumber};
        $form->{addition} = "SAVED";
        $form->save_history($form->dbconnect(\%myconfig));
   }
@@ -1343,6 +1347,7 @@ sub save_and_quotation {
   $form->{type}   = "sales_quotation";
   # saving the history
   if(!exists $form->{addition}) {
+    $form->{snumber} = qq|ordnumber_| . $form->{ordnumber};
        $form->{addition} = "SAVED";
        $form->save_history($form->dbconnect(\%myconfig));
   }
@@ -1359,6 +1364,7 @@ sub save_and_order {
     ($form->{db} eq 'customer') ? "sales_order" : "purchase_order";
   # saving the history
   if(!exists $form->{addition}) {
+    $form->{snumber} = qq|ordnumber_| . $form->{ordnumber};
        $form->{addition} = "SAVED";
        $form->save_history($form->dbconnect(\%myconfig));
   }
@@ -1387,7 +1393,8 @@ sub save_and_close {
   }
   # saving the history
   if(!exists $form->{addition}) {
-       $form->{addition} = "SAVED";
+    $form->{snumber} = ($form->{"db"} eq "customer" ? qq|customernumber_| . $form->{customernumber} : qq|vendornumber_| . $form->{vendornumber});
+    $form->{addition} = "SAVED";
        $form->save_history($form->dbconnect(\%myconfig));
   }
   # /saving the history
@@ -1423,6 +1430,7 @@ sub save {
   }
   # saving the history
   if(!exists $form->{addition}) {
+    $form->{snumber} = ($form->{"db"} eq "customer" ? qq|customernumber_| . $form->{customernumber} : qq|vendornumber_| . $form->{vendornumber});
        $form->{addition} = "SAVED";
        $form->save_history($form->dbconnect(\%myconfig));
   }
@@ -1446,6 +1454,7 @@ sub delete {
   $msg .= " deleted!";
   # saving the history
   if(!exists $form->{addition}) {
+    $form->{snumber} = ($form->{"db"} eq "customer" ? qq|customernumber_| . $form->{customernumber} : qq|vendornumber_| . $form->{vendornumber});
        $form->{addition} = "DELETED";
        $form->save_history($form->dbconnect(\%myconfig));
   }
index 1ffcc5f..ccfee8b 100644 (file)
@@ -1544,6 +1544,7 @@ sub yes {
   if (GL->delete_transaction(\%myconfig, \%$form)){
     # saving the history
       if(!exists $form->{addition} && $form->{id} ne "") {
+        $form->{snumber} = qq|ordnumber_| . $form->{ordnumber};
            $form->{addition} = "DELETED";
            $form->save_history($form->dbconnect(\%myconfig));
       }
@@ -1737,6 +1738,7 @@ sub post {
   undef($form->{callback});
   # saving the history
   if(!exists $form->{addition} && $form->{id} ne "") {
+    $form->{snumber} = qq|ordnumber_| . $form->{ordnumber};
        $form->{addition} = "SAVED";
        $form->{what_done} = $locale->text("Buchungsnummer") . " = " . $form->{id}; 
        $form->save_history($form->dbconnect(\%myconfig));
@@ -1763,6 +1765,7 @@ sub storno {
   $form->{storno} = 1;
   # saving the history
   if(!exists $form->{addition} && $form->{id} ne "") {
+    $form->{snumber} = qq|ordnumber_| . $form->{ordnumber};
        $form->{addition} = "STORNO";
        $form->save_history($form->dbconnect(\%myconfig));
   }
index 22263de..ada06ee 100644 (file)
@@ -3042,6 +3042,7 @@ sub save {
   }
   # saving the history
   if(!exists $form->{addition}) {
+    $form->{snumber} = qq|partnumber_| . $form->{partnumber};
        $form->{addition} = "SAVED";
        $form->save_history($form->dbconnect(\%myconfig));
   }
@@ -3164,6 +3165,7 @@ sub save_as_new {
 
   # saving the history
   if(!exists $form->{addition}) {
+    $form->{snumber} = qq|partnumber_| . $form->{partnumber};
        $form->{addition} = "SAVED AS NEW";
        $form->save_history($form->dbconnect(\%myconfig));
   }
@@ -3181,6 +3183,7 @@ sub delete {
   $lxdebug->enter_sub();
   # saving the history
   if(!exists $form->{addition}) {
+    $form->{snumber} = qq|partnumber_| . $form->{partnumber};
        $form->{addition} = "DELETED";
        $form->save_history($form->dbconnect(\%myconfig));
   }
index 9518e82..d85c367 100644 (file)
@@ -1716,6 +1716,7 @@ sub print_form {
       call_sub($display_form);
       # saving the history
          if(!exists $form->{addition}) {
+        $form->{snumber} = qq|ordnumber_| . $form->{ordnumber}; 
            $form->{addition} = "PRINTED";
            $form->save_history($form->dbconnect(\%myconfig));
       }
@@ -1908,6 +1909,7 @@ sub print_form {
 
 # saving the history
   if(!exists $form->{addition}) {
+    $form->{snumber} = qq|ordnumber_| . $form->{ordnumber};
     if($form->{media} =~ /printer/) {
        $form->{addition} = "PRINTED";
     }
index ac8b955..3f8812e 100644 (file)
@@ -1041,6 +1041,7 @@ sub post_payment {
        
        if(!exists $form->{addition} && $form->{id} ne "") {
                # saving the history
+      $form->{snumbers} = qq|invnumber|;  
                $form->{addition} = "PAYMENT POSTED";
                $form->save_history($form->dbconnect(\%myconfig));
                # /saving the history 
@@ -1104,7 +1105,8 @@ sub post {
   if (IR->post_invoice(\%myconfig, \%$form)){
        # saving the history
        if(!exists $form->{addition} && $form->{id} ne "") {
-               $form->{addition} = "POSTED";
+               $form->{snumbers} = qq|invnumber|;
+      $form->{addition} = "POSTED";
                #$form->{what_done} = $locale->text("Rechnungsnummer") . qq| | . $form->{invnumber};
                $form->save_history($form->dbconnect(\%myconfig));
        }
@@ -1157,6 +1159,7 @@ sub yes {
   if (IR->delete_invoice(\%myconfig, \%$form)) {
     # saving the history
     if(!exists $form->{addition}) {
+      $form->{snumbers} = qq|invnumber|;
          $form->{addition} = "DELETED";
          $form->save_history($form->dbconnect(\%myconfig));
     }
index 8d70586..7da9071 100644 (file)
@@ -1435,6 +1435,7 @@ sub post {
   remove_draft() if $form->{remove_draft};
 
   if(!exists $form->{addition}) {
+    $form->{snumbers} = qq|invnumber_| . $form->{invnumber};
     $form->{addition} = $print_post     ? "PRINTED AND POSTED" :
                         $form->{storno} ? "STORNO"             :
                                           "POSTED";
@@ -1611,6 +1612,7 @@ sub yes {
   if (IS->delete_invoice(\%myconfig, \%$form, $spool)) {
     # saving the history
        if(!exists $form->{addition}) {
+    $form->{snumbers} = qq|invnumber_| . $form->{invnumber}; 
          $form->{addition} = "DELETED";
          $form->save_history($form->dbconnect(\%myconfig));
     }
index 642ee55..5a2f9db 100644 (file)
@@ -1981,6 +1981,7 @@ sub save_and_close {
 
   # saving the history
   if(!exists $form->{addition}) {
+    $form->{snumber} = qq|ordnumber_| . $form->{ordnumber};
        $form->{addition} = "SAVED";
        $form->save_history($form->dbconnect(\%myconfig));
   }
@@ -2062,6 +2063,7 @@ sub save {
 
   # saving the history
   if(!exists $form->{addition}) {
+    $form->{snumber} = qq|ordnumber_| . $form->{ordnumber};
        $form->{addition} = "SAVED";
        $form->save_history($form->dbconnect(\%myconfig));
   }
@@ -2133,6 +2135,7 @@ sub yes {
     $form->redirect($msg);
     # saving the history
     if(!exists $form->{addition}) {
+      $form->{snumber} = qq|ordnumber_| . $form->{ordnumber};
          $form->{addition} = "DELETED";
          $form->save_history($form->dbconnect(\%myconfig));
     }
index 0a71560..54eba99 100644 (file)
@@ -467,6 +467,7 @@ sub save {
   }
   # saving the history
   if(!exists $form->{addition} && $form->{id} ne "") {
+    $form->{snumber} = qq|projectnumber_| . $form->{projectnumber};
        $form->{addition} = "SAVED";
        $form->save_history($form->dbconnect(\%myconfig));
   }
@@ -491,6 +492,7 @@ sub delete {
   }
   # saving the history
   if(!exists $form->{addition}) {
+    $form->{snumber} = qq|projectnumber_| . $form->{projectnumber};
        $form->{addition} = "DELETED";
        $form->save_history($form->dbconnect(\%myconfig));
   }
index e365c33..391a900 100644 (file)
@@ -2101,6 +2101,7 @@ sub print_form {
   }
   # saving the history
   if(!exists $form->{addition} && $form->{id} ne "") {
+    $form->{snumber} = qq|ordnumber_| . $form->{ordnumber};
        $form->{addition} = "PRINTED";
        $form->{what_done} = $form->{type};
        $form->save_history($form->dbconnect(\%myconfig));