Zum Vergleich des Buchabschlusses das höchste Zahlungsdatum heranziehen.
[kivitendo-erp.git] / bin / mozilla / is.pl
index 530c477..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};
 
-  # 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} };
-#  }
+  if ($form->{"oldcustomer"} !~ m/--\d+$/ && $form->{"customer_id"}) {
+    $form->{"oldcustomer"} .= qq|--$form->{"customer_id"}|
+  }
+
+
+#  $form->{oldcustomer} = "$form->{customer}--$form->{customer_id}";
+#  $form->{selectcustomer} = 1;
 
   $form->{employee} = "$form->{employee}--$form->{employee_id}";
 
@@ -408,7 +404,7 @@ sub form_footer {
   # follow ups
   if ($form->{id}) {
     $form->{follow_ups}            = FU->follow_ups('trans_id' => $form->{id}) || [];
-    $form->{follow_ups_unfinished} = sum map { $_->{due} * 1 } @{ $form->{follow_ups} };
+    $form->{follow_ups_unfinished} = ( sum map { $_->{due} * 1 } @{ $form->{follow_ups} } ) || 0;
   }
 
   # payments