@@ -39,8 +39,9 @@ discard block |
||
| 39 | 39 | { |
| 40 | 40 | |
| 41 | 41 | $document = $this->manager->getRepository(Document::class)->findOneBy(['document' => $document_number]); |
| 42 | - if ($document) |
|
| 43 | - return $document->getPeople(); |
|
| 42 | + if ($document) { |
|
| 43 | + return $document->getPeople(); |
|
| 44 | + } |
|
| 44 | 45 | |
| 45 | 46 | |
| 46 | 47 | if ($name) { |
@@ -72,9 +73,9 @@ discard block |
||
| 72 | 73 | $payload = json_decode($request->getContent()); |
| 73 | 74 | if (isset($payload->link_type)) { |
| 74 | 75 | $company = $this->manager->getRepository(People::class)->find(preg_replace('/\D/', '', $payload->company)); |
| 75 | - if ($company) |
|
| 76 | - $this->addLink($company, $people, $payload->link_type); |
|
| 77 | - else { |
|
| 76 | + if ($company) { |
|
| 77 | + $this->addLink($company, $people, $payload->link_type); |
|
| 78 | + } else { |
|
| 78 | 79 | $link = $this->manager->getRepository(People::class)->find(preg_replace('/\D/', '', $payload->link)); |
| 79 | 80 | if ($payload->link_type == 'employee' && $link) { |
| 80 | 81 | $this->addLink($people, $link, $payload->link_type); |
@@ -102,8 +103,9 @@ discard block |
||
| 102 | 103 | 'link_type' => $link_type |
| 103 | 104 | ]); |
| 104 | 105 | |
| 105 | - if (!$peopleLink) |
|
| 106 | - $peopleLink = new PeopleLink(); |
|
| 106 | + if (!$peopleLink) { |
|
| 107 | + $peopleLink = new PeopleLink(); |
|
| 108 | + } |
|
| 107 | 109 | |
| 108 | 110 | $peopleLink->setCompany($company); |
| 109 | 111 | $peopleLink->setPeople($people); |
@@ -157,10 +159,14 @@ discard block |
||
| 157 | 159 | * @var \ControleOnline\Entity\User $currentUser |
| 158 | 160 | */ |
| 159 | 161 | $token = $this->security->getToken(); |
| 160 | - if (!$token) return []; |
|
| 162 | + if (!$token) { |
|
| 163 | + return []; |
|
| 164 | + } |
|
| 161 | 165 | $currentUser = $token->getUser(); |
| 162 | 166 | $companies = []; |
| 163 | - if (!$currentUser) return []; |
|
| 167 | + if (!$currentUser) { |
|
| 168 | + return []; |
|
| 169 | + } |
|
| 164 | 170 | |
| 165 | 171 | if (!$currentUser->getPeople()->getLink()->isEmpty()) { |
| 166 | 172 | foreach ($currentUser->getPeople()->getLink() as $company) { |