@@ -113,8 +113,9 @@ |
||
113 | 113 | |
114 | 114 | return true; |
115 | 115 | } catch (\Exception $e) { |
116 | - if ($this->manager->getConnection()->isTransactionActive()) |
|
117 | - $this->manager->getConnection()->rollBack(); |
|
116 | + if ($this->manager->getConnection()->isTransactionActive()) { |
|
117 | + $this->manager->getConnection()->rollBack(); |
|
118 | + } |
|
118 | 119 | |
119 | 120 | throw new \InvalidArgumentException($e->getMessage()); |
120 | 121 | } |
@@ -51,8 +51,9 @@ |
||
51 | 51 | ->setParameter('company', $company->getId()) |
52 | 52 | ->setParameter('people', $people->getId()); |
53 | 53 | |
54 | - if ($linkType) |
|
55 | - $queryBuilder->setParameter('linkType', $linkType)->andWhere('pl.link_type = :linkType'); |
|
54 | + if ($linkType) { |
|
55 | + $queryBuilder->setParameter('linkType', $linkType)->andWhere('pl.link_type = :linkType'); |
|
56 | + } |
|
56 | 57 | |
57 | 58 | if ($maxResults) { |
58 | 59 | $queryBuilder->setMaxResults($maxResults); |
@@ -38,8 +38,9 @@ discard block |
||
38 | 38 | { |
39 | 39 | |
40 | 40 | $document = $this->manager->getRepository(Document::class)->findOneBy(['document' => $document_number]); |
41 | - if ($document) |
|
42 | - return $document->getPeople(); |
|
41 | + if ($document) { |
|
42 | + return $document->getPeople(); |
|
43 | + } |
|
43 | 44 | |
44 | 45 | |
45 | 46 | if ($name) { |
@@ -71,9 +72,9 @@ discard block |
||
71 | 72 | $payload = json_decode($request->getContent()); |
72 | 73 | if (isset($payload->link_type)) { |
73 | 74 | $company = $this->manager->getRepository(People::class)->find(preg_replace('/\D/', '', $payload->company)); |
74 | - if ($company) |
|
75 | - $this->addLink($company, $people, $payload->link_type); |
|
76 | - else { |
|
75 | + if ($company) { |
|
76 | + $this->addLink($company, $people, $payload->link_type); |
|
77 | + } else { |
|
77 | 78 | $link = $this->manager->getRepository(People::class)->find(preg_replace('/\D/', '', $payload->link)); |
78 | 79 | if ($payload->link_type == 'employee' && $link) { |
79 | 80 | $this->addLink($people, $link, $payload->link_type); |
@@ -101,8 +102,9 @@ discard block |
||
101 | 102 | 'link_type' => $link_type |
102 | 103 | ]); |
103 | 104 | |
104 | - if (!$peopleLink) |
|
105 | - $peopleLink = new PeopleLink(); |
|
105 | + if (!$peopleLink) { |
|
106 | + $peopleLink = new PeopleLink(); |
|
107 | + } |
|
106 | 108 | |
107 | 109 | $peopleLink->setCompany($company); |
108 | 110 | $peopleLink->setPeople($people); |
@@ -157,8 +159,9 @@ discard block |
||
157 | 159 | */ |
158 | 160 | $currentUser = $this->security->getUser(); |
159 | 161 | $companies = []; |
160 | - if (!$currentUser) |
|
161 | - return []; |
|
162 | + if (!$currentUser) { |
|
163 | + return []; |
|
164 | + } |
|
162 | 165 | |
163 | 166 | if (!$currentUser->getPeople()->getLink()->isEmpty()) { |
164 | 167 | foreach ($currentUser->getPeople()->getLink() as $company) { |
@@ -34,7 +34,9 @@ discard block |
||
34 | 34 | $isSalesman = false; |
35 | 35 | |
36 | 36 | $isSalesman = $this->manager->getRepository(People::class)->getCompanyPeopleLinks($mainCompany, $people, 'salesman', 1); |
37 | - if ($isSalesman) return true; |
|
37 | + if ($isSalesman) { |
|
38 | + return true; |
|
39 | + } |
|
38 | 40 | |
39 | 41 | $getPeopleCompanies = $this->manager->getRepository(PeopleLink::class)->findBy([ |
40 | 42 | 'people' => $people, |
@@ -45,7 +47,9 @@ discard block |
||
45 | 47 | */ |
46 | 48 | foreach ($getPeopleCompanies as $peopleCompany) { |
47 | 49 | $isSalesman = $this->manager->getRepository(People::class)->getCompanyPeopleLinks($mainCompany, $peopleCompany->getCompany(), 'salesman', 1); |
48 | - if ($isSalesman) return true; |
|
50 | + if ($isSalesman) { |
|
51 | + return true; |
|
52 | + } |
|
49 | 53 | } |
50 | 54 | return $isSalesman; |
51 | 55 | } |
@@ -57,8 +61,9 @@ discard block |
||
57 | 61 | $mainCompany = $this->getMainCompany(); |
58 | 62 | |
59 | 63 | $isSuper = $this->manager->getRepository(People::class)->getCompanyPeopleLinks($mainCompany, $people, 'employee', 1); |
60 | - if ($isSuper) |
|
61 | - $peopleRole[] = 'super'; |
|
64 | + if ($isSuper) { |
|
65 | + $peopleRole[] = 'super'; |
|
66 | + } |
|
62 | 67 | |
63 | 68 | |
64 | 69 | |
@@ -69,13 +74,15 @@ discard block |
||
69 | 74 | } |
70 | 75 | |
71 | 76 | $isClient = $this->manager->getRepository(People::class)->getCompanyPeopleLinks($mainCompany, $people, 'client', 1); |
72 | - if ($isClient) |
|
73 | - $peopleRole[] = 'client'; |
|
77 | + if ($isClient) { |
|
78 | + $peopleRole[] = 'client'; |
|
79 | + } |
|
74 | 80 | |
75 | 81 | |
76 | 82 | $isSalesman = $this->isSalesman($people); |
77 | - if ($isSalesman) |
|
78 | - $peopleRole[] = 'salesman'; |
|
83 | + if ($isSalesman) { |
|
84 | + $peopleRole[] = 'salesman'; |
|
85 | + } |
|
79 | 86 | |
80 | 87 | |
81 | 88 | return array_values(array_unique(empty($peopleRole) ? ['guest'] : $peopleRole)); |
@@ -89,7 +96,9 @@ discard block |
||
89 | 96 | public function getMainCompany(): People |
90 | 97 | { |
91 | 98 | |
92 | - if (self::$mainCompany) return self::$mainCompany; |
|
99 | + if (self::$mainCompany) { |
|
100 | + return self::$mainCompany; |
|
101 | + } |
|
93 | 102 | |
94 | 103 | $peopleDomain = $this->domainService->getPeopleDomain(); |
95 | 104 | self::$mainCompany = $peopleDomain->getPeople(); |