save_history sollte NICHT jedesmal eine neue datenbankverbindung aufmachen.
authorSven Schöling <s.schoeling@linet-services.de>
Wed, 21 Jul 2010 12:45:17 +0000 (14:45 +0200)
committerSven Schöling <s.schoeling@linet-services.de>
Wed, 21 Jul 2010 12:45:17 +0000 (14:45 +0200)
16 files changed:
SL/CP.pm
SL/Form.pm
bin/mozilla/ap.pl
bin/mozilla/ar.pl
bin/mozilla/ct.pl
bin/mozilla/dn.pl
bin/mozilla/do.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/projects.pl
bin/mozilla/rp.pl

index f6c8c1a..fbfd6fa 100644 (file)
--- a/SL/CP.pm
+++ b/SL/CP.pm
@@ -360,7 +360,7 @@ sub process_payment {
       if(!exists $form->{addition}) {
         $form->{snumbers} = qq|invnumber_| . $form->{"invnumber_$i"};
         $form->{addition} = "POSTED";
-        $form->save_history($form->dbconnect($myconfig));
+        $form->save_history;
       }
       # /saving the history
     }
index 6d2ae49..6318242 100644 (file)
@@ -3235,8 +3235,8 @@ sub save_status {
 sub save_history {
   $main::lxdebug->enter_sub();
 
-  my $self = shift();
-  my $dbh = shift();
+  my $self = shift;
+  my $dbh  = shift || $self->get_standard_dbh;
 
   if(!exists $self->{employee_id}) {
     &get_employee($self, $dbh);
@@ -3249,6 +3249,8 @@ sub save_history {
                 $self->{addition}, $self->{what_done}, "$self->{snumbers}");
   do_query($self, $dbh, $query, @values);
 
+  $dbh->commit;
+
   $main::lxdebug->leave_sub();
 }
 
index ae2bda3..8b32585 100644 (file)
@@ -1081,7 +1081,7 @@ sub post {
     if(!exists $form->{addition} && $form->{id} ne "") {
       $form->{snumbers} = qq|invnumber_| . $form->{invnumber};
       $form->{addition} = "POSTED";
-      $form->save_history($form->dbconnect(\%myconfig));
+      $form->save_history;
     }
     # /saving the history
     remove_draft() if $form->{remove_draft};
@@ -1107,7 +1107,7 @@ sub post_as_new {
   if(!exists $form->{addition} && $form->{id} ne "") {
     $form->{snumbers} = qq|invnumber_| . $form->{invnumber};
     $form->{addition} = "POSTED AS NEW";
-    $form->save_history($form->dbconnect(\%myconfig));
+    $form->save_history;
   }
   # /saving the history
   &post;
@@ -1190,7 +1190,7 @@ sub yes {
     if(!exists $form->{addition}) {
       $form->{snumbers} = qq|invnumber_| . $form->{invnumber};
       $form->{addition} = "DELETED";
-      $form->save_history($form->dbconnect(\%myconfig));
+      $form->save_history;
     }
     # /saving the history
     $form->redirect($locale->text('Transaction deleted!'));
@@ -1433,7 +1433,7 @@ sub storno {
   if(!exists $form->{addition} && $form->{id} ne "") {
     $form->{snumbers} = "ordnumber_$form->{ordnumber}";
     $form->{addition} = "STORNO";
-    $form->save_history($form->dbconnect(\%myconfig));
+    $form->save_history;
   }
   # /saving the history
 
index be99f54..35f23d6 100644 (file)
@@ -90,7 +90,7 @@ sub add {
   if(!exists $form->{addition} && ($form->{id} ne "")) {
     $form->{snumbers} = qq|invnumber_| . $form->{invnumber};
     $form->{addition} = "ADDED";
-    $form->save_history($form->dbconnect(\%myconfig));
+    $form->save_history;
   }
   # /saving the history
 
@@ -1140,7 +1140,7 @@ sub post {
   if(!exists $form->{addition} && $form->{id} ne "") {
     $form->{snumbers} = "invnumber_$form->{invnumber}";
     $form->{addition} = "POSTED";
-    $form->save_history($form->dbconnect(\%myconfig));
+    $form->save_history;
   }
   # /saving the history
   remove_draft() if $form->{remove_draft};
@@ -1163,7 +1163,7 @@ sub post_as_new {
   if(!exists $form->{addition} && $form->{id} ne "") {
     $form->{snumbers} = qq|invnumber_| . $form->{invnumber};
     $form->{addition} = "POSTED AS NEW";
-    $form->save_history($form->dbconnect(\%myconfig));
+    $form->save_history;
   }
   # /saving the history
   &post;
@@ -1246,7 +1246,7 @@ sub yes {
     if(!exists $form->{addition}) {
       $form->{snumbers} = qq|invnumber_| . $form->{invnumber};
       $form->{addition} = "DELETED";
-      $form->save_history($form->dbconnect(\%myconfig));
+      $form->save_history;
     }
     # /saving the history
     $form->redirect($locale->text('Transaction deleted!'));
@@ -1520,7 +1520,7 @@ sub storno {
   if(!exists $form->{addition} && $form->{id} ne "") {
     $form->{snumbers} = "ordnumber_$form->{ordnumber}";
     $form->{addition} = "STORNO";
-    $form->save_history($form->dbconnect(\%myconfig));
+    $form->save_history;
   }
   # /saving the history
 
index 10b138e..274ae4a 100644 (file)
@@ -350,7 +350,7 @@ sub add_transaction {
 #  # saving the history
 #  if(!exists $form->{addition}) {
 #    $form->{addition} = "ADD TRANSACTION";
-#    $form->save_history($form->dbconnect(\%myconfig));
+#    $form->save_history;
 #  }
 #  # /saving the history
 
@@ -384,7 +384,7 @@ sub save_and_ap_transaction {
   if(!exists $form->{addition}) {
     $form->{snumbers} = qq|invnumber_| . $form->{invnumber};
     $form->{addition} = "SAVED";
-    $form->save_history($form->dbconnect(\%myconfig));
+    $form->save_history;
   }
   # /saving the history
   &add_transaction;
@@ -404,7 +404,7 @@ sub save_and_ar_transaction {
   if(!exists $form->{addition}) {
     $form->{snumbers} = qq|invnumber_| . $form->{invnumber};
     $form->{addition} = "SAVED";
-    $form->save_history($form->dbconnect(\%myconfig));
+    $form->save_history;
   }
   # /saving the history
   &add_transaction;
@@ -429,7 +429,7 @@ sub save_and_invoice {
   if(!exists $form->{addition}) {
     $form->{snumbers} = qq|invnumber_| . $form->{invnumber};
     $form->{addition} = "SAVED";
-    $form->save_history($form->dbconnect(\%myconfig));
+    $form->save_history;
   }
   # /saving the history
   &add_transaction;
@@ -450,7 +450,7 @@ sub save_and_rfq {
   if(!exists $form->{addition}) {
     $form->{snumbers} = qq|ordnumber_| . $form->{ordnumber};
     $form->{addition} = "SAVED";
-    $form->save_history($form->dbconnect(\%myconfig));
+    $form->save_history;
   }
   # /saving the history
   &add_transaction;
@@ -471,7 +471,7 @@ sub save_and_quotation {
   if(!exists $form->{addition}) {
     $form->{snumbers} = qq|ordnumber_| . $form->{ordnumber};
     $form->{addition} = "SAVED";
-    $form->save_history($form->dbconnect(\%myconfig));
+    $form->save_history;
   }
   # /saving the history
   &add_transaction;
@@ -497,7 +497,7 @@ sub save_and_order {
   if(!exists $form->{addition}) {
     $form->{snumbers} = qq|ordnumber_| . $form->{ordnumber};
     $form->{addition} = "SAVED";
-    $form->save_history($form->dbconnect(\%myconfig));
+    $form->save_history;
   }
   # /saving the history
   &add_transaction;
@@ -530,7 +530,7 @@ sub save_and_close {
   if(!exists $form->{addition}) {
     $form->{snumbers} = ($form->{"db"} eq "customer" ? qq|customernumber_| . $form->{customernumber} : qq|vendornumber_| . $form->{vendornumber});
     $form->{addition} = "SAVED";
-    $form->save_history($form->dbconnect(\%myconfig));
+    $form->save_history;
   }
   # /saving the history
   $form->redirect($locale->text($msg));
@@ -570,7 +570,7 @@ sub save {
   if(!exists $form->{addition}) {
     $form->{snumbers} = ($form->{"db"} eq "customer" ? qq|customernumber_| . $form->{customernumber} : qq|vendornumber_| . $form->{vendornumber});
     $form->{addition} = "SAVED";
-    $form->save_history($form->dbconnect(\%myconfig));
+    $form->save_history;
   }
   # /saving the history
   &edit;
@@ -596,7 +596,7 @@ sub delete {
   if(!exists $form->{addition}) {
     $form->{snumbers} = ($form->{"db"} eq "customer" ? qq|customernumber_| . $form->{customernumber} : qq|vendornumber_| . $form->{vendornumber});
     $form->{addition} = "DELETED";
-    $form->save_history($form->dbconnect(\%myconfig));
+    $form->save_history;
   }
   # /saving the history
   $form->redirect($locale->text($msg));
index 845d2cd..6c918fe 100644 (file)
@@ -178,7 +178,7 @@ sub save {
   if(!exists $form->{addition} && $form->{id} ne "") {
     $form->{snumbers} = qq|dunning_id_| . $form->{"dunning_id"};
     $form->{addition} = "SAVED FOR DUNNING";
-    $form->save_history($form->dbconnect(\%myconfig));
+    $form->save_history;
   }
   # /saving the history
   $form->redirect($locale->text('Dunning Process Config saved!'));
@@ -247,7 +247,7 @@ sub save_dunning {
   if(!exists $form->{addition} && $form->{id} ne "") {
     $form->{snumbers} = qq|dunning_id_| . $form->{"dunning_id"};
     $form->{addition} = "DUNNING STARTED";
-    $form->save_history($form->dbconnect(\%myconfig));
+    $form->save_history;
   }
   # /saving the history
 
index d5e8d3a..0d5941c 100644 (file)
@@ -637,7 +637,7 @@ sub save {
   if(!exists $form->{addition}) {
     $form->{snumbers} = qq|donumber_| . $form->{donumber};
     $form->{addition} = "SAVED";
-    $form->save_history($form->dbconnect(\%myconfig));
+    $form->save_history;
   }
   # /saving the history
 
@@ -683,7 +683,7 @@ sub delete_delivery_order {
     if(!exists $form->{addition}) {
       $form->{snumbers} = qq|donumber_| . $form->{donumber};
       $form->{addition} = "DELETED";
-      $form->save_history($form->dbconnect(\%myconfig));
+      $form->save_history;
     }
     # /saving the history
 
@@ -732,7 +732,7 @@ sub invoice {
 
   for my $i (1 .. $form->{rowcount}) {
     # für bug 1284
-    if ($form->{discount}){ # Falls wir einen Kundenrabatt haben 
+    if ($form->{discount}){ # Falls wir einen Kundenrabatt haben
       # und keinen anderen discount wert an $i ...
       $form->{"discount_$i"} ||= $form->{discount}*100; # ... nehmen wir den kundenrabatt
     }
index 44360f4..f26d671 100644 (file)
@@ -1420,7 +1420,7 @@ sub yes {
       if(!exists $form->{addition} && $form->{id} ne "") {
         $form->{snumbers} = qq|ordnumber_| . $form->{ordnumber};
         $form->{addition} = "DELETED";
-        $form->save_history($form->dbconnect(\%myconfig));
+        $form->save_history;
       }
     # /saving the history
     $form->redirect($locale->text('Transaction deleted!'))
@@ -1578,7 +1578,7 @@ sub post_transaction {
     $form->{snumbers} = qq|ordnumber_| . $form->{ordnumber};
     $form->{addition} = "SAVED";
     $form->{what_done} = $locale->text("Buchungsnummer") . " = " . $form->{id};
-    $form->save_history($form->dbconnect(\%myconfig));
+    $form->save_history;
   }
   # /saving the history
 
@@ -1646,7 +1646,7 @@ sub storno {
   if(!exists $form->{addition} && $form->{id} ne "") {
     $form->{snumbers} = "ordnumber_$form->{ordnumber}";
     $form->{addition} = "STORNO";
-    $form->save_history($form->dbconnect(\%myconfig));
+    $form->save_history;
   }
   # /saving the history
 
index eed4db5..5c9b550 100644 (file)
@@ -1783,7 +1783,7 @@ sub save {
   if(!exists $form->{addition}) {
     $form->{snumbers} = qq|partnumber_| . $form->{partnumber};
     $form->{addition} = "SAVED";
-    $form->save_history($form->dbconnect(\%myconfig));
+    $form->save_history;
   }
   # /saving the history
   $parts_id = $form->{id};
@@ -1916,7 +1916,7 @@ sub save_as_new {
   if(!exists $form->{addition}) {
     $form->{snumbers} = qq|partnumber_| . $form->{partnumber};
     $form->{addition} = "SAVED AS NEW";
-    $form->save_history($form->dbconnect(\%myconfig));
+    $form->save_history;
   }
   # /saving the history
   $form->{id} = 0;
@@ -1937,7 +1937,7 @@ sub delete {
   if(!exists $form->{addition}) {
     $form->{snumbers} = qq|partnumber_| . $form->{partnumber};
     $form->{addition} = "DELETED";
-    $form->save_history($form->dbconnect(\%myconfig));
+    $form->save_history;
   }
   # /saving the history
   my $rc = IC->delete(\%myconfig, \%$form);
index 2bf8e07..dc0940d 100644 (file)
@@ -210,8 +210,8 @@ sub display_row {
     my %column_data = ();
 
     # undo formatting
-    map { $form->{"${_}_$i"} = $form->parse_amount(\%myconfig, $form->{"${_}_$i"}) } 
-      qw(qty discount sellprice lastcost price_new price_old) 
+    map { $form->{"${_}_$i"} = $form->parse_amount(\%myconfig, $form->{"${_}_$i"}) }
+      qw(qty discount sellprice lastcost price_new price_old)
         unless ($form->{simple_save});
 
 # unit begin
@@ -343,8 +343,8 @@ sub display_row {
     map { $form->{"${_}_$i"} = $form->format_amount(\%myconfig, $form->{"${_}_$i"}, 2) } qw(marge_absolut marge_percent);
 
     push @ROW2, { value => sprintf qq|
-         <font %s><b>%s</b> %s &nbsp;%s%% </font> 
-        &nbsp;<b>%s</b> %s 
+         <font %s><b>%s</b> %s &nbsp;%s%% </font>
+        &nbsp;<b>%s</b> %s
         &nbsp;<b>%s</b> <input size="5" name="lastcost_$i" value="%s">|,
                    $marge_color, $locale->text('Ertrag'),$form->{"marge_absolut_$i"}, $form->{"marge_percent_$i"},
                    $locale->text('LP'), $form->format_amount(\%myconfig, $form->{"listprice_$i"}, 2),
@@ -1429,7 +1429,7 @@ sub print_form {
       if(!exists $form->{addition}) {
         $form->{snumbers} = qq|ordnumber_| . $form->{ordnumber};
         $form->{addition} = "PRINTED";
-        $form->save_history($form->dbconnect(\%myconfig));
+        $form->save_history;
       }
       # /saving the history
       ::end_of_request();
@@ -1660,7 +1660,7 @@ sub print_form {
     elsif($form->{media} =~ /screen/) {
       $form->{addition} = "SCREENED";
     }
-    $form->save_history($form->dbconnect(\%myconfig));
+    $form->save_history;
   }
   # /saving the history
 
index 03b605e..2c964d2 100644 (file)
@@ -552,7 +552,7 @@ sub storno {
   if(!exists $form->{addition} && $form->{id} ne "") {
     $form->{snumbers} = qq|invnumber_| . $form->{invnumber};
     $form->{addition} = "CANCELED";
-    $form->save_history($form->dbconnect(\%myconfig));
+    $form->save_history;
   }
   # /saving the history
 
@@ -618,7 +618,7 @@ sub post_payment {
       $form->{snumbers} = qq|invnumber_| . $form->{invnumber};
       $form->{addition} = "PAYMENT POSTED";
       $form->{what_done} = $form->{currency} . qq| | . $form->{paid} . qq| | . $locale->text("POSTED");
-      $form->save_history($form->dbconnect(\%myconfig));
+      $form->save_history;
       # /saving the history
     }
 
@@ -718,7 +718,7 @@ sub post {
       $form->{snumbers} = qq|invnumber_| . $form->{invnumber};
       $form->{addition} = "POSTED";
       #$form->{what_done} = $locale->text("Rechnungsnummer") . qq| | . $form->{invnumber};
-      $form->save_history($form->dbconnect(\%myconfig));
+      $form->save_history;
     }
     # /saving the history
     remove_draft() if $form->{remove_draft};
@@ -784,7 +784,7 @@ sub yes {
     if(!exists $form->{addition}) {
       $form->{snumbers} = qq|invnumber_| . $form->{invnumber};
       $form->{addition} = "DELETED";
-      $form->save_history($form->dbconnect(\%myconfig));
+      $form->save_history;
     }
     # /saving the history
     $form->redirect($locale->text('Invoice deleted!'));
index 4192beb..450d0b6 100644 (file)
@@ -721,7 +721,7 @@ sub post {
     $form->{addition} = $form->{print_and_post} ? "PRINTED AND POSTED" :
                         $form->{storno}         ? "STORNO"             :
                                                   "POSTED";
-    $form->save_history($form->dbconnect(\%myconfig));
+    $form->save_history;
   }
 
   if (!$form->{no_redirect_after_post}) {
@@ -942,7 +942,7 @@ sub yes {
     if(!exists $form->{addition}) {
     $form->{snumbers} = qq|invnumber_| . $form->{invnumber};
       $form->{addition} = "DELETED";
-      $form->save_history($form->dbconnect(\%myconfig));
+      $form->save_history;
     }
     # /saving the history
     $form->redirect($locale->text('Invoice deleted!'));
index a2085f6..5ded2b7 100644 (file)
@@ -1063,7 +1063,7 @@ sub save_and_close {
   if(!exists $form->{addition}) {
     $form->{snumbers} = qq|ordnumber_| . $form->{ordnumber};
     $form->{addition} = "SAVED";
-    $form->save_history($form->dbconnect(\%myconfig));
+    $form->save_history;
   }
   # /saving the history
 
@@ -1171,7 +1171,7 @@ sub save {
   if(!exists $form->{addition}) {
     $form->{snumbers} = qq|ordnumber_| . $form->{ordnumber};
     $form->{addition} = "SAVED";
-    $form->save_history($form->dbconnect(\%myconfig));
+    $form->save_history;
   }
   # /saving the history
 
@@ -1259,7 +1259,7 @@ sub delete_order_quotation {
     if(!exists $form->{addition}) {
       $form->{snumbers} = qq|ordnumber_| . $form->{ordnumber};
       $form->{addition} = "DELETED";
-      $form->save_history($form->dbconnect(\%myconfig));
+      $form->save_history;
     }
     # /saving the history
     $form->info($msg);
index e003e07..532dcfa 100644 (file)
@@ -195,7 +195,7 @@ sub save {
   if(!exists $form->{addition} && $form->{id} ne "") {
     $form->{snumbers} = qq|projectnumber_| . $form->{projectnumber};
     $form->{addition} = "SAVED";
-    $form->save_history($form->dbconnect(\%myconfig));
+    $form->save_history;
   }
   # /saving the history
 
@@ -223,7 +223,7 @@ sub delete {
   if(!exists $form->{addition}) {
     $form->{snumbers} = qq|projectnumber_| . $form->{projectnumber};
     $form->{addition} = "DELETED";
-    $form->save_history($form->dbconnect(\%myconfig));
+    $form->save_history;
   }
   # /saving the history
   $main::lxdebug->leave_sub();
index 0e74d53..a59ecc9 100644 (file)
@@ -235,7 +235,7 @@ sub save {
     $form->{id}       = $project->{id};
     $form->{snumbers} = qq|projectnumber_| . $project->{projectnumber};
     $form->{addition} = "SAVED";
-    $form->save_history($form->dbconnect(\%myconfig));
+    $form->save_history;
   }
   # /saving the history
 
@@ -278,7 +278,7 @@ sub delete {
   if(!exists $form->{addition}) {
     $form->{snumbers} = qq|projectnumber_| . $project->{projectnumber};
     $form->{addition} = "DELETED";
-    $form->save_history($form->dbconnect(\%myconfig));
+    $form->save_history;
   }
   # /saving the history
 
index b7adc21..c5f2c3f 100644 (file)
@@ -2062,7 +2062,7 @@ sub print_form {
     $form->{snumbers} = qq|ordnumber_| . $form->{ordnumber};
     $form->{addition} = "PRINTED";
     $form->{what_done} = $form->{type};
-    $form->save_history($form->dbconnect(\%myconfig));
+    $form->save_history;
   }
   # /saving the history
   $main::lxdebug->leave_sub();