@@ -26,7 +26,7 @@ |
||
26 | 26 | * |
27 | 27 | * @var Request |
28 | 28 | */ |
29 | - private $request = null; |
|
29 | + private $request = null; |
|
30 | 30 | |
31 | 31 | /** |
32 | 32 | * Security |
@@ -26,7 +26,7 @@ discard block |
||
26 | 26 | * |
27 | 27 | * @var Request |
28 | 28 | */ |
29 | - private $request = null; |
|
29 | + private $request = null; |
|
30 | 30 | |
31 | 31 | /** |
32 | 32 | * Security |
@@ -96,12 +96,12 @@ discard block |
||
96 | 96 | throw new \InvalidArgumentException('Document id is not defined'); |
97 | 97 | } |
98 | 98 | |
99 | - $users = $this->manager->getRepository(User::class)->findBy(['people' => $person]); |
|
99 | + $users = $this->manager->getRepository(User::class)->findBy(['people' => $person]); |
|
100 | 100 | if (count($users) == 1) { |
101 | 101 | throw new \InvalidArgumentException('Deve existir pelo menos um usuário'); |
102 | 102 | } |
103 | 103 | |
104 | - $user = $this->manager->getRepository(User::class)->findOneBy(['id' => $payload['id'], 'people' => $person]); |
|
104 | + $user = $this->manager->getRepository(User::class)->findOneBy(['id' => $payload['id'], 'people' => $person]); |
|
105 | 105 | if (!$user instanceof User) { |
106 | 106 | throw new \InvalidArgumentException('Person user was not found'); |
107 | 107 | } |
@@ -112,31 +112,31 @@ discard block |
||
112 | 112 | |
113 | 113 | case 'active': |
114 | 114 | |
115 | - $queryBuilder->innerJoin(SalesOrder::class, 'O' , 'WITH', 'O.client = myclients.id'); |
|
116 | - $queryBuilder->innerJoin(People::class, 'C' , 'WITH', 'C.id = O.provider'); |
|
115 | + $queryBuilder->innerJoin(SalesOrder::class, 'O', 'WITH', 'O.client = myclients.id'); |
|
116 | + $queryBuilder->innerJoin(People::class, 'C', 'WITH', 'C.id = O.provider'); |
|
117 | 117 | $queryBuilder->innerJoin(PeopleSalesman::class, 'kkk', 'WITH', 'kkk.company = C.id'); |
118 | - $queryBuilder->innerJoin(People::class, 'S' , 'WITH', 'S.id = kkk.salesman'); |
|
119 | - $queryBuilder->innerJoin(PeopleClient::class, 'PC' , 'WITH', 'PC.client = myclients.id AND PC.company_id = S.id'); |
|
118 | + $queryBuilder->innerJoin(People::class, 'S', 'WITH', 'S.id = kkk.salesman'); |
|
119 | + $queryBuilder->innerJoin(PeopleClient::class, 'PC', 'WITH', 'PC.client = myclients.id AND PC.company_id = S.id'); |
|
120 | 120 | $queryBuilder->andWhere('O.provider = :provider'); |
121 | 121 | $queryBuilder->andWhere('S.id IN (:my_companies)'); |
122 | 122 | $queryBuilder->andWhere('O.status NOT IN (:statuses)'); |
123 | 123 | $queryBuilder->andWhere('O.orderDate BETWEEN :from_date AND :to_date'); |
124 | - $queryBuilder->setParameter('provider' , $provider); |
|
125 | - $queryBuilder->setParameter('statuses' , $this->getEntityManager()->getRepository(Status::class)->findBy(['realStatus' => ['open','canceled']])); |
|
126 | - $queryBuilder->setParameter('from_date' , $fromDate); |
|
127 | - $queryBuilder->setParameter('to_date' , $toDate); |
|
124 | + $queryBuilder->setParameter('provider', $provider); |
|
125 | + $queryBuilder->setParameter('statuses', $this->getEntityManager()->getRepository(Status::class)->findBy(['realStatus' => ['open', 'canceled']])); |
|
126 | + $queryBuilder->setParameter('from_date', $fromDate); |
|
127 | + $queryBuilder->setParameter('to_date', $toDate); |
|
128 | 128 | $queryBuilder->setParameter('my_companies', $this->getMyCompanies($salesman)); |
129 | 129 | |
130 | 130 | break; |
131 | 131 | |
132 | 132 | case 'inactive': |
133 | 133 | |
134 | - $queryBuilder->innerJoin(SalesOrder::class, 'O' , 'WITH', 'O.client = myclients.id'); |
|
135 | - $queryBuilder->innerJoin(People::class, 'C' , 'WITH', 'C.id = O.provider'); |
|
134 | + $queryBuilder->innerJoin(SalesOrder::class, 'O', 'WITH', 'O.client = myclients.id'); |
|
135 | + $queryBuilder->innerJoin(People::class, 'C', 'WITH', 'C.id = O.provider'); |
|
136 | 136 | $queryBuilder->innerJoin(PeopleSalesman::class, 'kkk', 'WITH', 'kkk.company = C.id'); |
137 | - $queryBuilder->innerJoin(People::class, 'S' , 'WITH', 'S.id = kkk.salesman'); |
|
138 | - $queryBuilder->innerJoin(PeopleClient::class, 'PC' , 'WITH', 'PC.client = myclients.id AND PC.company_id = S.id'); |
|
139 | - $queryBuilder->leftJoin (SalesOrder::class, 'jj' , 'WITH', 'jj.client = myclients.id |
|
137 | + $queryBuilder->innerJoin(People::class, 'S', 'WITH', 'S.id = kkk.salesman'); |
|
138 | + $queryBuilder->innerJoin(PeopleClient::class, 'PC', 'WITH', 'PC.client = myclients.id AND PC.company_id = S.id'); |
|
139 | + $queryBuilder->leftJoin(SalesOrder::class, 'jj', 'WITH', 'jj.client = myclients.id |
|
140 | 140 | AND (jj.status NOT IN (:statuses) OR jj.id IS NULL) |
141 | 141 | AND ((jj.orderDate BETWEEN :from_date AND :to_date) OR jj.id IS NULL) |
142 | 142 | AND (jj.provider = :provider OR jj.id IS NULL)'); |
@@ -147,23 +147,23 @@ discard block |
||
147 | 147 | $queryBuilder->groupBy('myclients.id'); |
148 | 148 | $queryBuilder->having('COUNT(jj.id) > :count'); |
149 | 149 | $queryBuilder->andHaving('COUNT(O.id) = :count'); |
150 | - $queryBuilder->setParameter('provider' , $provider); |
|
151 | - $queryBuilder->setParameter('statuses' , $this->getEntityManager()->getRepository(Status::class)->findBy(['realStatus' => ['open','canceled']])); |
|
150 | + $queryBuilder->setParameter('provider', $provider); |
|
151 | + $queryBuilder->setParameter('statuses', $this->getEntityManager()->getRepository(Status::class)->findBy(['realStatus' => ['open', 'canceled']])); |
|
152 | 152 | $queryBuilder->setParameter('from_date', $fromDate); |
153 | - $queryBuilder->setParameter('to_date' , $toDate); |
|
154 | - $queryBuilder->setParameter('count' , 0); |
|
153 | + $queryBuilder->setParameter('to_date', $toDate); |
|
154 | + $queryBuilder->setParameter('count', 0); |
|
155 | 155 | $queryBuilder->setParameter('my_companies', $this->getMyCompanies($salesman)); |
156 | 156 | |
157 | 157 | break; |
158 | 158 | |
159 | 159 | case 'prospect': |
160 | 160 | |
161 | - $queryBuilder->innerJoin(SalesOrder::class, 'O' , 'WITH', 'O.client = myclients.id'); |
|
162 | - $queryBuilder->innerJoin(People::class, 'C' , 'WITH', 'C.id = O.provider'); |
|
161 | + $queryBuilder->innerJoin(SalesOrder::class, 'O', 'WITH', 'O.client = myclients.id'); |
|
162 | + $queryBuilder->innerJoin(People::class, 'C', 'WITH', 'C.id = O.provider'); |
|
163 | 163 | $queryBuilder->innerJoin(PeopleSalesman::class, 'PS', 'WITH', 'PS.company = C.id'); |
164 | - $queryBuilder->innerJoin(People::class, 'S' , 'WITH', 'S.id = PS.salesman'); |
|
165 | - $queryBuilder->innerJoin(PeopleClient::class, 'PC', 'WITH', 'PC.client = myclients.id AND PC.company_id = S.id'); |
|
166 | - $queryBuilder->leftJoin (SalesOrder::class, 'jj' , 'WITH', 'jj.client = myclients.id |
|
164 | + $queryBuilder->innerJoin(People::class, 'S', 'WITH', 'S.id = PS.salesman'); |
|
165 | + $queryBuilder->innerJoin(PeopleClient::class, 'PC', 'WITH', 'PC.client = myclients.id AND PC.company_id = S.id'); |
|
166 | + $queryBuilder->leftJoin(SalesOrder::class, 'jj', 'WITH', 'jj.client = myclients.id |
|
167 | 167 | AND (jj.status NOT IN (:statuses) OR jj.id IS NULL) |
168 | 168 | AND (jj.provider = :provider OR jj.id IS NULL)'); |
169 | 169 | $queryBuilder->andWhere('O.provider = :provider'); |
@@ -173,19 +173,19 @@ discard block |
||
173 | 173 | $queryBuilder->having('COUNT(jj.id) = :count'); |
174 | 174 | |
175 | 175 | $queryBuilder->setParameter('provider', $provider); |
176 | - $queryBuilder->setParameter('statuses', $this->getEntityManager()->getRepository(Status::class)->findBy(['realStatus' => ['open','canceled']])); |
|
177 | - $queryBuilder->setParameter('count' , 0); |
|
176 | + $queryBuilder->setParameter('statuses', $this->getEntityManager()->getRepository(Status::class)->findBy(['realStatus' => ['open', 'canceled']])); |
|
177 | + $queryBuilder->setParameter('count', 0); |
|
178 | 178 | $queryBuilder->setParameter('my_companies', $this->getMyCompanies($salesman)); |
179 | 179 | |
180 | 180 | break; |
181 | 181 | |
182 | 182 | case 'new': |
183 | 183 | |
184 | - $queryBuilder->innerJoin(SalesOrder::class, 'O' , 'WITH', 'O.client = myclients.id'); |
|
185 | - $queryBuilder->innerJoin(People::class, 'C' , 'WITH', 'C.id = O.provider'); |
|
184 | + $queryBuilder->innerJoin(SalesOrder::class, 'O', 'WITH', 'O.client = myclients.id'); |
|
185 | + $queryBuilder->innerJoin(People::class, 'C', 'WITH', 'C.id = O.provider'); |
|
186 | 186 | $queryBuilder->innerJoin(PeopleSalesman::class, 'kkk', 'WITH', 'kkk.company = C.id'); |
187 | - $queryBuilder->innerJoin(People::class, 'S' , 'WITH', 'S.id = kkk.salesman'); |
|
188 | - $queryBuilder->innerJoin(PeopleClient::class, 'PC' , 'WITH', 'PC.client = myclients.id AND PC.company_id = S.id'); |
|
187 | + $queryBuilder->innerJoin(People::class, 'S', 'WITH', 'S.id = kkk.salesman'); |
|
188 | + $queryBuilder->innerJoin(PeopleClient::class, 'PC', 'WITH', 'PC.client = myclients.id AND PC.company_id = S.id'); |
|
189 | 189 | |
190 | 190 | $queryBuilder->andWhere('O.provider = :provider'); |
191 | 191 | $queryBuilder->andWhere('S.id IN (:my_companies)'); |
@@ -193,10 +193,10 @@ discard block |
||
193 | 193 | $queryBuilder->andWhere('O.orderDate BETWEEN :from_date AND :to_date'); |
194 | 194 | $queryBuilder->andWhere('myclients.registerDate BETWEEN :from_date AND :to_date'); |
195 | 195 | |
196 | - $queryBuilder->setParameter('provider' , $provider); |
|
197 | - $queryBuilder->setParameter('statuses' , $this->getEntityManager()->getRepository(Status::class)->findBy(['realStatus' => ['open','canceled']])); |
|
198 | - $queryBuilder->setParameter('from_date' , $fromDate); |
|
199 | - $queryBuilder->setParameter('to_date' , $toDate); |
|
196 | + $queryBuilder->setParameter('provider', $provider); |
|
197 | + $queryBuilder->setParameter('statuses', $this->getEntityManager()->getRepository(Status::class)->findBy(['realStatus' => ['open', 'canceled']])); |
|
198 | + $queryBuilder->setParameter('from_date', $fromDate); |
|
199 | + $queryBuilder->setParameter('to_date', $toDate); |
|
200 | 200 | $queryBuilder->setParameter('my_companies', $this->getMyCompanies($salesman)); |
201 | 201 | |
202 | 202 | break; |
@@ -804,15 +804,15 @@ discard block |
||
804 | 804 | $this->enable = 0; |
805 | 805 | $this->icms = 1; |
806 | 806 | $this->billing = 0; |
807 | - $this->registerDate = new \DateTime('now'); |
|
808 | - $this->people = new \Doctrine\Common\Collections\ArrayCollection(); |
|
809 | - $this->config = new \Doctrine\Common\Collections\ArrayCollection(); |
|
810 | - $this->link = new \Doctrine\Common\Collections\ArrayCollection(); |
|
811 | - $this->user = new \Doctrine\Common\Collections\ArrayCollection(); |
|
812 | - $this->document = new \Doctrine\Common\Collections\ArrayCollection(); |
|
813 | - $this->address = new \Doctrine\Common\Collections\ArrayCollection(); |
|
814 | - $this->email = new \Doctrine\Common\Collections\ArrayCollection(); |
|
815 | - $this->phone = new \Doctrine\Common\Collections\ArrayCollection(); |
|
807 | + $this->registerDate = new \DateTime('now'); |
|
808 | + $this->people = new \Doctrine\Common\Collections\ArrayCollection(); |
|
809 | + $this->config = new \Doctrine\Common\Collections\ArrayCollection(); |
|
810 | + $this->link = new \Doctrine\Common\Collections\ArrayCollection(); |
|
811 | + $this->user = new \Doctrine\Common\Collections\ArrayCollection(); |
|
812 | + $this->document = new \Doctrine\Common\Collections\ArrayCollection(); |
|
813 | + $this->address = new \Doctrine\Common\Collections\ArrayCollection(); |
|
814 | + $this->email = new \Doctrine\Common\Collections\ArrayCollection(); |
|
815 | + $this->phone = new \Doctrine\Common\Collections\ArrayCollection(); |
|
816 | 816 | $this->billingDays = 'daily'; |
817 | 817 | $this->paymentTerm = 1; |
818 | 818 | |
@@ -1115,7 +1115,7 @@ discard block |
||
1115 | 1115 | } |
1116 | 1116 | public function getOneDocument(): ?Document |
1117 | 1117 | { |
1118 | - $documents = $this->getDocument()->filter(function ($peopleDocument) { |
|
1118 | + $documents = $this->getDocument()->filter(function($peopleDocument) { |
|
1119 | 1119 | if ($peopleDocument->getPeople()->getPeopleType() == 'F') { |
1120 | 1120 | return $peopleDocument->getDocumentType()->getDocumentType() == 'CPF'; |
1121 | 1121 | } |
@@ -30,7 +30,7 @@ discard block |
||
30 | 30 | * |
31 | 31 | * @var PeopleService |
32 | 32 | */ |
33 | - private $people = null; |
|
33 | + private $people = null; |
|
34 | 34 | |
35 | 35 | public function __construct( |
36 | 36 | EntityManagerInterface $entityManager, |
@@ -75,7 +75,7 @@ discard block |
||
75 | 75 | } |
76 | 76 | } |
77 | 77 | |
78 | - $myCompany = $peopleCompany->getCompany(); |
|
78 | + $myCompany = $peopleCompany->getCompany(); |
|
79 | 79 | return $this->getAllRolesByCompany($people, $myCompany); |
80 | 80 | } |
81 | 81 | |
@@ -87,7 +87,7 @@ discard block |
||
87 | 87 | if ($company->getId() == $mainCompany->getId()) { |
88 | 88 | $isSuper = $mainCompany->getCompany() |
89 | 89 | ->exists( |
90 | - function ($key, PeopleLink $peopleLink) use ($people) { |
|
90 | + function($key, PeopleLink $peopleLink) use ($people) { |
|
91 | 91 | return $peopleLink->getPeople()->getId() === $people->getId(); |
92 | 92 | } |
93 | 93 | ); |
@@ -101,9 +101,9 @@ discard block |
||
101 | 101 | |
102 | 102 | $isFranchisee = $mainCompany->getCompany() |
103 | 103 | ->exists( |
104 | - function ($key, PeopleLink $peopleFranchisee) use ($people, $company) { |
|
104 | + function($key, PeopleLink $peopleFranchisee) use ($people, $company) { |
|
105 | 105 | foreach ($peopleFranchisee->getCompany() as $peopleLink) { |
106 | - if ($peopleLink->getCompany()->getId() == $company->getId() && $peopleLink->getPeople()->getId() === $people->getId()) { |
|
106 | + if ($peopleLink->getCompany()->getId() == $company->getId() && $peopleLink->getPeople()->getId() === $people->getId()) { |
|
107 | 107 | return true; |
108 | 108 | } |
109 | 109 | } |
@@ -117,7 +117,7 @@ discard block |
||
117 | 117 | |
118 | 118 | $isClient = $company->getCompany() |
119 | 119 | ->exists( |
120 | - function ($key, PeopleLink $peopleLink) use ($people) { |
|
120 | + function($key, PeopleLink $peopleLink) use ($people) { |
|
121 | 121 | return $peopleLink->getPeople()->getId() === $people->getId(); |
122 | 122 | } |
123 | 123 | ); |
@@ -129,7 +129,7 @@ discard block |
||
129 | 129 | |
130 | 130 | $isClient = $people->getLink() |
131 | 131 | ->exists( |
132 | - function ($key, PeopleLink $peopleLink) use ($company) { |
|
132 | + function($key, PeopleLink $peopleLink) use ($company) { |
|
133 | 133 | return $this->manager->getRepository(PeopleClient::class)->findOneBy( |
134 | 134 | [ |
135 | 135 | 'client' => $peopleLink->getCompany(), |
@@ -146,7 +146,7 @@ discard block |
||
146 | 146 | |
147 | 147 | $isSalesman = $company->getPeopleSalesman() |
148 | 148 | ->exists( |
149 | - function ($key, PeopleSalesman $peopleSalesman) use ($people) { |
|
149 | + function($key, PeopleSalesman $peopleSalesman) use ($people) { |
|
150 | 150 | return $peopleSalesman->getSalesman()->getId() === $people->getId(); |
151 | 151 | } |
152 | 152 | ); |