employees direkt in der Datenbank sortieren.
authorSven Schöling <s.schoeling@linet-services.de>
Tue, 14 Aug 2012 10:50:02 +0000 (12:50 +0200)
committerSven Schöling <s.schoeling@linet-services.de>
Tue, 14 Aug 2012 10:50:02 +0000 (12:50 +0200)
SL/Form.pm

index a7ed01b..70d3a65 100644 (file)
@@ -2576,7 +2576,8 @@ sub all_vc {
   # setup sales contacts
   $query = qq|SELECT e.id, e.name
               FROM employee e
-              WHERE (e.sales = '1') AND (NOT e.id = ?)|;
+              WHERE (e.sales = '1') AND (NOT e.id = ?)
+              ORDER BY name|;
   $self->{all_employees} = selectall_hashref_query($self, $dbh, $query, $self->{employee_id});
 
   # this is for self
@@ -2584,11 +2585,6 @@ sub all_vc {
        { id   => $self->{employee_id},
          name => $self->{employee} });
 
-  # sort the whole thing
-  @{ $self->{all_employees} } =
-    sort { $a->{name} cmp $b->{name} } @{ $self->{all_employees} };
-
-
     # prepare query for departments
     $query = qq|SELECT id, description
                 FROM department