Funktion get_config aus ustva.pl nach USTVA.pm verschoben, damit sie auch aus rp...
authorMoritz Bunkus <m.bunkus@linet-services.de>
Fri, 30 Mar 2007 14:53:02 +0000 (14:53 +0000)
committerMoritz Bunkus <m.bunkus@linet-services.de>
Fri, 30 Mar 2007 14:53:02 +0000 (14:53 +0000)
SL/USTVA.pm
bin/mozilla/rp.pl
bin/mozilla/ustva.pl
locale/de/ustva

index e2aa9c4..354e13e 100644 (file)
@@ -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 (<FACONF>) {
+    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;
index a496faa..848ec62 100644 (file)
@@ -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 =
index acab5df..fc1b5e1 100644 (file)
@@ -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 (<FACONF>) {
-    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}";
index 5c504b1..02aa6cd 100644 (file)
@@ -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',