Merge remote branch 'refs/remotes/kirana/after-262'
authorMoritz Bunkus <m.bunkus@linet-services.de>
Wed, 9 Feb 2011 13:33:36 +0000 (14:33 +0100)
committerMoritz Bunkus <m.bunkus@linet-services.de>
Wed, 9 Feb 2011 13:33:36 +0000 (14:33 +0100)
SL/Form.pm
SL/OE.pm
SL/TransNumber.pm

index efcad4a..6e7145f 100644 (file)
@@ -1617,7 +1617,7 @@ sub get_standard_dbh {
     undef $standard_dbh;
   }
 
-  $standard_dbh ||= SL::DB::create->dbh;
+  $standard_dbh ||= $self->dbconnect_noauto($myconfig);
 
   $main::lxdebug->leave_sub(2);
 
index 8adaf6a..28e3975 100644 (file)
--- a/SL/OE.pm
+++ b/SL/OE.pm
@@ -559,11 +559,6 @@ sub save {
     }
   }
 
-  $self->save_periodic_invoices_config(dbh         => $dbh,
-                                       oe_id       => $form->{id},
-                                       config_yaml => $form->{periodic_invoices_config})
-    if ($form->{type} eq 'sales_order');
-
   $form->{saved_xyznumber} = $form->{$form->{type} =~ /_quotation$/ ?
                                        "quonumber" : "ordnumber"};
 
@@ -571,6 +566,11 @@ sub save {
 
   my $rc = $dbh->commit;
 
+  $self->save_periodic_invoices_config(dbh         => $dbh,
+                                       oe_id       => $form->{id},
+                                       config_yaml => $form->{periodic_invoices_config})
+    if ($form->{type} eq 'sales_order');
+
   $main::lxdebug->leave_sub();
 
   return $rc;
index 0ba13a8..c9d7be6 100644 (file)
@@ -105,7 +105,7 @@ sub create_unique {
   my $form    = $main::form;
   my %filters = $self->_get_filters();
 
-  $self->dbh->begin_work;
+  $self->dbh->begin_work if $self->dbh->{AutoCommit};
   do_query($form, $self->dbh, qq|LOCK TABLE defaults|);
   do_query($form, $self->dbh, qq|LOCK TABLE business|) if $self->business_id;