@@ -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); |
@@ -35,7 +35,9 @@ discard block |
||
35 | 35 | */ |
36 | 36 | foreach ($getPeopleCompanies as $peopleCompany) { |
37 | 37 | $isFranchisee = $this->manager->getRepository(People::class)->getCompanyPeopleLinks($mainCompany, $peopleCompany->getCompany(), 'franchisee', 1); |
38 | - if ($isFranchisee) return true; |
|
38 | + if ($isFranchisee) { |
|
39 | + return true; |
|
40 | + } |
|
39 | 41 | } |
40 | 42 | return $isFranchisee; |
41 | 43 | } |
@@ -52,7 +54,9 @@ discard block |
||
52 | 54 | $isSalesman = false; |
53 | 55 | |
54 | 56 | $isSalesman = $this->manager->getRepository(People::class)->getCompanyPeopleLinks($mainCompany, $people, 'salesman', 1); |
55 | - if ($isSalesman) return true; |
|
57 | + if ($isSalesman) { |
|
58 | + return true; |
|
59 | + } |
|
56 | 60 | |
57 | 61 | $getPeopleCompanies = $this->manager->getRepository(PeopleLink::class)->findBy([ |
58 | 62 | 'people' => $people, |
@@ -63,7 +67,9 @@ discard block |
||
63 | 67 | */ |
64 | 68 | foreach ($getPeopleCompanies as $peopleCompany) { |
65 | 69 | $isSalesman = $this->manager->getRepository(People::class)->getCompanyPeopleLinks($mainCompany, $peopleCompany->getCompany(), 'salesman', 1); |
66 | - if ($isSalesman) return true; |
|
70 | + if ($isSalesman) { |
|
71 | + return true; |
|
72 | + } |
|
67 | 73 | } |
68 | 74 | return $isSalesman; |
69 | 75 | } |
@@ -76,8 +82,9 @@ discard block |
||
76 | 82 | $mainCompany = $this->getMainCompany(); |
77 | 83 | |
78 | 84 | $isSuper = $this->manager->getRepository(People::class)->getCompanyPeopleLinks($mainCompany, $people, 'employee', 1); |
79 | - if ($isSuper) |
|
80 | - $peopleRole[] = 'super'; |
|
85 | + if ($isSuper) { |
|
86 | + $peopleRole[] = 'super'; |
|
87 | + } |
|
81 | 88 | |
82 | 89 | |
83 | 90 | |
@@ -88,13 +95,15 @@ discard block |
||
88 | 95 | } |
89 | 96 | |
90 | 97 | $isClient = $this->manager->getRepository(People::class)->getCompanyPeopleLinks($mainCompany, $people, 'client', 1); |
91 | - if ($isClient) |
|
92 | - $peopleRole[] = 'client'; |
|
98 | + if ($isClient) { |
|
99 | + $peopleRole[] = 'client'; |
|
100 | + } |
|
93 | 101 | |
94 | 102 | |
95 | 103 | $isSalesman = $this->isSalesman($user); |
96 | - if ($isSalesman) |
|
97 | - $peopleRole[] = 'salesman'; |
|
104 | + if ($isSalesman) { |
|
105 | + $peopleRole[] = 'salesman'; |
|
106 | + } |
|
98 | 107 | |
99 | 108 | |
100 | 109 | return array_values(array_unique(empty($peopleRole) ? ['guest'] : $peopleRole)); |
@@ -108,7 +117,9 @@ discard block |
||
108 | 117 | public function getMainCompany(): People |
109 | 118 | { |
110 | 119 | |
111 | - if (self::$mainCompany) return self::$mainCompany; |
|
120 | + if (self::$mainCompany) { |
|
121 | + return self::$mainCompany; |
|
122 | + } |
|
112 | 123 | |
113 | 124 | $peopleDomain = $this->domainService->getPeopleDomain(); |
114 | 125 | self::$mainCompany = $peopleDomain->getPeople(); |
@@ -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) { |