//New Features request - Team with its users and this is 4th option in mobile. //Added by Yesha -5-08-2019 public function lat_query_db_teams($module_name, $seed, $where) { $file_path = realpath(__FILE__); $GLOBALS['log']->setLevel('njdev'); if (!$this->checkQuery($error, $where)) { $GLOBALS['log']->info('End: SugarWebServiceImpl->get_entries_count'); return; } if (!$this->checkACLAccess($seed, 'ListView', $error, 'no_access')) { return; } $sql = 'SELECT * FROM ' . $seed->table_name . ' '; $seed->add_team_security_where_clause($sql); $customJoin = $seed->getCustomJoin(); $sql .= $customJoin['join']; if (!empty($where)) { $sql .= ' WHERE ' . implode(' AND ', $where); } // $GLOBALS['log']->njdev("SQL 123: " . print_r($sql, true)); $res = $GLOBALS['db']->query($sql); return $res; } public function get_name_value_list_for_teams_and_users() { $file_path = realpath(__FILE__); $GLOBALS['log']->setLevel('njdev'); global $app_list_strings, $sugar_config, $current_user, $timedate, $beanList, $beanFiles; $module_name = 'Teams'; $class_name = $beanList[$module_name]; require_once $beanFiles[$class_name]; $seed = new $class_name(); $where = array(); $where[] = "deleted = 0"; $where[] = "private = 0"; $get_team = $this->lat_query_db_teams($module_name, $seed, $where); $return_entry_list = array(); $ct=0; while ($row = $GLOBALS['db']->fetchByAssoc($get_team)) { // echo $row['name'];die; $return_entry_list['entry_list'][$ct]['id'] = $row['id']; $return_entry_list['entry_list'][$ct]['team_name'] = $row['name']; //Get Users according to the team // include Team class include_once('modules/Teams/Team.php'); $team = new Team(); $team->retrieve($row['id']); $team_members = $team->get_team_members(true); // // file_put_contents('team_users.txt', print_r($team_members, true));die; foreach ($team_members as $key => $value) { // $GLOBALS['log']->njdev('getallteam',$file_path,$value->full_name); if($value->id == ''){ $pass_id = ''; }else{ $pass_id = $value->id; } $return_entry_list['entry_list'][$ct]['team_members'][$key]['id'] = $pass_id; $return_entry_list['entry_list'][$ct]['team_members'][$key]['team_member_name'] = $value->full_name; } $ct++; } // print_r($queryy); return $return_entry_list; } //New Features request End code