From e6ffa928b78feb3cf0fa2c38da388144543a76dd Mon Sep 17 00:00:00 2001 From: Moritz Bunkus Date: Fri, 5 Feb 2010 15:23:27 +0100 Subject: [PATCH] Globale Variablen entfernt/umgewandelt. --- bin/mozilla/ap.pl | 14 ++++++-------- bin/mozilla/ca.pl | 44 ++++++++++++++++++-------------------------- bin/mozilla/ir.pl | 2 +- 3 files changed, 25 insertions(+), 35 deletions(-) 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| | . $locale->text('Total') . qq| - | . H($form->format_amount(\%myconfig, $totalpaid, 2)) . qq| + | . H($form->format_amount(\%myconfig, $form->{totalpaid}, 2)) . qq| @@ -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| | - 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| @@ -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 { |; - our $checked; print qq| @@ -283,48 +282,41 @@ sub list { | . $locale->text('Monthly') . qq| -   -  1. | . $locale->text('Quarter') . qq| -|; - $checked = "checked"; - print qq| -  | . $locale->text('January') . qq| -|; - $checked = ""; - print qq| -  | . $locale->text('May') . qq| -  | . $locale->text('September') . qq| +   +  1. | . $locale->text('Quarter') . qq| +  | . $locale->text('January') . qq| +  | . $locale->text('May') . qq| +  | . $locale->text('September') . qq|   -  2. | . $locale->text('Quarter') . qq| -  | . $locale->text('February') . qq| -  | . $locale->text('June') . qq| -  | . $locale->text('October') . qq| +  2. | . $locale->text('Quarter') . qq| +  | . $locale->text('February') . qq| +  | . $locale->text('June') . qq| +  | . $locale->text('October') . qq|   -  3. | . $locale->text('Quarter') . qq| -  | . $locale->text('March') . qq| -  | . $locale->text('July') . qq| -  | . $locale->text('November') . qq| +  3. | . $locale->text('Quarter') . qq| +  | . $locale->text('March') . qq| +  | . $locale->text('July') . qq| +  | . $locale->text('November') . qq|   -  4. | . $locale->text('Quarter') . qq|  -  | . $locale->text('April') . qq| -  | . $locale->text('August') . qq| -  | . $locale->text('December') . qq| +  4. | . $locale->text('Quarter') . qq|  +  | . $locale->text('April') . qq| +  | . $locale->text('August') . qq| +  | . $locale->text('December') . qq|
- | . $locale->text('Free report period') . qq| + | . $locale->text('Free report period') . qq| | . $locale->text('From') . qq|  $button1 $button1_2  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}; -- 2.20.1