From 9c41288724dd0a3dd835246344ff71f9291aaf5d Mon Sep 17 00:00:00 2001 From: "G. Richardson" Date: Mon, 3 Aug 2015 08:50:42 +0200 Subject: [PATCH] USTVA.pm : refactoring von get_coa und coa_get get_coa benutzt jetzt intern instance_conf und coa_get kann komplett durch einen instance_conf Zugriff ersetzt werden. --- SL/USTVA.pm | 33 +++------------------------------ bin/mozilla/ustva.pl | 6 +++--- 2 files changed, 6 insertions(+), 33 deletions(-) diff --git a/SL/USTVA.pm b/SL/USTVA.pm index 0dfa36ff0..a80372b28 100644 --- a/SL/USTVA.pm +++ b/SL/USTVA.pm @@ -77,19 +77,9 @@ sub _init { sub get_coa { - my ( $self, $form, $myconfig) = @_; - - my $query = q{ SELECT coa FROM defaults }; - - my $dbh = $form->dbconnect($myconfig); - my $sth = $dbh->prepare($query); - $sth->execute() || $form->dberror($query); - - my ($coa) = selectrow_query($form, $dbh, $query); - - $sth->finish; - $dbh->disconnect; + my ( $self, $form ) = @_; + my $coa = $::instance_conf->get_coa; $form->{coa} = $coa; $form->{"COA_$coa"} = '1'; $form->{COA_Germany} = '1' if ($coa =~ m/^germany/i); @@ -698,7 +688,7 @@ sub ustva { foreach my $item (@category_euro) { $form->{"$item"} = 0; } - my $coa_name = coa_get($dbh); + my $coa_name = $::instance_conf->get_coa; $form->{coa} = $coa_name; # Controlvariable for templates @@ -772,23 +762,6 @@ sub ustva { $main::lxdebug->leave_sub(); } -sub coa_get { - - my ($dbh) = @_; - my $form = $main::form; - - my $query= qq|SELECT coa FROM defaults|; - - my $sth = $dbh->prepare($query); - - $sth->execute || $form->dberror($query); - - my ($ref) = $sth->fetchrow_array; - - return $ref; - -}; - sub get_accounts_ustva { $main::lxdebug->enter_sub(); diff --git a/bin/mozilla/ustva.pl b/bin/mozilla/ustva.pl index f786d4bfd..b66fead82 100644 --- a/bin/mozilla/ustva.pl +++ b/bin/mozilla/ustva.pl @@ -196,7 +196,7 @@ sub report { # Which COA is in use? - $ustva->get_coa($form, \%myconfig); + $ustva->get_coa($form); # fetches coa and modifies some form variables my $template_ref = { openings => $openings, @@ -960,7 +960,7 @@ $::form->{title} = $::locale->text('Tax Office Preferences'); # Which COA is in use? - $ustva->get_coa($::form, \%::myconfig); + $ustva->get_coa($::form); # fetches coa and modifies some form variables # hä? kann die weg? my $steuernummer_new = ''; @@ -1066,7 +1066,7 @@ sub config_step2 { $form->{FA_Oeffnungszeiten} =~ s/\\\\n/\n/g; - $ustva->get_coa($form, \%myconfig); + $ustva->get_coa($form); # fetches coa and modifies some form variables my $input_steuernummer = $ustva->steuernummer_input( $form->{elsterland}, -- 2.20.1