From 0246e1250d5b6740e6ac04458714a57393bff4f8 Mon Sep 17 00:00:00 2001 From: Moritz Bunkus Date: Fri, 30 Mar 2007 14:53:02 +0000 Subject: [PATCH] Funktion get_config aus ustva.pl nach USTVA.pm verschoben, damit sie auch aus rp.pl aufgerufen werden kann. --- SL/USTVA.pm | 34 ++++++++++++++++++++++++++++++++++ bin/mozilla/rp.pl | 13 ++++++------- bin/mozilla/ustva.pl | 44 +++++--------------------------------------- locale/de/ustva | 1 - 4 files changed, 45 insertions(+), 47 deletions(-) diff --git a/SL/USTVA.pm b/SL/USTVA.pm index e2aa9c467..354e13e18 100644 --- a/SL/USTVA.pm +++ b/SL/USTVA.pm @@ -941,6 +941,40 @@ sub get_accounts_ustva { } +sub get_config { + $main::lxdebug->enter_sub(); + + my ($self, $userpath, $filename) = @_; + + my $form = $main::form; + + if (!open(FACONF, "$userpath/$form->{login}_$filename")) { + open(FANEW, ">$userpath/$form->{login}_$filename") || + $form->error("$userpath/$filename : $!"); + close(FANEW); + open(FACONF, "$userpath/$form->{login}_$filename") || + $form->error("$userpath/$form->{username}_$filename : $!"); + } + + while () { + last if (/^\[/); + next if (/^(\#|\s)/); + + # remove comments + s/\s#.*//g; + + # remove any trailing whitespace + s/^\s*(.*?)\s*$/$1/; + my ($key, $value) = split(/=/, $_, 2); + + $form->{$key} = "$value"; + + } + + close(FACONF); + + $main::lxdebug->leave_sub(); +} 1; diff --git a/bin/mozilla/rp.pl b/bin/mozilla/rp.pl index a496faa91..848ec62ba 100644 --- a/bin/mozilla/rp.pl +++ b/bin/mozilla/rp.pl @@ -40,6 +40,7 @@ require "bin/mozilla/common.pl"; use SL::PE; use SL::RP; +use SL::USTVA; 1; @@ -983,9 +984,8 @@ $jsscript . $locale->text('Continue') . qq|"> |; - # Hier Aufruf von get_config aus bin/mozilla/fa.pl zum - # Einlesen der Finanzamtdaten - get_config($userspath, 'finanzamt.ini'); + # Hier Aufruf von get_config zum Einlesen der Finanzamtdaten + USTVA->get_config($userspath, 'finanzamt.ini'); $disabled = qq|disabled="disabled"|; $disabled = '' if ($form->{elster} eq '1'); @@ -1354,7 +1354,7 @@ sub list_accounts { $description = $form->escape($ref->{description}); $href = - qq|ca.pl?path=$form->{path}&action=list_transactions&accounttype=$form->{accounttype}&login=$form->{login}&password=$form->{password}&fromdate=$form->{fromdate}&todate=$form->{todate}&sort=transdate&l_heading=$form->{l_heading}&l_subtotal=$form->{l_subtotal}&department=$department&eur=$form->{eur}&projectnumber=$projectnumber&project_id=$form->{project_id}&title=$title&nextsub=$form->{nextsub}&accno=$ref->{accno}&description=$description"; + qq|ca.pl?path=$form->{path}&action=list_transactions&accounttype=$form->{accounttype}&login=$form->{login}&password=$form->{password}&fromdate=$form->{fromdate}&todate=$form->{todate}&sort=transdate&l_heading=$form->{l_heading}&l_subtotal=$form->{l_subtotal}&department=$department&eur=$form->{eur}&projectnumber=$projectnumber&project_id=$form->{project_id}&title=$title&nextsub=$form->{nextsub}&accno=$ref->{accno}&description=$description|; $ml = ($ref->{category} =~ /(A|C|E)/) ? -1 : 1; @@ -2864,9 +2864,8 @@ sub generate_bwa { sub generate_ustva { $lxdebug->enter_sub(); - # Hier Aufruf von get_config aus bin/mozilla/fa.pl zum - # Einlesen der Finanzamtdaten - get_config($userspath, 'finanzamt.ini'); + # Hier Aufruf von get_config zum Einlesen der Finanzamtdaten + USTVA->get_config($userspath, 'finanzamt.ini'); # &get_project(generate_bwa); @anmeldungszeitraum = diff --git a/bin/mozilla/ustva.pl b/bin/mozilla/ustva.pl index acab5dfb6..fc1b5e126 100644 --- a/bin/mozilla/ustva.pl +++ b/bin/mozilla/ustva.pl @@ -88,7 +88,7 @@ sub report { $form->header; # Einlesen der Finanzamtdaten - &get_config($userspath, 'finanzamt.ini'); + USTVA->get_config($userspath, 'finanzamt.ini'); # Hier Einlesen der user-config # steuernummer entfernt für prerelease @@ -528,10 +528,9 @@ sub show_options { sub generate_ustva { $lxdebug->enter_sub(); - # Aufruf von get_config aus bin/mozilla/ustva.pl zum - # Einlesen der Finanzamtdaten aus finanzamt.ini + # Aufruf von get_config zum Einlesen der Finanzamtdaten aus finanzamt.ini - get_config($userspath, 'finanzamt.ini'); + USTVA->get_config($userspath, 'finanzamt.ini'); # init some form vars my @anmeldungszeitraum = @@ -1056,7 +1055,7 @@ sub config_step1 { # edit all taxauthority prefs $form->header; - &get_config($userspath, 'finanzamt.ini'); + USTVA->get_config($userspath, 'finanzamt.ini'); my $land = $form->{elsterland}; my $amt = $form->{elsterFFFF}; @@ -1145,7 +1144,7 @@ sub config_step2 { my $elster_amt = ''; my $elsterFFFF = ''; my $elstersteuernummer = ''; - &get_config($userspath, 'finanzamt.ini') + USTVA->get_config($userspath, 'finanzamt.ini') if ($form->{saved} eq $locale->text('saved')); # Auf Übergabefehler checken @@ -1312,39 +1311,6 @@ sub create_steuernummer { $lxdebug->leave_sub(); } -sub get_config { - $lxdebug->enter_sub(); - - my ($userpath, $filename) = @_; - my ($key, $value) = ''; - open(FACONF, "$userpath/$form->{login}_$filename") - or #falls Datei nicht vorhanden ist - sub { - open(FANEW, ">$userpath/$form->{login}_$filename") - or $form->error("$userpath/$filename : $!"); - close FANEW; - open(FACONF, "$userpath/$form->{login}_$filename") - or $form->error("$userpath/$form->{username}_$filename : $!"); - }; - while () { - last if /^\[/; - next if /^(#|\s)/; - - # remove comments - s/\s#.*//g; - - # remove any trailing whitespace - s/^\s*(.*?)\s*$/$1/; - ($key, $value) = split /=/, $_, 2; - - $form->{$key} = "$value"; - - } - close FACONF; - - $lxdebug->leave_sub(); -} - sub save { $lxdebug->enter_sub(); my $filename = "$form->{login}_$form->{filename}"; diff --git a/locale/de/ustva b/locale/de/ustva index 5c504b147..02aa6cd5b 100644 --- a/locale/de/ustva +++ b/locale/de/ustva @@ -115,7 +115,6 @@ $self->{subs} = { 'debug' => 'debug', 'elster_hash' => 'elster_hash', 'generate_ustva' => 'generate_ustva', - 'get_config' => 'get_config', 'gl_transaction' => 'gl_transaction', 'help' => 'help', 'name_selected' => 'name_selected', -- 2.20.1