Bei Kreditorenbuchungsberichten in der Typ-Spalte auch Stornos gesondert ausweisen.
[kivitendo-erp.git] / bin / mozilla / ustva.pl
index 6818a00..212c381 100644 (file)
@@ -24,7 +24,6 @@
 # German Tax authority Module and later ELSTER Interface
 #======================================================================
 
-require "bin/mozilla/arap.pl";
 require "bin/mozilla/common.pl";
 
 #use strict;
@@ -69,13 +68,13 @@ use SL::User;
 # $locale->text('Nov')
 # $locale->text('Dec')
 
-# $form->parse_html_template2('generic/util_hidden_variables');
-
 #############################
 
 sub report {
   $lxdebug->enter_sub();
 
+  $auth->assert('advance_turnover_tax_return');
+
   my $myconfig = \%myconfig;
 
   $form->{title} = $locale->text('UStVA');
@@ -113,9 +112,8 @@ sub report {
 
   my $company_given = ($form->{company} ne '') 
     ? qq|<h3>$form->{company}</h3>\n|
-    : qq|<a href=am.pl?action=config|
-      . qq|&level=Programm--Preferences&login=$form->{login}|
-      . qq|&password=$form->{password}>| 
+    : qq|<a href="am.pl?action=config|
+      . qq|&level=Programm--Preferences">| 
       . $locale->text('No Company Name given') . qq|!</a><br>|;
 
 
@@ -123,25 +121,19 @@ sub report {
   # klären, ob $form->{company_street|_address} gesetzt sind
   if ($form->{address} ne '') {
     my $temp = $form->{address};
-    $temp =~ s/\\n/<br \/>/;
+    $temp =~ s/\n/<br \/>/;
     ($form->{co_street}, $form->{co_city}) = split("<br \/>", $temp);
-    $form->{co_city} =~ s/\\n//g;
+    $form->{co_city} =~ s/\n//g;
   }
 
 
   my $address_given = 
-    ($form->{co_street} ne '' 
-      and ( 
-        $form->{co_zip} ne ''
-          or $form->{co_city} ne ''
-      )
-    ) 
+    ($form->{co_street} && ($form->{co_zip} || $form->{co_city})) 
     ? qq|$form->{co_street}<br>|
         . qq|$form->{co_street1}<br>|
         . qq|$form->{co_zip} $form->{co_city}|
-    : qq|<a href=am.pl?action=config|
-        . qq|&level=Programm--Preferences&login=$form->{login}|
-        . qq|&password=$form->{password}>| 
+    : qq|<a href="am.pl?action=config|
+        . qq|&level=Programm--Preferences">| 
         . $locale->text('No Company Address given') 
         . qq|!</a>\n|;
 
@@ -153,8 +145,7 @@ sub report {
   my $taxnumber_given = ($form->{steuernummer} ne '')
     ? qq|$form->{steuernummer}|
     : qq|<a href="ustva.pl?action="config_step1"|
-      . qq|&level=Programm--Finanzamteinstellungen&login=$form->{login}|
-      . qq|&password=$form->{password}">Keine Steuernummer hinterlegt!|
+      . qq|&level=Programm--Finanzamteinstellungen">Keine Steuernummer hinterlegt!|
       . qq|</a><br>|;
 
   my $ustva_vorauswahl = &ustva_vorauswahl();
@@ -217,7 +208,7 @@ sub report {
 
   };
   
-  print($form->parse_html_template2('ustva/report', $template_ref));
+  print($form->parse_html_template('ustva/report', $template_ref));
 
 
 
@@ -229,6 +220,8 @@ sub report {
 sub help {
   $lxdebug->enter_sub();
 
+  $auth->assert('advance_turnover_tax_return');
+
   # parse help documents under doc
   my $tmp = $form->{templates};
   $form->{templates} = 'doc';
@@ -244,6 +237,8 @@ sub help {
 sub show {
   $lxdebug->enter_sub();
 
+  $auth->assert('advance_turnover_tax_return');
+
   #&generate_ustva();
   no strict 'refs';
   $lxdebug->leave_sub();
@@ -254,6 +249,8 @@ sub show {
 sub ustva_vorauswahl {
   $lxdebug->enter_sub();
 
+  $auth->assert('advance_turnover_tax_return');
+
   my $select_vorauswahl;
 
   #Aktuelles Datum zerlegen:
@@ -490,6 +487,8 @@ sub debug {
 sub show_options {
   $lxdebug->enter_sub();
 
+  $auth->assert('advance_turnover_tax_return');
+
   #  $form->{PD}{$form->{type}} = "selected";
   #  $form->{DF}{$form->{format}} = "selected";
   #  $form->{OP}{$form->{media}} = "selected";
@@ -534,6 +533,8 @@ sub show_options {
 sub generate_ustva {
   $lxdebug->enter_sub();
 
+  $auth->assert('advance_turnover_tax_return');
+
   # Aufruf von get_config zum Einlesen der Finanzamtdaten aus finanzamt.ini
 
   USTVA->get_config($userspath, 'finanzamt.ini');
@@ -1030,7 +1031,6 @@ sub generate_ustva {
         dec_places  => '0',
     });
 
-    $form->{"Watchdog::USTVA"} = 1;
     $form->{USTVA} = [];
 
     if ( $form->{format} eq 'generic') { # Formatierungen für HTML Ausgabe
@@ -1069,7 +1069,7 @@ sub generate_ustva {
         taxnumber => $myconfig{taxnumber},
     };
 
-    print($form->parse_html_template2('ustva/generic_taxreport', $template_ref));
+    print($form->parse_html_template('ustva/generic_taxreport', $template_ref));
 
   } else
   { 
@@ -1084,6 +1084,8 @@ sub generate_ustva {
 sub config_step1 {
   $lxdebug->enter_sub();
 
+  $auth->assert('advance_turnover_tax_return');
+
   # edit all taxauthority prefs
 
   $form->header;
@@ -1093,14 +1095,6 @@ sub config_step1 {
   my $amt  = $form->{elsterFFFF};
 
 
-  if ($form->{cbscript} ne '' and $form->{cblogin} ne '') {
-    $callback =  qq|$form->{cbscript}|
-                .qq|?action="config_step1"|
-                .qq|&login="$form->{cblogin}"|
-                .qq|&root="$form->{cbroot}"|
-                .qq|&rpw="$form->{cbrpw}"|;
-  }
-
   $form->{title} = $locale->text('Tax Office Preferences');
 
 
@@ -1133,7 +1127,7 @@ sub config_step1 {
     FA_BLZ_2            FA_Kontonummer_2  FA_Bankbezeichnung_oertlich
     FA_Oeffnungszeiten  FA_Email          FA_Internet
     steuernummer        elsterland        elstersteuernummer
-    elsterFFFF          login             password
+    elsterFFFF
   );
 
   foreach my $variable (@_hidden_form_variables) {
@@ -1161,13 +1155,16 @@ sub config_step1 {
   };
   
   # Ausgabe des Templates
-  print($form->parse_html_template2('ustva/config_step1', $template_ref));
+  print($form->parse_html_template('ustva/config_step1', $template_ref));
 
   $lxdebug->leave_sub();
 }
 
 sub config_step2 {
   $lxdebug->enter_sub();
+
+  $auth->assert('advance_turnover_tax_return');
+
   $form->header();
 
 #  print qq|
@@ -1282,7 +1279,6 @@ sub config_step2 {
     FA_voranmeld            method
     FA_dauerfrist           FA_71 
     elster                  
-    login                   password 
     type                    elster_init 
     saved                   callback
   );
@@ -1301,7 +1297,7 @@ sub config_step2 {
   };
   
   # Ausgabe des Templates
-  print($form->parse_html_template2('ustva/config_step2', $template_ref));
+  print($form->parse_html_template('ustva/config_step2', $template_ref));
 
 
   $lxdebug->leave_sub();
@@ -1309,6 +1305,9 @@ sub config_step2 {
 
 sub create_steuernummer {
   $lxdebug->enter_sub();
+
+  $auth->assert('advance_turnover_tax_return');
+
   my $part           = $form->{part};
   my $patterncount   = $form->{patterncount};
   my $delimiter      = $form->{delimiter};
@@ -1346,6 +1345,8 @@ sub create_steuernummer {
 sub save {
   $lxdebug->enter_sub();
 
+  $auth->assert('advance_turnover_tax_return');
+
   my $filename = "$form->{login}_$form->{filename}";
   $filename =~ s|.*/||;
 
@@ -1426,6 +1427,9 @@ sub back {
 
 sub elster_hash {
   $lxdebug->enter_sub();
+
+  $auth->assert('advance_turnover_tax_return');
+
   my $finanzamt = USTVA->query_finanzamt(\%myconfig, \%$form);
   $lxdebug->leave_sub();
   return $finanzamt;