Changeset 4768 in subversion


Ignore:
Timestamp:
May 14, 2011 10:38:27 AM (2 years ago)
Author:
thomasb
Message:

Fix sort order when contact name is empty

Location:
trunk/roundcubemail/program/include
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/roundcubemail/program/include/rcube_contacts.php

    r4764 r4768  
    185185                ($this->group_id ? " AND m.contactgroup_id=?" : ""). 
    186186                ($this->filter ? " AND (".$this->filter.")" : "") . 
    187             " ORDER BY c.name, c.email", 
     187            " ORDER BY ". $this->db->concat('c.name', 'c.email'), 
    188188            $start_row, 
    189189            $length, 
  • trunk/roundcubemail/program/include/rcube_mdb2.php

    r4747 r4768  
    601601    } 
    602602 
     603    /** 
     604     * Abstract SQL statement for value concatenation 
     605     * 
     606     * @return string SQL statement to be used in query 
     607     * @access public 
     608     */ 
     609    function concat(/* col1, col2, ... */) 
     610    { 
     611        $func = ''; 
     612        switch($this->db_provider) { 
     613            case 'mysql': 
     614            case 'mysqli': 
     615                $func = 'CONCAT'; 
     616                $delim = ', '; 
     617                break; 
     618            case 'mssql': 
     619            case 'sqlsrv': 
     620                $delim = ' + '; 
     621                break; 
     622            default: 
     623                $delim = ' || '; 
     624        } 
     625         
     626        return $func . '(' . join($delim, func_get_args()) . ')'; 
     627    } 
     628 
    603629 
    604630    /** 
Note: See TracChangeset for help on using the changeset viewer.