Import von Lieferadressen.
[kivitendo-erp.git] / bin / mozilla / is.pl
index 740002b..2d833b6 100644 (file)
@@ -94,14 +94,6 @@ sub edit {
   $form->{javascript} = qq|<script type="text/javascript" src="js/show_history.js"></script>|;
   #/show hhistory button
 
-  if ($form->{type} eq "credit_note") {
-    $form->{title} = $locale->text('Edit Credit Note');
-    $form->{title} = $locale->text('Edit Storno Credit Note') if $form->{storno};
-  } else {
-    $form->{title} = $locale->text('Edit Sales Invoice');
-    $form->{title} = $locale->text('Edit Storno Invoice')     if $form->{storno};
-  }
-
   my ($language_id, $printer_id);
   if ($form->{print_and_post}) {
     $form->{action}   = "print";
@@ -109,7 +101,16 @@ sub edit {
     $language_id = $form->{language_id};
     $printer_id = $form->{printer_id};
   }
+
   &invoice_links;
+  if ($form->{type} eq "credit_note") {
+    $form->{title} = $locale->text('Edit Credit Note');
+    $form->{title} = $locale->text('Edit Storno Credit Note') if $form->{storno};
+  } else {
+    $form->{title} = $locale->text('Edit Sales Invoice');
+    $form->{title} = $locale->text('Edit Storno Invoice')     if $form->{storno};
+  }
+
   &prepare_invoice;
   if ($form->{print_and_post}) {
     $form->{language_id} = $language_id;
@@ -132,8 +133,8 @@ sub invoice_links {
   $form->{vc} = 'customer';
 
   # create links
-  $form->{webdav}   = $main::webdav;
-  $form->{lizenzen} = $main::lizenzen;
+  $form->{webdav}   = $::lx_office_conf{features}->{webdav};
+  $form->{lizenzen} = $::lx_office_conf{features}->{lizenzen};
 
   $form->create_links("AR", \%myconfig, "customer");
 
@@ -332,7 +333,7 @@ sub form_header {
   my @values = map { $_       } @{ $form->{ALL_CURRENCIES} };
   my %labels = map { $_ => $_ } @{ $form->{ALL_CURRENCIES} };
   $form->{currency}            = $form->{defaultcurrency} unless $form->{currency};
-  $TMPL_VAR{show_exchangerate} = $form->{currency} ne $form->{defaultcurrency};
+  $form->{show_exchangerate}   = $form->{currency} ne $form->{defaultcurrency};
   $TMPL_VAR{currencies}        = NTI($::cgi->popup_menu('-name' => 'currency', '-default' => $form->{"currency"},
                                                       '-values' => \@values, '-labels' => \%labels)) if scalar @values;
   push @custom_hiddens, "forex";
@@ -472,7 +473,7 @@ sub update {
 
   $main::auth->assert('invoice_edit');
 
-  my ($recursive_call) = shift;
+  my ($recursive_call) = @_;
 
   $form->{exchangerate} = $form->parse_amount(\%myconfig, $form->{exchangerate}) unless $recursive_call;
 
@@ -561,7 +562,7 @@ sub update {
 
         $form->{"qty_$i"} = $form->format_amount(\%myconfig, $form->{"qty_$i"});
 
-        if ($main::lizenzen) {
+        if ($::lx_office_conf{features}->{lizenzen}) {
           if ($form->{"inventory_accno_$i"} ne "") {
             $form->{"lizenzen_$i"} = qq|<option></option>|;
             foreach my $item (@{ $form->{LIZENZEN}{ $form->{"id_$i"} } }) {
@@ -915,7 +916,8 @@ sub credit_note {
   $form->{title}  = $locale->text('Add Credit Note');
   $form->{script} = 'is.pl';
 
-
+  # Bei Gutschriften bezug zur Rechnungsnummer
+  $form->{invnumber_for_credit_note} = $form->{invnumber};
   # bo creates the id, reset it
   map { delete $form->{$_} }
     qw(id invnumber subject message cc bcc printed emailed queued);
@@ -964,7 +966,7 @@ sub yes {
 
   $main::auth->assert('invoice_edit');
 
-  if (IS->delete_invoice(\%myconfig, \%$form, $main::spool)) {
+  if (IS->delete_invoice(\%myconfig, \%$form)) {
     # saving the history
     if(!exists $form->{addition}) {
     $form->{snumbers} = qq|invnumber_| . $form->{invnumber};