Zum Vergleich des Buchabschlusses das höchste Zahlungsdatum heranziehen.
[kivitendo-erp.git] / bin / mozilla / is.pl
index 258e620..b1aa9f3 100644 (file)
@@ -45,7 +45,6 @@ require "bin/mozilla/drafts.pl";
 use strict;
 
 my $edit;
-my $payment;
 my $print_post;
 
 1;
@@ -169,18 +168,15 @@ sub invoice_links {
     $form->{customer}         = qq|$form->{customer}--$form->{"customer_id"}|;
   }
 
-  $form->{oldcustomer} = "$form->{customer}--$form->{customer_id}";
-  $form->{selectcustomer} = 1;
+  $form->{"oldcustomer"}  = $form->{customer};
+
+  if ($form->{"oldcustomer"} !~ m/--\d+$/ && $form->{"customer_id"}) {
+    $form->{"oldcustomer"} .= qq|--$form->{"customer_id"}|
+  }
 
-  # departments
-#  if ($form->{all_departments}) {
-#    $form->{selectdepartment} = "<option>\n";
-#    $form->{department}       = "$form->{department}--$form->{department_id}";
-#
-#    map {
-#      $form->{selectdepartment} .= "<option>$_->{description}--$_->{id}</option>\n"
-#    } @{ $form->{all_departments} };
-#  }
+
+#  $form->{oldcustomer} = "$form->{customer}--$form->{customer_id}";
+#  $form->{selectcustomer} = 1;
 
   $form->{employee} = "$form->{employee}--$form->{employee_id}";
 
@@ -289,15 +285,6 @@ sub form_header {
   $form->{defaultcurrency} = $form->get_default_currency(\%myconfig);
   $form->{radier}          = ($form->current_date(\%myconfig) eq $form->{gldate}) ? 1 : 0;
 
-  $payment = qq|<option value=""></option>|;
-  foreach my $item (@{ $form->{payment_terms} }) {
-    if ($form->{payment_id} eq $item->{id}) {
-      $payment .= qq|<option value="$item->{id}" selected>$item->{description}</option>|;
-    } else {
-      $payment .= qq|<option value="$item->{id}">$item->{description}</option>|;
-    }
-  }
-
   my $set_duedate_url = "$form->{script}?action=set_duedate";
 
   push @ { $form->{AJAX} }, new CGI::Ajax( 'set_duedate' => $set_duedate_url );
@@ -414,14 +401,10 @@ sub form_footer {
     }
   }
 
-  # unfortunately locales doesn't support extended syntax
+  # follow ups
   if ($form->{id}) {
-    my $follow_ups = FU->follow_ups('trans_id' => $form->{id});
-    if (@{ $follow_ups} ) {
-      $form->{follow_up_text} = $locale->text("There are #1 unfinished follow-ups of which #2 are due.",
-                                               scalar(@{ $follow_ups }),
-                                               sum map { $_->{due} * 1 } @{ $follow_ups });
-    }
+    $form->{follow_ups}            = FU->follow_ups('trans_id' => $form->{id}) || [];
+    $form->{follow_ups_unfinished} = ( sum map { $_->{due} * 1 } @{ $form->{follow_ups} } ) || 0;
   }
 
   # payments