| @@ -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(); | 
| @@ -37,9 +37,9 @@ discard block | ||
| 37 | 37 | $payload = json_decode($request->getContent()); | 
| 38 | 38 |      if (isset($payload->link_type)) { | 
| 39 | 39 |        $company = $this->manager->getRepository(People::class)->find(preg_replace('/\D/', '', $payload->company)); | 
| 40 | - if ($company) | |
| 41 | - $this->addLink($company, $people, $payload->link_type); | |
| 42 | -      else { | |
| 40 | +      if ($company) { | |
| 41 | + $this->addLink($company, $people, $payload->link_type); | |
| 42 | +      } else { | |
| 43 | 43 |          $link = $this->manager->getRepository(People::class)->find(preg_replace('/\D/', '', $payload->link)); | 
| 44 | 44 |          if ($payload->link_type == 'employee' && $link) { | 
| 45 | 45 | $this->addLink($people, $link, $payload->link_type); | 
| @@ -67,8 +67,9 @@ discard block | ||
| 67 | 67 | 'link_type' => $link_type | 
| 68 | 68 | ]); | 
| 69 | 69 | |
| 70 | - if (!$peopleLink) | |
| 71 | - $peopleLink = new PeopleLink(); | |
| 70 | +    if (!$peopleLink) { | |
| 71 | + $peopleLink = new PeopleLink(); | |
| 72 | + } | |
| 72 | 73 | |
| 73 | 74 | $peopleLink->setCompany($company); | 
| 74 | 75 | $peopleLink->setPeople($people); | 
| @@ -123,8 +124,9 @@ discard block | ||
| 123 | 124 | */ | 
| 124 | 125 | $currentUser = $this->security->getUser(); | 
| 125 | 126 | $companies = []; | 
| 126 | - if (!$currentUser) | |
| 127 | - return []; | |
| 127 | +    if (!$currentUser) { | |
| 128 | + return []; | |
| 129 | + } | |
| 128 | 130 | |
| 129 | 131 |      if (!$currentUser->getPeople()->getLink()->isEmpty()) { | 
| 130 | 132 |        foreach ($currentUser->getPeople()->getLink() as $company) { |