support multiple teamleads in each team (#2702)
* fix jumping avatars * fix line-break after color dot for long names
This commit is contained in:
@@ -195,7 +195,7 @@ class ImportProjectCommand extends Command
|
||||
|
||||
$team = new Team();
|
||||
$team->setName($project->getName());
|
||||
$team->setTeamLead($teamlead);
|
||||
$team->addTeamlead($teamlead);
|
||||
|
||||
$this->teams->saveTeam($team);
|
||||
|
||||
|
||||
@@ -1873,20 +1873,20 @@ final class KimaiImporterCommand extends Command
|
||||
$team->addUser($user);
|
||||
|
||||
// first user in the team will become team lead
|
||||
if ($team->getTeamLead() == null) {
|
||||
$team->setTeamLead($user);
|
||||
if (!$team->hasTeamleads()) {
|
||||
$team->addTeamlead($user);
|
||||
}
|
||||
|
||||
// any other user with admin role in the team will become team lead
|
||||
// should be the last added admin of the source group
|
||||
if ($row['membershipRoleID'] === 1) {
|
||||
$team->setTeamLead($user);
|
||||
$team->addTeamlead($user);
|
||||
}
|
||||
}
|
||||
|
||||
// if team has no users it will not be persisted
|
||||
foreach ($newTeams as $oldId => $team) {
|
||||
if ($team->getTeamLead() === null) {
|
||||
if (!$team->hasUsers()) {
|
||||
$io->warning(sprintf('Didn\'t import team: %s because it has no users.', $team->getName()));
|
||||
++$skippedEmpty;
|
||||
unset($newTeams[$oldId]);
|
||||
@@ -1998,7 +1998,7 @@ final class KimaiImporterCommand extends Command
|
||||
$team->setName($name);
|
||||
$teamlead = $users[array_key_first($users)];
|
||||
$teamlead = $this->getCachedUser($teamlead['userID']);
|
||||
$team->setTeamLead($teamlead);
|
||||
$team->addTeamlead($teamlead);
|
||||
foreach ($users as $oldUser) {
|
||||
$team->addUser($this->getCachedUser($oldUser['userID']));
|
||||
foreach ($activities as $oldActivity) {
|
||||
|
||||
@@ -128,7 +128,7 @@ class ResetTestCommand extends AbstractResetCommand
|
||||
|
||||
$team = new Team();
|
||||
$team->setName('Test team');
|
||||
$team->setTeamLead($userEntities[6]);
|
||||
$team->addTeamlead($userEntities[6]);
|
||||
$team->addUser($userEntities[7]);
|
||||
$this->entityManager->persist($team);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user