本文整理汇总了PHP中Team::new_user_created方法的典型用法代码示例。如果您正苦于以下问题:PHP Team::new_user_created方法的具体用法?PHP Team::new_user_created怎么用?PHP Team::new_user_created使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Team
的用法示例。
在下文中一共展示了Team::new_user_created方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: Team
$user->db->query($query);
$query = "update team_memberships set implicit_assign=0";
$user->db->query($query);
$query = "delete from team_memberships where implicit_assign=0 and explicit_assign=0";
$user->db->query($query);
//delete all records for membership into global team.
$query = "delete from team_memberships where team_id='1'";
$user->db->query($query);
//delete all memebership records for a users personal private team. 1 per user.
$query = "delete from team_memberships where team_id like 'private.%' and explicit_assign=1";
$user->db->query($query);
$query = "delete from teams where private=1";
$user->db->query($query);
$team = new Team();
$query = "select id, reports_to_id from users where deleted=0 ";
$result = $user->db->query($query);
$reporting = array();
while (($row = $user->db->fetchByAssoc($result)) != null) {
$reporting[$row['id']] = $row['reports_to_id'];
}
foreach ($reporting as $user_id => $reports_to_id) {
echo "<BR> Processing user=" . $user_id . ' reports to=' . $reports_to_id;
$user = new User();
$user->retrieve($user_id);
if (empty($user->id)) {
echo "<BR> Skipping user=" . $user_id . " reports to=" . $reports_to_id;
} else {
$team->new_user_created($user);
}
}
echo "<BR><BR>done...";
示例2: upgradeModulesForTeam
/**
* upgradeModulesForTeam
*
* This method update the associated_user_id, name, name_2 to the private team records on teams table
* This function is used for upgrade process from 5.1.x and 5.2.x.
*
*/
function upgradeModulesForTeam()
{
logThis("In upgradeModulesForTeam()");
$result = $GLOBALS['db']->query("SELECT id, user_name, first_name, last_name FROM users where deleted=0");
while ($row = $GLOBALS['db']->fetchByAssoc($result)) {
$results2 = $GLOBALS['db']->query("SELECT id FROM teams WHERE name = '({$row['user_name']})'");
$assoc = '';
if (!($assoc = $GLOBALS['db']->fetchByAssoc($results2))) {
//if team does not exist, then lets create the team for this user
$team = new Team();
$user = new User();
$user->retrieve($row['id']);
$team->new_user_created($user);
$team_id = $team->id;
} else {
$team_id = $assoc['id'];
}
//upgrade the team
$name = is_null($row['first_name']) ? '' : $row['first_name'];
$name_2 = is_null($row['last_name']) ? '' : $row['last_name'];
$associated_user_id = $row['id'];
//Bug 32914
//Ensure team->name is not empty by using team->name_2 if available
if (empty($name) && !empty($name_2)) {
$name = $name_2;
$name_2 = '';
}
$query = "UPDATE teams SET name = '{$name}', name_2 = '{$name_2}', associated_user_id = '{$associated_user_id}' WHERE id = '{$team_id}'";
$GLOBALS['db']->query($query);
}
//while
//Update the team_set_id and default_team columns
$ce_to_pro_or_ent = isset($_SESSION['upgrade_from_flavor']) && ($_SESSION['upgrade_from_flavor'] == 'SugarCE to SugarPro' || $_SESSION['upgrade_from_flavor'] == 'SugarCE to SugarEnt' || $_SESSION['upgrade_from_flavor'] == 'SugarCE to SugarCorp' || $_SESSION['upgrade_from_flavor'] == 'SugarCE to SugarUlt');
//Update team_set_id
if ($ce_to_pro_or_ent) {
$GLOBALS['db']->query("update users set team_set_id = (select teams.id from teams where teams.associated_user_id = users.id)");
$GLOBALS['db']->query("update users set default_team = (select teams.id from teams where teams.associated_user_id = users.id)");
}
}
示例3: run
public function run()
{
if (!($this->from_flavor == 'ce' && $this->toFlavor('pro'))) {
return;
}
require_once 'ModuleInstall/ModuleInstaller.php';
$globalteam = new Team();
$globalteam->retrieve('1');
if (empty($globalteam->name)) {
$globalteam->create_team("Global", $this->mod_strings['LBL_GLOBAL_TEAM_DESC'], $globalteam->global_team);
}
$this->log("Start Building private teams");
$result = $this->db->query("SELECT id, user_name, first_name, last_name FROM users where deleted=0");
while ($row = $this->db->fetchByAssoc($result)) {
$results2 = $this->db->query("SELECT id FROM teams WHERE name = '({$row['user_name']})'");
$assoc = '';
if (!($assoc = $this->db->fetchByAssoc($results2))) {
//if team does not exist, then lets create the team for this user
$team = new Team();
$user = new User();
$user->retrieve($row['id']);
$team->new_user_created($user);
$team_id = $team->id;
} else {
$team_id = $assoc['id'];
}
//upgrade the team
$name = is_null($row['first_name']) ? '' : $row['first_name'];
$name_2 = is_null($row['last_name']) ? '' : $row['last_name'];
$associated_user_id = $row['id'];
//Bug 32914
//Ensure team->name is not empty by using team->name_2 if available
if (empty($name) && !empty($name_2)) {
$name = $name_2;
$name_2 = '';
}
$this->db->query("UPDATE teams SET name = '{$name}', name_2 = '{$name_2}', associated_user_id = '{$associated_user_id}' WHERE id = '{$team_id}'");
}
//while
$this->db->query("update users set team_set_id = (select teams.id from teams where teams.associated_user_id = users.id)");
$this->db->query("update users set default_team = (select teams.id from teams where teams.associated_user_id = users.id)");
$this->log("Done Building private teams");
$this->log("Start Building the team_set and team_sets_teams");
require 'include/modules.php';
foreach ($beanList as $moduleName => $beanName) {
if ($moduleName == 'TeamMemberships' || $moduleName == 'ForecastOpportunities') {
continue;
}
$bean = loadBean($moduleName);
if (empty($bean) || empty($bean->table_name)) {
continue;
}
$FieldArray = $this->db->get_columns($bean->table_name);
if (!isset($FieldArray['team_id'])) {
continue;
}
$this->upgradeTeamColumn($bean, 'team_id');
}
//foreach
//Upgrade users table
$bean = BeanFactory::getBean('Users');
$this->upgradeTeamColumn($bean, 'default_team');
$result = $this->db->query("SELECT id FROM teams where deleted=0");
while ($row = $this->db->fetchByAssoc($result)) {
$teamset = new TeamSet();
$teamset->addTeams($row['id']);
}
$this->log("Finish Building the team_set and team_sets_teams");
$this->log("Start modules/Administration/upgradeTeams.php");
ob_start();
include 'modules/Administration/upgradeTeams.php';
ob_end_clean();
$this->log("Finish modules/Administration/upgradeTeams.php");
}