From: Sven Schöling Date: Mon, 1 Aug 2016 14:02:39 +0000 (+0200) Subject: GenericTranslations: single-dbh X-Git-Tag: release-3.5.4~2091 X-Git-Url: http://wagnertech.de/git?a=commitdiff_plain;h=9fdd2fb1bd3eea5233499866267362753b1cdcf3;p=kivitendo-erp.git GenericTranslations: single-dbh --- diff --git a/SL/GenericTranslations.pm b/SL/GenericTranslations.pm index a509212a3..4f33ab412 100644 --- a/SL/GenericTranslations.pm +++ b/SL/GenericTranslations.pm @@ -1,6 +1,7 @@ package GenericTranslations; use SL::DBUtils; +use SL::DB; use strict; @@ -90,8 +91,16 @@ sub list { } sub save { + my ($self, %params) = @_; $main::lxdebug->enter_sub(); + my $rc = SL::DB->client->with_transaction(\&_save, %params); + + $::lxdebug->leave_sub; + return $rc; +} + +sub _save { my $self = shift; my %params = @_; @@ -100,7 +109,7 @@ sub save { my $myconfig = \%main::myconfig; my $form = $main::form; - my $dbh = $params{dbh} || $form->get_standard_dbh($myconfig); + my $dbh = $params{dbh} || SL::DB->client->dbh; $params{translation} =~ s/^\s+//; $params{translation} =~ s/\s+$//; @@ -139,9 +148,7 @@ sub save { do_query($form, $dbh, $q_insert, @v_insert); } - $dbh->commit() unless ($params{dbh}); - - $main::lxdebug->leave_sub(); + return 1; }