X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=SL%2FUSTVA.pm;h=5c320fc7c4c7d9d2113a94fdfc51035661d4c3e7;hb=1d1f31407ee1a66af5a0db0d10350bc29a371653;hp=33a29ddd880a3a9712bc5ba7679dd484f391c197;hpb=a68089fb83a276f3ce78e5bd145c1cf05cc9a762;p=kivitendo-erp.git diff --git a/SL/USTVA.pm b/SL/USTVA.pm index 33a29ddd8..5c320fc7c 100644 --- a/SL/USTVA.pm +++ b/SL/USTVA.pm @@ -18,7 +18,8 @@ # GNU General Public License for more details. # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software -# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, +# MA 02110-1335, USA. #====================================================================== # Utilities for ustva #===================================================================== @@ -27,6 +28,7 @@ package USTVA; use List::Util qw(first); +use SL::DB; use SL::DBUtils; use SL::DB::Default; use SL::DB::Finanzamt; @@ -57,9 +59,9 @@ my @tax_office_information = ( fa_steuerberater_street fa_steuerberater_tel fa_voranmeld); my @fiamt_finanzamt = qw( - fa_land_nr fa_bufa_nr fa_name fa_strasse + fa_land_nr fa_bufa_nr fa_name fa_strasse fa_plz fa_ort fa_telefon fa_fax - fa_plz_grosskunden fa_plz_postfach fa_postfach + fa_plz_grosskunden fa_plz_postfach fa_postfach fa_blz_1 fa_kontonummer_1 fa_bankbezeichnung_1 fa_blz_2 fa_kontonummer_2 fa_bankbezeichnung_2 fa_oeffnungszeiten fa_email fa_internet); @@ -128,23 +130,23 @@ sub report_variables { $where_dcp |; - my $dbh = $form->dbconnect($myconfig); - my $sth = $dbh->prepare($query); - - $sth->execute() || $form->dberror($query); - my @positions; - while ( my $row_ref = $sth->fetchrow_arrayref() ) { - push @positions, @$row_ref; # Copy the array contents - } + SL::DB->client->with_transaction(sub { + my $dbh = SL::DB->client->dbh; + my $sth = $dbh->prepare($query); - $sth->finish; + $sth->execute() || $form->dberror($query); - $dbh->disconnect; + while ( my $row_ref = $sth->fetchrow_arrayref() ) { + push @positions, @$row_ref; # Copy the array contents + } - return @positions; + $sth->finish; + 1; + }) or do { die SL::DB->client->error }; + return @positions; } @@ -505,7 +507,7 @@ sub query_finanzamt { my ($self, $myconfig, $form) = @_; - my $dbh = $form->dbconnect($myconfig) or $self->error(DBI->errstr); + my $dbh = SL::DB->client->dbh; #Test, if table finanzamt exist my $table = 'finanzamt'; @@ -516,11 +518,10 @@ sub query_finanzamt { #There is no table, read the table from sql/finanzamt.sql print qq|

Bitte warten, Tabelle $table wird einmalig in Datenbank: $myconfig->{dbname} als Benutzer: $myconfig->{dbuser} hinzugefügt...

|; - process_query($form, $dbh, $filename) || $self->error(DBI->errstr); - - #execute second last call - my $dbh = $form->dbconnect($myconfig) or $self->error(DBI->errstr); - $dbh->disconnect(); + SL::DB->client->with_transaction(sub { + process_query($form, $dbh, $filename) || $self->error(DBI->errstr); + 1; + }) or do { die SL::DB->client->error }; }; $tst->finish(); @@ -601,8 +602,7 @@ sub ustva { my ($self, $myconfig, $form) = @_; - # connect to database - my $dbh = $form->get_standard_dbh; + my $dbh = SL::DB->client->dbh; my $last_period = 0; my $category = "pos_ustva"; @@ -704,8 +704,6 @@ sub ustva { $form->{"Z65"} = $form->{"Z62"} - $form->{"69"}; $form->{"83"} = $form->{"Z65"} - $form->{"39"}; - $dbh->disconnect; - $main::lxdebug->leave_sub(); } @@ -1119,7 +1117,7 @@ sub get_oldconfig { # remove any trailing whitespace s/^\s*(.*?)\s*$/$1/; my ($key, $value) = split(/=/, $_, 2); - + $main::lxdebug->message(LXDebug->DEBUG2(), "oldkey: ".$key." val=".$value." newkey=". $oldkeys{$key}." oval=".$::form->{$oldkeys{$key}}); if ( $oldkeys{$key} && $::form->{$oldkeys{$key}} eq '' ) {