Webdav: Wenn eine Pfadkomponente Leerzeichen enthielt (z.B. "Storno zu ..."), dann...
[kivitendo-erp.git] / SL / CA.pm
index 089bcdc..76d2b32 100644 (file)
--- a/SL/CA.pm
+++ b/SL/CA.pm
@@ -347,7 +347,9 @@ sub all_transactions {
     $union = qq|UNION ALL|;
   }
 
-  $query .= qq|ORDER BY | . $form->{sort};
+  my $sort = grep({ $form->{sort} eq $_ } qw(transdate reference description)) ? $form->{sort} : 'transdate';
+
+  $query .= qq|ORDER BY $sort|;
   $sth = prepare_execute_query($form, $dbh, $query, @values);
 
   $form->{CA} = [];
@@ -370,6 +372,8 @@ sub all_transactions {
       $ca->{debit}  = 0;
     }
 
+    $ca->{index} = join "--", map { $ca->{$_} } qw(id reference description);
+
     push(@{ $form->{CA} }, $ca);
 
   }