]> wagnertech.de Git - kivitendo-erp.git/blobdiff - SL/IS.pm
Request: Durch das spätere mergen ist Rückkopieren jetzt unnötig.
[kivitendo-erp.git] / SL / IS.pm
index da801fd5296272beaa6404b18a7f7cdfdac0cfe6..3aa0d3ca988b3ff084094eac68067c67346cfc34 100644 (file)
--- a/SL/IS.pm
+++ b/SL/IS.pm
@@ -353,7 +353,9 @@ sub invoice_details {
         $sth->finish;
       }
 
-      map { push @{ $form->{TEMPLATE_ARRAYS}->{"ic_cvar_$_->{name}"} }, $form->{"ic_cvar_$_->{name}_$i"} } @{ $ic_cvar_configs };
+      push @{ $form->{TEMPLATE_ARRAYS}->{"ic_cvar_$_->{name}"} },
+        CVar->format_to_template(CVar->parse($form->{"ic_cvar_$_->{name}_$i"}, $_), $_)
+          for @{ $ic_cvar_configs };
     }
   }
 
@@ -877,7 +879,7 @@ sub post_invoice {
   # record payments and offsetting AR
   if (!$form->{storno}) {
     for my $i (1 .. $form->{paidaccounts}) {
-      
+
       if ($form->{"acc_trans_id_$i"}
           && $payments_only
           && ($::lx_office_conf{features}->{payments_changeable} == 0)) {
@@ -1438,7 +1440,7 @@ sub retrieve_invoice {
 
   my ($sth, $ref, $query);
 
-  my $query_transdate = ", current_date AS invdate" if !$form->{id};
+  my $query_transdate = !$form->{id} ? ", current_date AS invdate" : '';
 
   $query =
     qq|SELECT
@@ -1478,6 +1480,8 @@ sub retrieve_invoice {
     $ref = selectfirst_hashref_query($form, $dbh, $query, $id);
     map { $form->{$_} = $ref->{$_} } keys %{ $ref };
 
+    # remove any trailing whitespace
+    $form->{currency} =~ s/\s*$//;
 
     $form->{exchangerate} = $form->get_exchangerate($dbh, $form->{currency}, $form->{invdate}, "buy");