From: Thomas Kasulke Date: Mon, 23 Apr 2007 10:52:18 +0000 (+0000) Subject: history_search auf Buchungsnummern etcpp angepasst, so dass man auch gelöschte Daten... X-Git-Tag: release-2.4.3^2~476 X-Git-Url: http://wagnertech.de/git?a=commitdiff_plain;h=a0f6a00c1db8152633841777a95f5420b56b42ee;p=kivitendo-erp.git history_search auf Buchungsnummern etcpp angepasst, so dass man auch gelöschte Daten in der Historie suchen kann. Anpassungen innerhalb der Variablenübergabe: $form->{snumbers} muß beim speichern der history gesetzt werden (z.B. $form->{snumbers} = qq|invnumber_| . $form->{invnumber}; ) --- 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(); } diff --git a/bin/mozilla/ap.pl b/bin/mozilla/ap.pl index c5393a7e5..43a025fd2 100644 --- a/bin/mozilla/ap.pl +++ b/bin/mozilla/ap.pl @@ -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)); } diff --git a/bin/mozilla/ar.pl b/bin/mozilla/ar.pl index bb46fca55..05c541b61 100644 --- a/bin/mozilla/ar.pl +++ b/bin/mozilla/ar.pl @@ -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)); } diff --git a/bin/mozilla/ct.pl b/bin/mozilla/ct.pl index 6c119be5d..fec4e35f4 100644 --- a/bin/mozilla/ct.pl +++ b/bin/mozilla/ct.pl @@ -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)); } diff --git a/bin/mozilla/gl.pl b/bin/mozilla/gl.pl index 1ffcc5f02..ccfee8b22 100644 --- a/bin/mozilla/gl.pl +++ b/bin/mozilla/gl.pl @@ -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)); } diff --git a/bin/mozilla/ic.pl b/bin/mozilla/ic.pl index 22263dec8..ada06eeb9 100644 --- a/bin/mozilla/ic.pl +++ b/bin/mozilla/ic.pl @@ -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)); } diff --git a/bin/mozilla/io.pl b/bin/mozilla/io.pl index 9518e82c3..d85c367c2 100644 --- a/bin/mozilla/io.pl +++ b/bin/mozilla/io.pl @@ -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"; } diff --git a/bin/mozilla/ir.pl b/bin/mozilla/ir.pl index ac8b955f2..3f8812e18 100644 --- a/bin/mozilla/ir.pl +++ b/bin/mozilla/ir.pl @@ -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)); } diff --git a/bin/mozilla/is.pl b/bin/mozilla/is.pl index 8d70586d3..7da90713e 100644 --- a/bin/mozilla/is.pl +++ b/bin/mozilla/is.pl @@ -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)); } diff --git a/bin/mozilla/oe.pl b/bin/mozilla/oe.pl index 642ee5555..5a2f9dbe1 100644 --- a/bin/mozilla/oe.pl +++ b/bin/mozilla/oe.pl @@ -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)); } diff --git a/bin/mozilla/pe.pl b/bin/mozilla/pe.pl index 0a715600e..54eba9941 100644 --- a/bin/mozilla/pe.pl +++ b/bin/mozilla/pe.pl @@ -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)); } diff --git a/bin/mozilla/rp.pl b/bin/mozilla/rp.pl index e365c3304..391a90094 100644 --- a/bin/mozilla/rp.pl +++ b/bin/mozilla/rp.pl @@ -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));