backup_vars und restore_vars bei Einkaufsrechnungen verwenden, ...
authorBernd Bleßmann <bernd@kivitendo-premium.de>
Mon, 6 Jan 2014 15:00:26 +0000 (16:00 +0100)
committerBernd Bleßmann <bernd@kivitendo-premium.de>
Mon, 6 Jan 2014 15:00:26 +0000 (16:00 +0100)
anstatt alle Variablen einzeln zu sichern.

bin/mozilla/ir.pl

index a91f8a4..46e32fa 100644 (file)
@@ -116,49 +116,14 @@ sub invoice_links {
     }
   }
 
-  my ($payment_id, $language_id, $taxzone_id, $currency, $delivery_term_id, $intnotes);
-  if ($form->{payment_id}) {
-    $payment_id = $form->{payment_id};
-  }
-  if ($form->{language_id}) {
-    $language_id = $form->{language_id};
-  }
-  if ($form->{taxzone_id}) {
-    $taxzone_id = $form->{taxzone_id};
-  }
-  if ($form->{currency}) {
-    $currency = $form->{currency};
-  }
-  if ($form->{delivery_term_id}) {
-    $delivery_term_id = $form->{delivery_term_id};
-  }
-  if (exists $form->{intnotes}) {
-    $intnotes = $form->{intnotes};
-  }
+  $form->backup_vars(qw(payment_id language_id taxzone_id
+                        currency delivery_term_id intnotes cp_id));
 
-  my $cp_id = $form->{cp_id};
   IR->get_vendor(\%myconfig, \%$form);
   IR->retrieve_invoice(\%myconfig, \%$form);
-  $form->{cp_id} = $cp_id;
 
-  if ($payment_id) {
-    $form->{payment_id} = $payment_id;
-  }
-  if ($language_id) {
-    $form->{language_id} = $language_id;
-  }
-  if ($taxzone_id) {
-    $form->{taxzone_id} = $taxzone_id;
-  }
-  if ($currency) {
-    $form->{currency} = $currency;
-  }
-  if ($delivery_term_id) {
-    $form->{delivery_term_id} = $delivery_term_id;
-  }
-  if (defined $intnotes) {
-    $form->{intnotes} = $intnotes;
-  }
+  $form->restore_vars(qw(payment_id language_id taxzone_id
+                         currency delivery_term_id intnotes cp_id));
 
   my @curr = $form->get_all_currencies();
   map { $form->{selectcurrency} .= "<option>$_\n" } @curr;