Favicon inserted.
[kivitendo-erp.git] / SL / Form.pm
index 80ff5ac..32ff29e 100644 (file)
@@ -366,6 +366,8 @@ sub header {
  |;
     }
 
+    $self->{favicon}    = "favicon.ico" unless $self->{favicon};
+
     if ($self->{favicon} && (-f "$self->{favicon}")) {
       $favicon =
         qq|<LINK REL="shortcut icon" HREF="$self->{favicon}" TYPE="image/x-icon">
@@ -773,7 +775,10 @@ sub parse_template {
   $self->{"notes"} = $self->{ $self->{"formname"} . "notes" };
 
   map({ $self->{"employee_${_}"} = $myconfig->{$_}; }
-      qw(email tel fax name signature company address businessnumber));
+      qw(email tel fax name signature company address businessnumber
+         co_ustid taxnumber duns));
+  map({ $self->{"employee_${_}"} =~ s/\\n/\n/g; }
+      qw(company address signature));
 
   $self->{copies} = 1 if (($self->{copies} *= 1) <= 0);
 
@@ -799,9 +804,6 @@ sub parse_template {
   }
 
   close(OUT);
-  
-  use Data::Dumper;
-  #print(STDERR Dumper($self));
 
   if ($template->uses_temp_file() || $self->{media} eq 'email') {
 
@@ -1146,6 +1148,13 @@ sub set_payment_options {
     $self->{payment_terms} =~ s/<%netto_date%>/$self->{netto_date}/g;
     $self->{payment_terms} =~ s/<%skonto_date%>/$self->{skonto_date}/g;
     $self->{payment_terms} =~ s/<%skonto_amount%>/$self->{skonto_amount}/g;
+    $self->{payment_terms} =~ s/<%total%>/$self->{total}/g;
+    $self->{payment_terms} =~ s/<%invtotal%>/$self->{invtotal}/g;
+    $self->{payment_terms} =~ s/<%currency%>/$self->{currency}/g;
+    $self->{payment_terms} =~ s/<%terms_netto%>/$self->{terms_netto}/g;
+    $self->{payment_terms} =~ s/<%account_number%>/$self->{account_number}/g;
+    $self->{payment_terms} =~ s/<%bank%>/$self->{bank}/g;
+    $self->{payment_terms} =~ s/<%bank_code%>/$self->{bank_code}/g;
 
     $dbh->disconnect;
   }
@@ -1326,6 +1335,24 @@ sub get_employee {
   $main::lxdebug->leave_sub();
 }
 
+sub get_duedate {
+  $main::lxdebug->enter_sub();
+
+  my ($self, $myconfig) = @_;
+
+  my $dbh = $self->dbconnect($myconfig);
+  my $query = qq|SELECT current_date+terms_netto FROM payment_terms
+                 WHERE id = '$self->{payment_id}'|;
+  my $sth = $dbh->prepare($query);
+  $sth->execute || $self->dberror($query);
+
+  ($self->{duedate}) = $sth->fetchrow_array;
+
+  $sth->finish;
+
+  $main::lxdebug->leave_sub();
+}
+
 # get other contact for transaction and form - html/tex
 sub get_contact {
   $main::lxdebug->enter_sub();