commit e6ffa928b78feb3cf0fa2c38da388144543a76dd
Author: Moritz Bunkus <m.bunkus@linet.de>
Date:   Fri Feb 5 15:23:27 2010 +0100

    Globale Variablen entfernt/umgewandelt.

diff --git a/bin/mozilla/ap.pl b/bin/mozilla/ap.pl
index 1262b49f7..c815dd0f1 100644
--- a/bin/mozilla/ap.pl
+++ b/bin/mozilla/ap.pl
@@ -661,7 +661,7 @@ $jsscript
 ";
 
   my @triggers  = ();
-  my $totalpaid = 0;
+  $form->{totalpaid} = 0;
 
   $form->{paidaccounts}++ if ($form->{"paid_$form->{paidaccounts}"});
   for my $i (1 .. $form->{paidaccounts}) {
@@ -676,7 +676,7 @@ $jsscript
                            '-labels' => \%AP_paid_labels,
                            '-default' => $form->{"AP_paid_$i"}));
 
-    $totalpaid += $form->{"paid_$i"};
+    $form->{totalpaid} += $form->{"paid_$i"};
 
     # format amounts
     if ($form->{"paid_$i"}) {
@@ -732,14 +732,14 @@ $jsscript
     push(@triggers, "datepaid_$i", "BL", "trigger_datepaid_$i");
   }
 
-  my $paid_missing = $form->{invtotal_unformatted} - $totalpaid;
+  my $paid_missing = $form->{invtotal_unformatted} - $form->{totalpaid};
 
   print qq|
         <tr>
           <td></td>
           <td></td>
           <td align="center">| . $locale->text('Total') . qq|</td>
-          <td align="center">| . H($form->format_amount(\%myconfig, $totalpaid, 2)) . qq|</td>
+          <td align="center">| . H($form->format_amount(\%myconfig, $form->{totalpaid}, 2)) . qq|</td>
         </tr>
         <tr>
           <td></td>
@@ -818,9 +818,8 @@ $follow_ups_block
 |;
     }
     # ToDO: - insert a global check for stornos, so that a storno is only possible a limited time after saving it
-    our $total_paid;
     print qq| <input class=submit type=submit name=action value="| . $locale->text('Storno') . qq|"> |
-      if ($form->{id} && !IS->has_storno(\%myconfig, $form, 'ap') && !IS->is_storno(\%myconfig, $form, 'ap', $form->{id}) && (($total_paid == 0) || ($total_paid eq "")));
+      if ($form->{id} && !IS->has_storno(\%myconfig, $form, 'ap') && !IS->is_storno(\%myconfig, $form, 'ap', $form->{id}) && (($form->{totalpaid} == 0) || ($form->{totalpaid} eq "")));
 
     print qq| <input class=submit type=submit name=action value="| . $locale->text('Post Payment') . qq|">
               <input class=submit type=submit name=action value="| . $locale->text('Use As Template') . qq|">
@@ -973,7 +972,6 @@ sub post_payment {
 
   $form->{defaultcurrency} = $form->get_default_currency(\%myconfig);
 
-  our $invdate;
   for my $i (1 .. $form->{paidaccounts}) {
     if ($form->parse_amount(\%myconfig, $form->{"paid_$i"})) {
       my $datepaid = $form->datetonum($form->{"datepaid_$i"}, \%myconfig);
@@ -985,7 +983,7 @@ sub post_payment {
 
       if ($form->{defaultcurrency} && ($form->{currency} ne $form->{defaultcurrency})) {
         $form->{"exchangerate_$i"} = $form->{exchangerate}
-          if ($invdate == $datepaid);
+          if ($form->{transdate} == $datepaid);
         $form->isblank("exchangerate_$i",
                        $locale->text('Exchangerate for payment missing!'));
       }
diff --git a/bin/mozilla/ca.pl b/bin/mozilla/ca.pl
index 8aeabdce5..a58ac1e26 100644
--- a/bin/mozilla/ca.pl
+++ b/bin/mozilla/ca.pl
@@ -274,7 +274,6 @@ sub list {
         </tr>
 |;
 
-    our $checked;
     print qq|
         <tr>
                 <td align=right>
@@ -283,48 +282,41 @@ sub list {
                 <th align=left colspan=3>| . $locale->text('Monthly') . qq|</th>
         </tr>
         <tr>
-                <td align=right>&nbsp; <input name=duetyp class=radio type=radio value="13"
-$checked></td>
-                <td><input name=duetyp class=radio type=radio value="A" $checked >&nbsp;1. | . $locale->text('Quarter') . qq|</td>
-|;
-    $checked = "checked";
-    print qq|
-                <td><input name=duetyp class=radio type=radio value="1" $checked >&nbsp;| . $locale->text('January') . qq|</td>
-|;
-    $checked = "";
-    print qq|
-                <td><input name=duetyp class=radio type=radio value="5" $checked >&nbsp;| . $locale->text('May') . qq|</td>
-                <td><input name=duetyp class=radio type=radio value="9" $checked >&nbsp;| . $locale->text('September') . qq|</td>
+                <td align=right>&nbsp; <input name=duetyp class=radio type=radio value="13"></td>
+                <td><input name=duetyp class=radio type=radio value="A">&nbsp;1. | . $locale->text('Quarter') . qq|</td>
+                <td><input name=duetyp class=radio type=radio value="1" "checked">&nbsp;| . $locale->text('January') . qq|</td>
+                <td><input name=duetyp class=radio type=radio value="5" >&nbsp;| . $locale->text('May') . qq|</td>
+                <td><input name=duetyp class=radio type=radio value="9" >&nbsp;| . $locale->text('September') . qq|</td>
 
         </tr>
         <tr>
                 <td align= right>&nbsp;</td>
-                <td><input name=duetyp class=radio type=radio value="B" $checked>&nbsp;2. | . $locale->text('Quarter') . qq|</td>
-                <td><input name=duetyp class=radio type=radio value="2" $checked >&nbsp;| . $locale->text('February') . qq|</td>
-                <td><input name=duetyp class=radio type=radio value="6" $checked >&nbsp;| . $locale->text('June') . qq|</td>
-                <td><input name=duetyp class=radio type=radio value="10" $checked >&nbsp;| . $locale->text('October') . qq|</td>
+                <td><input name=duetyp class=radio type=radio value="B">&nbsp;2. | . $locale->text('Quarter') . qq|</td>
+                <td><input name=duetyp class=radio type=radio value="2" >&nbsp;| . $locale->text('February') . qq|</td>
+                <td><input name=duetyp class=radio type=radio value="6" >&nbsp;| . $locale->text('June') . qq|</td>
+                <td><input name=duetyp class=radio type=radio value="10" >&nbsp;| . $locale->text('October') . qq|</td>
         </tr>
         <tr>
                 <td> &nbsp;</td>
-                <td><input name=duetyp class=radio type=radio value="C" $checked>&nbsp;3. | . $locale->text('Quarter') . qq|</td>
-                <td><input name=duetyp class=radio type=radio value="3" $checked >&nbsp;| . $locale->text('March') . qq|</td>
-                <td><input name=duetyp class=radio type=radio value="7" $checked >&nbsp;| . $locale->text('July') . qq|</td>
-                <td><input name=duetyp class=radio type=radio value="11" $checked >&nbsp;| . $locale->text('November') . qq|</td>
+                <td><input name=duetyp class=radio type=radio value="C">&nbsp;3. | . $locale->text('Quarter') . qq|</td>
+                <td><input name=duetyp class=radio type=radio value="3" >&nbsp;| . $locale->text('March') . qq|</td>
+                <td><input name=duetyp class=radio type=radio value="7" >&nbsp;| . $locale->text('July') . qq|</td>
+                <td><input name=duetyp class=radio type=radio value="11" >&nbsp;| . $locale->text('November') . qq|</td>
 
         </tr>
         <tr>
                 <td> &nbsp;</td>
-                <td><input name=duetyp class=radio type=radio value="D" $checked>&nbsp;4. | . $locale->text('Quarter') . qq|&nbsp;</td>
-                <td><input name=duetyp class=radio type=radio value="4" $checked >&nbsp;| . $locale->text('April') . qq|</td>
-                <td><input name=duetyp class=radio type=radio value="8" $checked >&nbsp;| . $locale->text('August') . qq|</td>
-                <td><input name=duetyp class=radio type=radio value="12" $checked >&nbsp;| . $locale->text('December') . qq|</td>
+                <td><input name=duetyp class=radio type=radio value="D">&nbsp;4. | . $locale->text('Quarter') . qq|&nbsp;</td>
+                <td><input name=duetyp class=radio type=radio value="4" >&nbsp;| . $locale->text('April') . qq|</td>
+                <td><input name=duetyp class=radio type=radio value="8" >&nbsp;| . $locale->text('August') . qq|</td>
+                <td><input name=duetyp class=radio type=radio value="12" >&nbsp;| . $locale->text('December') . qq|</td>
 
         </tr>
         <tr>
                    <td colspan=5><hr size=3 noshade></td>
         </tr>
         <tr>
-          <th align=left><input name=reporttype class=radio type=radio value="free" $checked> | . $locale->text('Free report period') . qq|</th>
+          <th align=left><input name=reporttype class=radio type=radio value="free"> | . $locale->text('Free report period') . qq|</th>
           <td align=left colspan=4>| . $locale->text('From') . qq|&nbsp;
               $button1
               $button1_2&nbsp;
diff --git a/bin/mozilla/ir.pl b/bin/mozilla/ir.pl
index 1119ad426..03b605ee6 100644
--- a/bin/mozilla/ir.pl
+++ b/bin/mozilla/ir.pl
@@ -258,7 +258,7 @@ sub form_header {
 
   $main::auth->assert('invoice_edit');
 
-  our %TMPL_VAR = ();
+  my %TMPL_VAR = ();
   my @custom_hiddens;
 
   $form->{employee_id} = $form->{old_employee_id} if $form->{old_employee_id};
