@@ -60,7 +60,9 @@ discard block |
||
| 60 | 60 | */ |
| 61 | 61 | foreach ($getPeopleCompanies as $peopleCompany) { |
| 62 | 62 | $isFranchisee = $this->manager->getRepository(People::class)->getCompanyPeopleLinks($mainCompany, $peopleCompany->getCompany(), 'franchisee', 1); |
| 63 | - if ($isFranchisee) return true; |
|
| 63 | + if ($isFranchisee) { |
|
| 64 | + return true; |
|
| 65 | + } |
|
| 64 | 66 | } |
| 65 | 67 | return $isFranchisee; |
| 66 | 68 | } |
@@ -77,7 +79,9 @@ discard block |
||
| 77 | 79 | $isSalesman = false; |
| 78 | 80 | |
| 79 | 81 | $isSalesman = $this->manager->getRepository(People::class)->getCompanyPeopleLinks($mainCompany, $people, 'salesman', 1); |
| 80 | - if ($isSalesman) return true; |
|
| 82 | + if ($isSalesman) { |
|
| 83 | + return true; |
|
| 84 | + } |
|
| 81 | 85 | |
| 82 | 86 | $getPeopleCompanies = $this->manager->getRepository(PeopleLink::class)->findBy([ |
| 83 | 87 | 'people' => $people, |
@@ -88,7 +92,9 @@ discard block |
||
| 88 | 92 | */ |
| 89 | 93 | foreach ($getPeopleCompanies as $peopleCompany) { |
| 90 | 94 | $isSalesman = $this->manager->getRepository(People::class)->getCompanyPeopleLinks($mainCompany, $peopleCompany->getCompany(), 'salesman', 1); |
| 91 | - if ($isSalesman) return true; |
|
| 95 | + if ($isSalesman) { |
|
| 96 | + return true; |
|
| 97 | + } |
|
| 92 | 98 | } |
| 93 | 99 | return $isSalesman; |
| 94 | 100 | } |
@@ -101,8 +107,9 @@ discard block |
||
| 101 | 107 | $mainCompany = $this->getMainCompany(); |
| 102 | 108 | |
| 103 | 109 | $isSuper = $this->manager->getRepository(People::class)->getCompanyPeopleLinks($mainCompany, $people, 'employee', 1); |
| 104 | - if ($isSuper) |
|
| 105 | - $peopleRole[] = 'super'; |
|
| 110 | + if ($isSuper) { |
|
| 111 | + $peopleRole[] = 'super'; |
|
| 112 | + } |
|
| 106 | 113 | |
| 107 | 114 | |
| 108 | 115 | |
@@ -113,13 +120,15 @@ discard block |
||
| 113 | 120 | } |
| 114 | 121 | |
| 115 | 122 | $isClient = $this->manager->getRepository(People::class)->getCompanyPeopleLinks($mainCompany, $people, 'client', 1); |
| 116 | - if ($isClient) |
|
| 117 | - $peopleRole[] = 'client'; |
|
| 123 | + if ($isClient) { |
|
| 124 | + $peopleRole[] = 'client'; |
|
| 125 | + } |
|
| 118 | 126 | |
| 119 | 127 | |
| 120 | 128 | $isSalesman = $this->isSalesman($user); |
| 121 | - if ($isSalesman) |
|
| 122 | - $peopleRole[] = 'salesman'; |
|
| 129 | + if ($isSalesman) { |
|
| 130 | + $peopleRole[] = 'salesman'; |
|
| 131 | + } |
|
| 123 | 132 | |
| 124 | 133 | |
| 125 | 134 | return array_values(array_unique(empty($peopleRole) ? ['guest'] : $peopleRole)); |
@@ -135,10 +144,11 @@ discard block |
||
| 135 | 144 | $domain = $this->domainService->getMainDomain(); |
| 136 | 145 | $company = $this->manager->getRepository(PeopleDomain::class)->findOneBy(['domain' => $domain]); |
| 137 | 146 | |
| 138 | - if ($company === null) |
|
| 139 | - throw new \Exception( |
|
| 147 | + if ($company === null) { |
|
| 148 | + throw new \Exception( |
|
| 140 | 149 | sprintf('Main company "%s" not found', $domain) |
| 141 | 150 | ); |
| 151 | + } |
|
| 142 | 152 | |
| 143 | 153 | return $company->getPeople(); |
| 144 | 154 | } |