Den Rest von rc.pl auch noch aufgerÀumt.
[kivitendo-erp.git] / bin / mozilla / rc.pl
index e078295..7d4245b 100644 (file)
@@ -55,23 +55,19 @@ sub reconciliation {
   $::lxdebug->leave_sub;
 }
 
-sub continue { call_sub($main::form->{"nextsub"}); }
+sub continue { call_sub($::form->{"nextsub"}); }
 
 sub get_payments {
-  $main::lxdebug->enter_sub();
-
-  my $form     = $main::form;
-  my %myconfig = %main::myconfig;
-
-  $main::auth->assert('cash');
+  $::lxdebug->enter_sub;
+  $::auth->assert('cash');
 
-  ($form->{accno}, $form->{account}) = split /--/, $form->{accno};
+  ($::form->{accno}, $::form->{account}) = split /--/, $::form->{accno};
 
-  RC->payment_transactions(\%myconfig, \%$form);
+  RC->payment_transactions(\%::myconfig, $::form);
 
-  &display_form;
+  display_form();
 
-  $main::lxdebug->leave_sub();
+  $::lxdebug->leave_sub;
 }
 
 sub display_form {
@@ -129,62 +125,34 @@ sub display_form {
 }
 
 sub update {
-  $main::lxdebug->enter_sub();
-
-  my $form     = $main::form;
-  my %myconfig = %main::myconfig;
-
-  $main::auth->assert('cash');
+  $::lxdebug->enter_sub;
+  $::auth->assert('cash');
 
-  RC->payment_transactions(\%myconfig, \%$form);
+  RC->payment_transactions(\%::myconfig, $::form);
 
   my $i;
-  foreach my $ref (@{ $form->{PR} }) {
-    if (!$ref->{fx_transaction}) {
-      $i++;
-      $ref->{cleared} = ($form->{"cleared_$i"}) ? "checked" : "";
-    }
+  for my $ref (@{ $::form->{PR} }) {
+    next if $ref->{fx_transaction};
+    $i++;
+    $ref->{cleared} = $::form->{"cleared_$i"};
   }
 
-  &display_form;
-
-  $main::lxdebug->leave_sub();
-}
-
-sub select_all {
-  $main::lxdebug->enter_sub();
-
-  my $form     = $main::form;
-  my %myconfig = %main::myconfig;
-
-  $main::auth->assert('cash');
-
-  RC->payment_transactions(\%myconfig, \%$form);
-
-  map { $_->{cleared} = "checked" unless $_->{fx_transaction} }
-    @{ $form->{PR} };
-
-  &display_form;
+  display_form();
 
-  $main::lxdebug->leave_sub();
+  $::lxdebug->leave_sub;
 }
 
 sub done {
-  $main::lxdebug->enter_sub();
-
-  my $form     = $main::form;
-  my %myconfig = %main::myconfig;
-  my $locale   = $main::locale;
-
-  $main::auth->assert('cash');
+  $::lxdebug->enter_sub;
+  $::auth->assert('cash');
 
-  $form->{callback} = "$form->{script}?action=reconciliation";
+  $::form->{callback} = "$::form->{script}?action=reconciliation";
 
-  $form->error($locale->text('Out of balance!')) if ($form->{difference} *= 1);
+  $::form->error($::locale->text('Out of balance!')) if $::form->{difference} *= 1;
 
-  RC->reconcile(\%myconfig, \%$form);
-  $form->redirect;
+  RC->reconcile(\%::myconfig, $::form);
+  $::form->redirect;
 
-  $main::lxdebug->leave_sub();
+  $::lxdebug->leave_sub;
 }