From: Sven Schöling Date: Tue, 2 Aug 2016 10:59:32 +0000 (+0200) Subject: common.pl: single-dbh X-Git-Tag: release-3.5.4~2087 X-Git-Url: http://wagnertech.de/git?a=commitdiff_plain;h=d1090a8c6956e968fd2964505fa1e04ca0b4db27;p=kivitendo-erp.git common.pl: single-dbh --- diff --git a/bin/mozilla/common.pl b/bin/mozilla/common.pl index cba9e2244..d01d19f58 100644 --- a/bin/mozilla/common.pl +++ b/bin/mozilla/common.pl @@ -11,6 +11,7 @@ use SL::Common; use SL::DB::Helper::Mappings; +use SL::DB; use SL::DBUtils qw(do_query); use SL::Form; use SL::MoreCommon qw(restore_form save_form); @@ -493,10 +494,12 @@ sub mark_as_paid_common { my $locale = $main::locale; if($form->{mark_as_paid}) { - my $dbh ||= $form->get_standard_dbh($myconfig); - my $query = qq|UPDATE $db_name SET paid = amount, datepaid = current_date WHERE id = ?|; - do_query($form, $dbh, $query, $form->{id}); - $dbh->commit(); + SL::DB->client->with_transaction(sub { + my $dbh ||= SL::DB->client->dbh; + my $query = qq|UPDATE $db_name SET paid = amount, datepaid = current_date WHERE id = ?|; + do_query($form, $dbh, $query, $form->{id}); + 1; + }) or do { $::form->error(SL::DB->client->error) }; $form->redirect($locale->text("Marked as paid")); } else {