View difference between Paste ID: gKNsgFxD and QLdmJxdA
SHOW: | | - or go back to the newest paste.
1
   /**
2
    * @param int advisors id
3
    * @return array
4
    * @final
5
    */
6
    final public function getClients($advisors = null) {
7-
        $fluent = $this->db->select("id, CONCAT_WS(' ', id, titul, prijmeni, jmeno) AS klient")->from(self::clientsTable);
7+
        $fluent = $this->db->select('id')
8-
        if($advisors != null)
8+
		->select("CONCAT_WS(' ', titul, prijmeni, jmeno) AS klient")
9-
            $fluent->where('poradce = %i', $advisors);   
9+
		->select("IFNULL(klient, nazevSpolecnosti) as klient")
10
		->select("CONCAT_WS(' ', id, klient) as klient")
11
		->from(self::clientsTable);
12
13
	if($advisors != null) {
14
		$fluent->where('poradce = %i', $advisors);
15
	}
16
        return $fluent->OrderBy('zalozen DESC')->fetchPairs('id', 'klient');            
17
    }