diff --git a/src/Cobalt/Helper/DropdownHelper.php b/src/Cobalt/Helper/DropdownHelper.php index 0f4c20ec..a8f4d9bb 100644 --- a/src/Cobalt/Helper/DropdownHelper.php +++ b/src/Cobalt/Helper/DropdownHelper.php @@ -473,7 +473,11 @@ public static function getTeams($team=null) $query = $db->getQuery(true); //query string //u.id// - $query->select("t.team_id AS id,u.first_name,u.last_name,u.team_id,IF(t.name!=" . $db->quote('') . ",t.name," . $query->concatenate(array('u.first_name', $db->quote(' '), 'u.last_name')) . " AS team_name"); + $query->select("t.team_id AS id,u.first_name,u.last_name,u.team_id, + CASE t.name + WHEN '' THEN " . $query->concatenate(array('u.first_name', $db->quote(' '), 'u.last_name')) . " + ELSE t.name + END AS team_name"); $query->from("#__users AS u"); $query->leftJoin("#__teams AS t on t.leader_id = u.id"); $query->where("u.role_type=" . $db->quote('manager')); diff --git a/src/Cobalt/Model/Formwizard.php b/src/Cobalt/Model/Formwizard.php index 992d9996..81d54e9f 100644 --- a/src/Cobalt/Model/Formwizard.php +++ b/src/Cobalt/Model/Formwizard.php @@ -118,9 +118,9 @@ public function _buildQuery() $db = $this->getDb(); $query = $db->getQuery(true); $query - ->select("f.*," . $query->concatenate(array('user.first_name', $db->quote(' '), 'user.last_name')) . " AS owner_name") + ->select("f.*," . $query->concatenate(array('users.first_name', $db->quote(' '), 'users.last_name')) . " AS owner_name") ->from("#__formwizard AS f") - ->leftJoin("#__users AS user ON user.id = f.owner_id"); + ->leftJoin("#__users AS users ON user.id = f.owner_id"); return $query; } @@ -149,7 +149,7 @@ public function getForms() $query->order($this->getState()->get('Formwizard.filter_order') . ' ' . $this->getState()->get('Formwizard.filter_order_Dir')); $this->db->setQuery($query, $limitStart, $limit); - + $results = $this->db->loadAssocList(); if (count($results) > 0) diff --git a/src/Cobalt/Model/Report.php b/src/Cobalt/Model/Report.php index f37b283e..bd58603c 100644 --- a/src/Cobalt/Model/Report.php +++ b/src/Cobalt/Model/Report.php @@ -156,7 +156,7 @@ public function getCustomReportData($id = null) $queryString .= 'stat.name as status_name,'; $queryString .= 'source.name as source_name,'; $queryString .= 'stage.name as stage_name,stage.percent,'; - $queryString .= 'user.first_name, user.last_name,'; + $queryString .= 'users.first_name, users.last_name,'; $queryString .= 'p.first_name as primary_contact_first_name,p.last_name as primary_contact_last_name,'; $queryString .= "p.email as primary_contact_email,p.phone as primary_contact_phone,"; $queryString .= "pc.name as primary_contact_company_name"; @@ -170,7 +170,7 @@ public function getCustomReportData($id = null) $query->leftJoin('#__deal_status AS stat ON stat.id = d.status_id'); $query->leftJoin('#__sources AS source ON source.id = d.source_id'); $query->leftJoin('#__stages AS stage on stage.id = d.stage_id'); - $query->leftJoin('#__users AS user ON user.id = d.owner_id'); + $query->leftJoin('#__users AS users ON users.id = d.owner_id'); $query->leftJoin("#__people AS p ON p.id = d.primary_contact_id && p.published>0"); $query->leftJoin("#__companies AS pc ON pc.id = p.company_id && pc.published>0"); diff --git a/src/Cobalt/Model/Users.php b/src/Cobalt/Model/Users.php index 7313b247..392460fe 100644 --- a/src/Cobalt/Model/Users.php +++ b/src/Cobalt/Model/Users.php @@ -145,7 +145,10 @@ public function _buildQuery() $query->select("u.*,ju.username,ju.email,ju.lastvisitDate as last_login, team_leader.first_name as leader_first_name,team_leader.last_name as leader_last_name, team.leader_id as leader_id, - IF(team.name!='',team.name," . $query->concatenate(array('team_leader.first_name', $this->db->quote(' '), 'team_leader.last_name')) . ") AS team_name"); + CASE team.name + WHEN '' THEN " . $query->concatenate(array('team_leader.first_name', $this->db->quote(' '), 'team_leader.last_name')) . " + ELSE team.name + END AS team_name"); $query->from("#__users AS u"); //left join essential data