1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace ControleOnline\Entity; |
4
|
|
|
|
5
|
|
|
use Doctrine\ORM\Mapping as ORM; |
|
|
|
|
6
|
|
|
use Doctrine\Common\Collections\ArrayCollection; |
|
|
|
|
7
|
|
|
use ApiPlatform\Core\Annotation\ApiSubresource; |
|
|
|
|
8
|
|
|
use Symfony\Component\Serializer\Annotation\Groups; |
|
|
|
|
9
|
|
|
use ApiPlatform\Metadata\ApiFilter; |
|
|
|
|
10
|
|
|
use ApiPlatform\Doctrine\Orm\Filter\SearchFilter; |
|
|
|
|
11
|
|
|
use ApiPlatform\Doctrine\Orm\Filter\OrderFilter; |
|
|
|
|
12
|
|
|
use ControleOnline\Entity\OrderInvoice; |
13
|
|
|
use stdClass; |
14
|
|
|
use ApiPlatform\Doctrine\Orm\Filter\DateFilter; |
|
|
|
|
15
|
|
|
use ApiPlatform\Metadata\GetCollection; |
|
|
|
|
16
|
|
|
use ApiPlatform\Metadata\Put; |
|
|
|
|
17
|
|
|
use ApiPlatform\Metadata\Post; |
|
|
|
|
18
|
|
|
use ApiPlatform\Metadata\Get; |
|
|
|
|
19
|
|
|
use ApiPlatform\Metadata\ApiResource; |
|
|
|
|
20
|
|
|
use ApiPlatform\Metadata\ApiProperty; |
|
|
|
|
21
|
|
|
use ControleOnline\Controller\CreateNFeAction; |
|
|
|
|
22
|
|
|
use ControleOnline\Entity\OrderProduct; |
23
|
|
|
|
24
|
|
|
/** |
25
|
|
|
* Order |
26
|
|
|
* |
27
|
|
|
* @ORM\EntityListeners({ControleOnline\Listener\LogListener::class}) |
28
|
|
|
* @ORM\Table(name="orders", uniqueConstraints={@ORM\UniqueConstraint(name="discount_id", columns={"discount_coupon_id"})}, indexes={@ORM\Index(name="adress_destination_id", columns={"address_destination_id"}), @ORM\Index(name="notified", columns={"notified"}), @ORM\Index(name="delivery_contact_id", columns={"delivery_contact_id"}), @ORM\Index(name="delivery_people_id", columns={"delivery_people_id"}), @ORM\Index(name="status_id", columns={"status_id"}), @ORM\Index(name="order_date", columns={"order_date"}), @ORM\Index(name="provider_id", columns={"provider_id"}), @ORM\Index(name="quote_id", columns={"quote_id", "provider_id"}), @ORM\Index(name="adress_origin_id", columns={"address_origin_id"}), @ORM\Index(name="retrieve_contact_id", columns={"retrieve_contact_id"}), @ORM\Index(name="main_order_id", columns={"main_order_id"}), @ORM\Index(name="retrieve_people_id", columns={"retrieve_people_id"}), @ORM\Index(name="payer_people_id", columns={"payer_people_id"}), @ORM\Index(name="client_id", columns={"client_id"}), @ORM\Index(name="alter_date", columns={"alter_date"}), @ORM\Index(name="IDX_E52FFDEEDB805178", columns={"quote_id"})}) |
29
|
|
|
* @ORM\Entity(repositoryClass="ControleOnline\Repository\OrderRepository") |
30
|
|
|
*/ |
31
|
|
|
|
32
|
|
|
#[ApiResource( |
33
|
|
|
operations: [ |
34
|
|
|
new Get( |
35
|
|
|
security: 'is_granted(\'ROLE_CLIENT\')', |
36
|
|
|
), |
37
|
|
|
new GetCollection( |
38
|
|
|
security: 'is_granted(\'ROLE_ADMIN\') or is_granted(\'ROLE_CLIENT\')', |
39
|
|
|
normalizationContext: ['groups' => ['order:read']], |
40
|
|
|
), |
41
|
|
|
new Post( |
42
|
|
|
security: 'is_granted(\'ROLE_ADMIN\') or is_granted(\'ROLE_CLIENT\')', |
43
|
|
|
validationContext: ['groups' => ['order:write']], |
44
|
|
|
denormalizationContext: ['groups' => ['order:write']] |
45
|
|
|
), |
46
|
|
|
new Put( |
47
|
|
|
security: 'is_granted(\'ROLE_ADMIN\') or (is_granted(\'ROLE_CLIENT\'))', |
48
|
|
|
validationContext: ['groups' => ['order:write']], |
49
|
|
|
denormalizationContext: ['groups' => ['order:write']] |
50
|
|
|
), |
51
|
|
|
new Post( |
52
|
|
|
security: 'is_granted(\'ROLE_CLIENT\')', |
53
|
|
|
uriTemplate: '/orders/{id}/nfe', |
54
|
|
|
#requirements: ['format' => '^(pdf|xml)+$'], |
55
|
|
|
controller: CreateNFeAction::class |
56
|
|
|
), |
57
|
|
|
], |
58
|
|
|
formats: ['jsonld', 'json', 'html', 'jsonhal', 'csv' => ['text/csv']], |
59
|
|
|
normalizationContext: ['groups' => ['order_details:read']], |
60
|
|
|
denormalizationContext: ['groups' => ['order:write']] |
61
|
|
|
)] |
62
|
|
|
#[ApiFilter(filterClass: OrderFilter::class, properties: ['alterDate' => 'DESC'])] |
63
|
|
|
|
64
|
|
|
|
65
|
|
|
class Order |
66
|
|
|
{ |
67
|
|
|
/** |
68
|
|
|
* @var integer |
69
|
|
|
* |
70
|
|
|
* @ORM\Column(name="id", type="integer", nullable=false) |
71
|
|
|
* @ORM\Id |
72
|
|
|
* @ORM\GeneratedValue(strategy="IDENTITY") |
73
|
|
|
* @Groups({"order_product_queue:read","order:read","order_details:read","company_expense:read","coupon:read","logistic:read","order_invoice:read"}) |
74
|
|
|
*/ |
75
|
|
|
#[ApiFilter(filterClass: SearchFilter::class, properties: ['id' => 'exact'])] |
76
|
|
|
|
77
|
|
|
private $id; |
78
|
|
|
|
79
|
|
|
/** |
80
|
|
|
* @var \ControleOnline\Entity\People |
|
|
|
|
81
|
|
|
* |
82
|
|
|
* @ORM\ManyToOne(targetEntity="ControleOnline\Entity\People") |
83
|
|
|
* @ORM\JoinColumns({ |
84
|
|
|
* @ORM\JoinColumn(name="client_id", referencedColumnName="id") |
85
|
|
|
* }) |
86
|
|
|
* @Groups({"order_product_queue:read","order:read","order_details:read","order:write", "invoice:read"}) |
87
|
|
|
*/ |
88
|
|
|
#[ApiFilter(filterClass: SearchFilter::class, properties: ['client' => 'exact'])] |
89
|
|
|
|
90
|
|
|
private $client; |
91
|
|
|
|
92
|
|
|
/** |
93
|
|
|
* @var \DateTimeInterface |
94
|
|
|
* @ORM\Column(name="order_date", type="datetime", nullable=false, columnDefinition="DATETIME") |
95
|
|
|
* @Groups({"order_product_queue:read","order:read","order_details:read","order:write"}) |
96
|
|
|
*/ |
97
|
|
|
#[ApiFilter(DateFilter::class, properties: ['orderDate'])] |
98
|
|
|
|
99
|
|
|
private $orderDate; |
100
|
|
|
|
101
|
|
|
/** |
102
|
|
|
* @ORM\OneToMany(targetEntity="ControleOnline\Entity\OrderProduct", mappedBy="order", cascade={"persist"}) |
103
|
|
|
* @Groups({"order_details:read","order:write"}) |
104
|
|
|
*/ |
105
|
|
|
private $orderProducts; |
106
|
|
|
|
107
|
|
|
/** |
108
|
|
|
* @var \Doctrine\Common\Collections\Collection |
|
|
|
|
109
|
|
|
* |
110
|
|
|
* @ORM\OneToMany(targetEntity="ControleOnline\Entity\OrderInvoice", mappedBy="order") |
111
|
|
|
*/ |
112
|
|
|
#[ApiFilter(filterClass: SearchFilter::class, properties: ['invoice' => 'exact'])] |
113
|
|
|
private $invoice; |
114
|
|
|
|
115
|
|
|
/** |
116
|
|
|
* @var \Doctrine\Common\Collections\Collection |
117
|
|
|
* |
118
|
|
|
* @ORM\OneToMany(targetEntity="ControleOnline\Entity\Task", mappedBy="order") |
119
|
|
|
*/ |
120
|
|
|
#[ApiFilter(filterClass: SearchFilter::class, properties: ['task' => 'exact'])] |
121
|
|
|
|
122
|
|
|
private $task; |
123
|
|
|
|
124
|
|
|
/** |
125
|
|
|
* @var \Doctrine\Common\Collections\Collection |
126
|
|
|
* |
127
|
|
|
* @ORM\OneToMany(targetEntity="ControleOnline\Entity\OrderInvoiceTax", mappedBy="order") |
128
|
|
|
*/ |
129
|
|
|
#[ApiFilter(filterClass: SearchFilter::class, properties: ['invoiceTax' => 'exact'])] |
130
|
|
|
|
131
|
|
|
private $invoiceTax; |
132
|
|
|
|
133
|
|
|
/** |
134
|
|
|
* @ORM\Column(name="alter_date", type="datetime", nullable=false) |
135
|
|
|
* @Groups({"display:read","order_product_queue:read","order:read","order_details:read","order:write"}) |
136
|
|
|
*/ |
137
|
|
|
|
138
|
|
|
#[ApiFilter(DateFilter::class, properties: ['alterDate'])] |
139
|
|
|
|
140
|
|
|
private $alterDate; |
141
|
|
|
|
142
|
|
|
|
143
|
|
|
/** |
144
|
|
|
* @var \ControleOnline\Entity\Status |
145
|
|
|
* |
146
|
|
|
* @ORM\ManyToOne(targetEntity="ControleOnline\Entity\Status") |
147
|
|
|
* @ORM\JoinColumns({ |
148
|
|
|
* @ORM\JoinColumn(name="status_id", referencedColumnName="id") |
149
|
|
|
* }) |
150
|
|
|
* @Groups({"display:read","order_product_queue:read","order:read","order_details:read","order:write"}) |
151
|
|
|
*/ |
152
|
|
|
#[ApiFilter(filterClass: SearchFilter::class, properties: ['status' => 'exact'])] |
153
|
|
|
|
154
|
|
|
private $status; |
155
|
|
|
|
156
|
|
|
/** |
157
|
|
|
* @var string |
158
|
|
|
* |
159
|
|
|
* @ORM\Column(name="order_type", type="string", nullable=true) |
160
|
|
|
* @Groups({"display:read","order_product_queue:read","order:read","order_details:read","order:write"}) |
161
|
|
|
*/ |
162
|
|
|
#[ApiFilter(filterClass: SearchFilter::class, properties: ['orderType' => 'exact'])] |
163
|
|
|
|
164
|
|
|
private $orderType = 'Online'; |
165
|
|
|
|
166
|
|
|
|
167
|
|
|
/** |
168
|
|
|
* @var string |
169
|
|
|
* |
170
|
|
|
* @ORM\Column(name="app", type="string", nullable=true) |
171
|
|
|
* @Groups({"display:read","order_product_queue:read","order:read","order_details:read","order:write"}) |
172
|
|
|
*/ |
173
|
|
|
#[ApiFilter(filterClass: SearchFilter::class, properties: ['app' => 'exact'])] |
174
|
|
|
|
175
|
|
|
private $app = 'Manual'; |
176
|
|
|
|
177
|
|
|
/** |
178
|
|
|
* @var string |
179
|
|
|
* |
180
|
|
|
* @ORM\Column(name="other_informations", type="json", nullable=true) |
181
|
|
|
* @Groups({"order_product_queue:read","order:read","order_details:read","order:write"}) |
182
|
|
|
*/ |
183
|
|
|
#[ApiFilter(filterClass: SearchFilter::class, properties: ['otherInformations' => 'exact'])] |
184
|
|
|
|
185
|
|
|
private $otherInformations; |
186
|
|
|
|
187
|
|
|
/** |
188
|
|
|
* @var \ControleOnline\Entity\Order |
189
|
|
|
* |
190
|
|
|
* @ORM\ManyToOne(targetEntity="ControleOnline\Entity\Order") |
191
|
|
|
* @ORM\JoinColumns({ |
192
|
|
|
* @ORM\JoinColumn(name="main_order_id", referencedColumnName="id") |
193
|
|
|
* }) |
194
|
|
|
*/ |
195
|
|
|
#[ApiFilter(filterClass: SearchFilter::class, properties: ['mainOrder' => 'exact'])] |
196
|
|
|
|
197
|
|
|
private $mainOrder; |
198
|
|
|
|
199
|
|
|
|
200
|
|
|
/** |
201
|
|
|
* @var integer |
202
|
|
|
* |
203
|
|
|
* @ORM\Column(name="main_order_id", type="integer", nullable=true) |
204
|
|
|
* @Groups({"order_product_queue:read","order:read","order_details:read","order:write"}) |
205
|
|
|
*/ |
206
|
|
|
#[ApiFilter(filterClass: SearchFilter::class, properties: ['mainOrderId' => 'exact'])] |
207
|
|
|
|
208
|
|
|
private $mainOrderId; |
209
|
|
|
|
210
|
|
|
|
211
|
|
|
|
212
|
|
|
/** |
213
|
|
|
* @var \ControleOnline\Entity\People |
214
|
|
|
* |
215
|
|
|
* @ORM\ManyToOne(targetEntity="ControleOnline\Entity\People") |
216
|
|
|
* @ORM\JoinColumns({ |
217
|
|
|
* @ORM\JoinColumn(name="payer_people_id", referencedColumnName="id") |
218
|
|
|
* }) |
219
|
|
|
* @Groups({"order_product_queue:read","order:read","order_details:read","order:write","invoice:read"}) |
220
|
|
|
*/ |
221
|
|
|
#[ApiFilter(filterClass: SearchFilter::class, properties: ['payer' => 'exact'])] |
222
|
|
|
|
223
|
|
|
private $payer; |
224
|
|
|
|
225
|
|
|
/** |
226
|
|
|
* @var \ControleOnline\Entity\People |
227
|
|
|
* |
228
|
|
|
* @ORM\ManyToOne(targetEntity="ControleOnline\Entity\People") |
229
|
|
|
* @ORM\JoinColumns({ |
230
|
|
|
* @ORM\JoinColumn(name="provider_id", referencedColumnName="id") |
231
|
|
|
* }) |
232
|
|
|
* @Groups({"order_product_queue:read","order:read","order_details:read","order:write","invoice:read"}) |
233
|
|
|
*/ |
234
|
|
|
#[ApiFilter(filterClass: SearchFilter::class, properties: ['provider' => 'exact'])] |
235
|
|
|
|
236
|
|
|
private $provider; |
237
|
|
|
|
238
|
|
|
|
239
|
|
|
|
240
|
|
|
|
241
|
|
|
|
242
|
|
|
/** |
243
|
|
|
* @var \ControleOnline\Entity\Address |
|
|
|
|
244
|
|
|
* |
245
|
|
|
* @ORM\ManyToOne(targetEntity="ControleOnline\Entity\Address") |
246
|
|
|
* @ORM\JoinColumns({ |
247
|
|
|
* @ORM\JoinColumn(name="address_origin_id", referencedColumnName="id") |
248
|
|
|
* }) |
249
|
|
|
* @Groups({"order_details:read","order:write"}) |
250
|
|
|
*/ |
251
|
|
|
#[ApiFilter(filterClass: SearchFilter::class, properties: ['addressOrigin' => 'exact'])] |
252
|
|
|
|
253
|
|
|
private $addressOrigin; |
254
|
|
|
|
255
|
|
|
/** |
256
|
|
|
* @var \ControleOnline\Entity\Address |
257
|
|
|
* |
258
|
|
|
* @ORM\ManyToOne(targetEntity="ControleOnline\Entity\Address") |
259
|
|
|
* @ORM\JoinColumns({ |
260
|
|
|
* @ORM\JoinColumn(name="address_destination_id", referencedColumnName="id") |
261
|
|
|
* }) |
262
|
|
|
* @Groups({"order_details:read","order:write"}) |
263
|
|
|
*/ |
264
|
|
|
#[ApiFilter(filterClass: SearchFilter::class, properties: ['addressDestination' => 'exact'])] |
265
|
|
|
|
266
|
|
|
private $addressDestination; |
267
|
|
|
|
268
|
|
|
/** |
269
|
|
|
* @var \ControleOnline\Entity\People |
270
|
|
|
* |
271
|
|
|
* @ORM\ManyToOne(targetEntity="ControleOnline\Entity\People") |
272
|
|
|
* @ORM\JoinColumns({ |
273
|
|
|
* @ORM\JoinColumn(name="retrieve_contact_id", referencedColumnName="id") |
274
|
|
|
* }) |
275
|
|
|
*/ |
276
|
|
|
#[ApiFilter(filterClass: SearchFilter::class, properties: ['retrieveContact' => 'exact'])] |
277
|
|
|
|
278
|
|
|
private $retrieveContact; |
279
|
|
|
|
280
|
|
|
/** |
281
|
|
|
* @var \ControleOnline\Entity\People |
282
|
|
|
* |
283
|
|
|
* @ORM\ManyToOne(targetEntity="ControleOnline\Entity\People") |
284
|
|
|
* @ORM\JoinColumns({ |
285
|
|
|
* @ORM\JoinColumn(name="delivery_contact_id", referencedColumnName="id") |
286
|
|
|
* }) |
287
|
|
|
*/ |
288
|
|
|
#[ApiFilter(filterClass: SearchFilter::class, properties: ['deliveryContact' => 'exact'])] |
289
|
|
|
|
290
|
|
|
private $deliveryContact; |
291
|
|
|
|
292
|
|
|
|
293
|
|
|
/** |
294
|
|
|
* @var float |
295
|
|
|
* |
296
|
|
|
* @ORM\Column(name="price", type="float", nullable=false) |
297
|
|
|
* @Groups({"order_product_queue:read","order:read","order_details:read","order:write"}) |
298
|
|
|
*/ |
299
|
|
|
#[ApiFilter(filterClass: SearchFilter::class, properties: ['price' => 'exact'])] |
300
|
|
|
|
301
|
|
|
private $price = 0; |
302
|
|
|
|
303
|
|
|
|
304
|
|
|
|
305
|
|
|
/** |
306
|
|
|
* @var string |
307
|
|
|
* |
308
|
|
|
* @ORM\Column(name="comments", type="string", nullable=true) |
309
|
|
|
* @Groups({"order_product_queue:read","order:read","order_details:read","order:write"}) |
310
|
|
|
*/ |
311
|
|
|
#[ApiFilter(filterClass: SearchFilter::class, properties: ['comments' => 'exact'])] |
312
|
|
|
|
313
|
|
|
private $comments; |
314
|
|
|
|
315
|
|
|
/** |
316
|
|
|
* @var boolean |
317
|
|
|
* |
318
|
|
|
* @ORM\Column(name="notified", type="boolean") |
319
|
|
|
*/ |
320
|
|
|
#[ApiFilter(filterClass: SearchFilter::class, properties: ['notified' => 'exact'])] |
321
|
|
|
|
322
|
|
|
private $notified = false; |
323
|
|
|
|
324
|
|
|
|
325
|
|
|
|
326
|
|
|
|
327
|
|
|
|
328
|
|
|
public function __construct() |
329
|
|
|
{ |
330
|
|
|
$this->orderDate = new \DateTime('now'); |
331
|
|
|
$this->alterDate = new \DateTime('now'); |
332
|
|
|
$this->invoiceTax = new ArrayCollection(); |
333
|
|
|
$this->invoice = new ArrayCollection(); |
334
|
|
|
$this->task = new ArrayCollection(); |
335
|
|
|
$this->orderProducts = new ArrayCollection(); |
336
|
|
|
// $this->parkingDate = new \DateTime('now'); |
337
|
|
|
$this->otherInformations = json_encode(new stdClass()); |
338
|
|
|
} |
339
|
|
|
|
340
|
|
|
public function resetId() |
341
|
|
|
{ |
342
|
|
|
$this->id = null; |
343
|
|
|
$this->orderDate = new \DateTime('now'); |
344
|
|
|
$this->alterDate = new \DateTime('now'); |
345
|
|
|
// $this->parkingDate = new \DateTime('now'); |
346
|
|
|
} |
347
|
|
|
|
348
|
|
|
/** |
349
|
|
|
* Get id |
350
|
|
|
* |
351
|
|
|
* @return integer |
352
|
|
|
*/ |
353
|
|
|
public function getId() |
354
|
|
|
{ |
355
|
|
|
return $this->id; |
356
|
|
|
} |
357
|
|
|
|
358
|
|
|
/** |
359
|
|
|
* Set status |
360
|
|
|
* |
361
|
|
|
* @param \ControleOnline\Entity\Status $status |
362
|
|
|
* @return Order |
363
|
|
|
*/ |
364
|
|
|
public function setStatus(\ControleOnline\Entity\Status $status = null) |
365
|
|
|
{ |
366
|
|
|
$this->status = $status; |
367
|
|
|
|
368
|
|
|
return $this; |
369
|
|
|
} |
370
|
|
|
|
371
|
|
|
/** |
372
|
|
|
* Get status |
373
|
|
|
* |
374
|
|
|
* @return \ControleOnline\Entity\Status |
375
|
|
|
*/ |
376
|
|
|
public function getStatus() |
377
|
|
|
{ |
378
|
|
|
return $this->status; |
379
|
|
|
} |
380
|
|
|
|
381
|
|
|
/** |
382
|
|
|
* Set client |
383
|
|
|
* |
384
|
|
|
* @param \ControleOnline\Entity\People $client |
385
|
|
|
* @return Order |
386
|
|
|
*/ |
387
|
|
|
public function setClient(\ControleOnline\Entity\People $client = null) |
388
|
|
|
{ |
389
|
|
|
$this->client = $client; |
390
|
|
|
|
391
|
|
|
return $this; |
392
|
|
|
} |
393
|
|
|
|
394
|
|
|
/** |
395
|
|
|
* Get client |
396
|
|
|
* |
397
|
|
|
* @return \ControleOnline\Entity\People |
398
|
|
|
*/ |
399
|
|
|
public function getClient() |
400
|
|
|
{ |
401
|
|
|
return $this->client; |
402
|
|
|
} |
403
|
|
|
|
404
|
|
|
/** |
405
|
|
|
* Set provider |
406
|
|
|
* |
407
|
|
|
* @param \ControleOnline\Entity\People $provider |
408
|
|
|
* @return Order |
409
|
|
|
*/ |
410
|
|
|
public function setProvider(\ControleOnline\Entity\People $provider = null) |
411
|
|
|
{ |
412
|
|
|
$this->provider = $provider; |
413
|
|
|
|
414
|
|
|
return $this; |
415
|
|
|
} |
416
|
|
|
|
417
|
|
|
/** |
418
|
|
|
* Get provider |
419
|
|
|
* |
420
|
|
|
* @return \ControleOnline\Entity\People |
421
|
|
|
*/ |
422
|
|
|
public function getProvider() |
423
|
|
|
{ |
424
|
|
|
return $this->provider; |
425
|
|
|
} |
426
|
|
|
|
427
|
|
|
/** |
428
|
|
|
* Set price |
429
|
|
|
* |
430
|
|
|
* @param float $price |
431
|
|
|
* @return Order |
432
|
|
|
*/ |
433
|
|
|
public function setPrice($price) |
434
|
|
|
{ |
435
|
|
|
$this->price = $price; |
436
|
|
|
|
437
|
|
|
return $this; |
438
|
|
|
} |
439
|
|
|
|
440
|
|
|
/** |
441
|
|
|
* Get price |
442
|
|
|
* |
443
|
|
|
* @return float |
444
|
|
|
*/ |
445
|
|
|
public function getPrice() |
446
|
|
|
{ |
447
|
|
|
return $this->price; |
448
|
|
|
} |
449
|
|
|
|
450
|
|
|
|
451
|
|
|
/** |
452
|
|
|
* Set addressOrigin |
453
|
|
|
* |
454
|
|
|
* @param \ControleOnline\Entity\Address $address_origin |
455
|
|
|
* @return Order |
456
|
|
|
*/ |
457
|
|
|
public function setAddressOrigin(\ControleOnline\Entity\Address $address_origin = null) |
458
|
|
|
{ |
459
|
|
|
$this->addressOrigin = $address_origin; |
460
|
|
|
|
461
|
|
|
return $this; |
462
|
|
|
} |
463
|
|
|
|
464
|
|
|
/** |
465
|
|
|
* Get addressOrigin |
466
|
|
|
* |
467
|
|
|
* @return \ControleOnline\Entity\Address |
468
|
|
|
*/ |
469
|
|
|
public function getAddressOrigin() |
470
|
|
|
{ |
471
|
|
|
return $this->addressOrigin; |
472
|
|
|
} |
473
|
|
|
|
474
|
|
|
/** |
475
|
|
|
* Set addressDestination |
476
|
|
|
* |
477
|
|
|
* @param \ControleOnline\Entity\Address $address_destination |
478
|
|
|
* @return Order |
479
|
|
|
*/ |
480
|
|
|
public function setAddressDestination(\ControleOnline\Entity\Address $address_destination = null) |
481
|
|
|
{ |
482
|
|
|
$this->addressDestination = $address_destination; |
483
|
|
|
|
484
|
|
|
return $this; |
485
|
|
|
} |
486
|
|
|
|
487
|
|
|
/** |
488
|
|
|
* Get quote |
489
|
|
|
* |
490
|
|
|
* @return \ControleOnline\Entity\Address |
491
|
|
|
*/ |
492
|
|
|
public function getAddressDestination() |
493
|
|
|
{ |
494
|
|
|
return $this->addressDestination; |
495
|
|
|
} |
496
|
|
|
|
497
|
|
|
/** |
498
|
|
|
* Get retrieveContact |
499
|
|
|
* |
500
|
|
|
* @return \ControleOnline\Entity\People |
501
|
|
|
*/ |
502
|
|
|
public function getRetrieveContact() |
503
|
|
|
{ |
504
|
|
|
return $this->retrieveContact; |
505
|
|
|
} |
506
|
|
|
|
507
|
|
|
/** |
508
|
|
|
* Set retrieveContact |
509
|
|
|
* |
510
|
|
|
* @param \ControleOnline\Entity\People $retrieve_contact |
511
|
|
|
* @return Order |
512
|
|
|
*/ |
513
|
|
|
public function setRetrieveContact(\ControleOnline\Entity\People $retrieve_contact = null) |
514
|
|
|
{ |
515
|
|
|
$this->retrieveContact = $retrieve_contact; |
516
|
|
|
|
517
|
|
|
return $this; |
518
|
|
|
} |
519
|
|
|
|
520
|
|
|
/** |
521
|
|
|
* Get deliveryContact |
522
|
|
|
* |
523
|
|
|
* @return \ControleOnline\Entity\People |
524
|
|
|
*/ |
525
|
|
|
public function getDeliveryContact() |
526
|
|
|
{ |
527
|
|
|
return $this->deliveryContact; |
528
|
|
|
} |
529
|
|
|
|
530
|
|
|
/** |
531
|
|
|
* Set deliveryContact |
532
|
|
|
* |
533
|
|
|
* @param \ControleOnline\Entity\People $delivery_contact |
534
|
|
|
* @return Order |
535
|
|
|
*/ |
536
|
|
|
public function setDeliveryContact(\ControleOnline\Entity\People $delivery_contact = null) |
537
|
|
|
{ |
538
|
|
|
$this->deliveryContact = $delivery_contact; |
539
|
|
|
|
540
|
|
|
return $this; |
541
|
|
|
} |
542
|
|
|
|
543
|
|
|
/** |
544
|
|
|
* Set payer |
545
|
|
|
* |
546
|
|
|
* @param \ControleOnline\Entity\People $payer |
547
|
|
|
* @return Order |
548
|
|
|
*/ |
549
|
|
|
public function setPayer(\ControleOnline\Entity\People $payer = null) |
550
|
|
|
{ |
551
|
|
|
$this->payer = $payer; |
552
|
|
|
|
553
|
|
|
return $this; |
554
|
|
|
} |
555
|
|
|
|
556
|
|
|
/** |
557
|
|
|
* Get payer |
558
|
|
|
* |
559
|
|
|
* @return \ControleOnline\Entity\People |
560
|
|
|
*/ |
561
|
|
|
public function getPayer() |
562
|
|
|
{ |
563
|
|
|
return $this->payer; |
564
|
|
|
} |
565
|
|
|
|
566
|
|
|
|
567
|
|
|
/** |
568
|
|
|
* Set comments |
569
|
|
|
* |
570
|
|
|
* @param string $comments |
571
|
|
|
* @return Order |
572
|
|
|
*/ |
573
|
|
|
public function setComments($comments) |
574
|
|
|
{ |
575
|
|
|
$this->comments = $comments; |
576
|
|
|
|
577
|
|
|
return $this; |
578
|
|
|
} |
579
|
|
|
|
580
|
|
|
/** |
581
|
|
|
* Get comments |
582
|
|
|
* |
583
|
|
|
* @return string |
584
|
|
|
*/ |
585
|
|
|
public function getComments() |
586
|
|
|
{ |
587
|
|
|
return $this->comments; |
588
|
|
|
} |
589
|
|
|
|
590
|
|
|
/** |
591
|
|
|
* Get otherInformations |
592
|
|
|
* |
593
|
|
|
* @return stdClass |
594
|
|
|
*/ |
595
|
|
|
public function getOtherInformations($decode = false) |
596
|
|
|
{ |
597
|
|
|
return $decode ? (object) json_decode((is_array($this->otherInformations) ? json_encode($this->otherInformations) : $this->otherInformations)) : $this->otherInformations; |
|
|
|
|
598
|
|
|
} |
599
|
|
|
|
600
|
|
|
/** |
601
|
|
|
* Set comments |
602
|
|
|
* |
603
|
|
|
* @param string $otherInformations |
604
|
|
|
* @return Order |
605
|
|
|
*/ |
606
|
|
|
public function addOtherInformations($key, $value) |
607
|
|
|
{ |
608
|
|
|
$otherInformations = $this->getOtherInformations(true); |
609
|
|
|
$otherInformations->$key = $value; |
610
|
|
|
$this->otherInformations = json_encode($otherInformations); |
611
|
|
|
return $this; |
612
|
|
|
} |
613
|
|
|
|
614
|
|
|
/** |
615
|
|
|
* Set comments |
616
|
|
|
* |
617
|
|
|
* @param string $otherInformations |
618
|
|
|
* @return Order |
619
|
|
|
*/ |
620
|
|
|
public function setOtherInformations($otherInformations) |
621
|
|
|
{ |
622
|
|
|
$this->otherInformations = json_encode($otherInformations); |
623
|
|
|
return $this; |
624
|
|
|
} |
625
|
|
|
|
626
|
|
|
|
627
|
|
|
/** |
628
|
|
|
* Get orderDate |
629
|
|
|
* |
630
|
|
|
* @return \DateTimeInterface |
631
|
|
|
*/ |
632
|
|
|
public function getOrderDate() |
633
|
|
|
{ |
634
|
|
|
return $this->orderDate; |
635
|
|
|
} |
636
|
|
|
|
637
|
|
|
/** |
638
|
|
|
* Set alter_date |
639
|
|
|
* |
640
|
|
|
* @param \DateTimeInterface $alter_date |
641
|
|
|
*/ |
642
|
|
|
public function setAlterDate(\DateTimeInterface $alter_date = null): self |
643
|
|
|
{ |
644
|
|
|
$this->alterDate = $alter_date; |
645
|
|
|
|
646
|
|
|
return $this; |
647
|
|
|
} |
648
|
|
|
|
649
|
|
|
/** |
650
|
|
|
* Get alter_date |
651
|
|
|
* |
652
|
|
|
*/ |
653
|
|
|
public function getAlterDate(): ?\DateTimeInterface |
654
|
|
|
{ |
655
|
|
|
return $this->alterDate; |
656
|
|
|
} |
657
|
|
|
|
658
|
|
|
/** |
659
|
|
|
* Add invoiceTax |
660
|
|
|
* |
661
|
|
|
* @param \ControleOnline\Entity\OrderInvoiceTax $invoice_tax |
662
|
|
|
* @return Order |
663
|
|
|
*/ |
664
|
|
|
public function addAInvoiceTax(OrderInvoiceTax $invoice_tax) |
|
|
|
|
665
|
|
|
{ |
666
|
|
|
$this->invoiceTax[] = $invoice_tax; |
667
|
|
|
|
668
|
|
|
return $this; |
669
|
|
|
} |
670
|
|
|
|
671
|
|
|
/** |
672
|
|
|
* Remove invoiceTax |
673
|
|
|
* |
674
|
|
|
* @param \ControleOnline\Entity\OrderInvoiceTax $invoice_tax |
675
|
|
|
*/ |
676
|
|
|
public function removeInvoiceTax(OrderInvoiceTax $invoice_tax) |
677
|
|
|
{ |
678
|
|
|
$this->invoiceTax->removeElement($invoice_tax); |
679
|
|
|
} |
680
|
|
|
|
681
|
|
|
/** |
682
|
|
|
* Get invoiceTax |
683
|
|
|
* |
684
|
|
|
* @return \Doctrine\Common\Collections\Collection |
685
|
|
|
*/ |
686
|
|
|
public function getInvoiceTax() |
687
|
|
|
{ |
688
|
|
|
return $this->invoiceTax; |
689
|
|
|
} |
690
|
|
|
|
691
|
|
|
|
692
|
|
|
|
693
|
|
|
/** |
694
|
|
|
* Get invoiceTax |
695
|
|
|
* |
696
|
|
|
* @return \ControleOnline\Entity\InvoiceTax |
|
|
|
|
697
|
|
|
*/ |
698
|
|
|
public function getClientInvoiceTax() |
699
|
|
|
{ |
700
|
|
|
foreach ($this->getInvoiceTax() as $invoice) { |
701
|
|
|
if ($invoice->getInvoiceType() == 55) { |
702
|
|
|
return $invoice; |
703
|
|
|
} |
704
|
|
|
} |
705
|
|
|
} |
706
|
|
|
|
707
|
|
|
|
708
|
|
|
/** |
709
|
|
|
* Get invoiceTax |
710
|
|
|
* |
711
|
|
|
* @return \ControleOnline\Entity\InvoiceTax |
712
|
|
|
*/ |
713
|
|
|
public function getCarrierInvoiceTax() |
714
|
|
|
{ |
715
|
|
|
foreach ($this->getInvoiceTax() as $invoice) { |
716
|
|
|
if ($invoice->getInvoiceType() == 57) { |
717
|
|
|
return $invoice->getInvoiceTax(); |
718
|
|
|
} |
719
|
|
|
} |
720
|
|
|
} |
721
|
|
|
|
722
|
|
|
/** |
723
|
|
|
* Add OrderInvoice |
724
|
|
|
* |
725
|
|
|
* @param \ControleOnline\Entity\OrderInvoice $invoice |
726
|
|
|
* @return People |
727
|
|
|
*/ |
728
|
|
|
public function addInvoice(OrderInvoice $invoice) |
729
|
|
|
{ |
730
|
|
|
$this->invoice[] = $invoice; |
731
|
|
|
|
732
|
|
|
return $this; |
|
|
|
|
733
|
|
|
} |
734
|
|
|
|
735
|
|
|
/** |
736
|
|
|
* Remove OrderInvoice |
737
|
|
|
* |
738
|
|
|
* @param \ControleOnline\Entity\OrderInvoice $invoice |
739
|
|
|
*/ |
740
|
|
|
public function removeInvoice(OrderInvoice $invoice) |
741
|
|
|
{ |
742
|
|
|
$this->invoice->removeElement($invoice); |
743
|
|
|
} |
744
|
|
|
|
745
|
|
|
/** |
746
|
|
|
* Get OrderInvoice |
747
|
|
|
* |
748
|
|
|
* @return \Doctrine\Common\Collections\Collection |
749
|
|
|
*/ |
750
|
|
|
public function getInvoice() |
751
|
|
|
{ |
752
|
|
|
return $this->invoice; |
753
|
|
|
} |
754
|
|
|
|
755
|
|
|
|
756
|
|
|
/** |
757
|
|
|
* Get Notified |
758
|
|
|
* |
759
|
|
|
* @return boolean |
760
|
|
|
*/ |
761
|
|
|
public function getNotified() |
762
|
|
|
{ |
763
|
|
|
return $this->notified; |
764
|
|
|
} |
765
|
|
|
|
766
|
|
|
/** |
767
|
|
|
* Set Notified |
768
|
|
|
* |
769
|
|
|
* @param boolean $notified |
770
|
|
|
* @return People |
771
|
|
|
*/ |
772
|
|
|
public function setNotified($notified) |
773
|
|
|
{ |
774
|
|
|
$this->notified = $notified ? 1 : 0; |
|
|
|
|
775
|
|
|
|
776
|
|
|
return $this; |
|
|
|
|
777
|
|
|
} |
778
|
|
|
|
779
|
|
|
/** |
780
|
|
|
* Set orderType |
781
|
|
|
* |
782
|
|
|
* @param string $orderType |
783
|
|
|
* @return Order |
784
|
|
|
*/ |
785
|
|
|
public function setOrderType($order_type) |
786
|
|
|
{ |
787
|
|
|
$this->orderType = $order_type; |
788
|
|
|
|
789
|
|
|
return $this; |
790
|
|
|
} |
791
|
|
|
|
792
|
|
|
/** |
793
|
|
|
* Get orderType |
794
|
|
|
* |
795
|
|
|
* @return string |
796
|
|
|
*/ |
797
|
|
|
public function getOrderType() |
798
|
|
|
{ |
799
|
|
|
return $this->orderType; |
800
|
|
|
} |
801
|
|
|
|
802
|
|
|
/** |
803
|
|
|
* Set app |
804
|
|
|
* |
805
|
|
|
* @param string $app |
806
|
|
|
* @return Order |
807
|
|
|
*/ |
808
|
|
|
public function setApp($app) |
809
|
|
|
{ |
810
|
|
|
$this->app = $app; |
811
|
|
|
|
812
|
|
|
return $this; |
813
|
|
|
} |
814
|
|
|
|
815
|
|
|
/** |
816
|
|
|
* Get app |
817
|
|
|
* |
818
|
|
|
* @return string |
819
|
|
|
*/ |
820
|
|
|
public function getApp() |
821
|
|
|
{ |
822
|
|
|
return $this->app; |
823
|
|
|
} |
824
|
|
|
|
825
|
|
|
|
826
|
|
|
|
827
|
|
|
/** |
828
|
|
|
* Set mainOrder |
829
|
|
|
* |
830
|
|
|
* @param \ControleOnline\Entity\Order $mainOrder |
831
|
|
|
* @return Order |
832
|
|
|
*/ |
833
|
|
|
public function setMainOrder(\ControleOnline\Entity\Order $main_order = null) |
834
|
|
|
{ |
835
|
|
|
$this->mainOrder = $main_order; |
836
|
|
|
|
837
|
|
|
return $this; |
838
|
|
|
} |
839
|
|
|
|
840
|
|
|
/** |
841
|
|
|
* Get mainOrder |
842
|
|
|
* |
843
|
|
|
* @return \ControleOnline\Entity\Order |
844
|
|
|
*/ |
845
|
|
|
public function getMainOrder() |
846
|
|
|
{ |
847
|
|
|
return $this->mainOrder; |
848
|
|
|
} |
849
|
|
|
|
850
|
|
|
/** |
851
|
|
|
* Set mainOrderId |
852
|
|
|
* |
853
|
|
|
* @param integer $mainOrderId |
854
|
|
|
* @return Order |
855
|
|
|
*/ |
856
|
|
|
public function setMainOrderId($mainOrderId) |
857
|
|
|
{ |
858
|
|
|
$this->mainOrderId = $mainOrderId; |
859
|
|
|
|
860
|
|
|
return $this; |
861
|
|
|
} |
862
|
|
|
|
863
|
|
|
/** |
864
|
|
|
* Get mainOrderId |
865
|
|
|
* |
866
|
|
|
* @return integer |
867
|
|
|
*/ |
868
|
|
|
public function getMainOrderId() |
869
|
|
|
{ |
870
|
|
|
return $this->mainOrderId; |
871
|
|
|
} |
872
|
|
|
|
873
|
|
|
|
874
|
|
|
|
875
|
|
|
public function getInvoiceByStatus(array $status) |
876
|
|
|
{ |
877
|
|
|
foreach ($this->getInvoice() as $purchasingOrderInvoice) { |
878
|
|
|
$invoice = $purchasingOrderInvoice->getInvoice(); |
879
|
|
|
if (in_array($invoice->getStatus()->getStatus(), $status)) { |
880
|
|
|
return $invoice; |
881
|
|
|
} |
882
|
|
|
} |
883
|
|
|
} |
884
|
|
|
|
885
|
|
|
|
886
|
|
|
public function canAccess($currentUser): bool |
887
|
|
|
{ |
888
|
|
|
if (($provider = $this->getProvider()) === null) |
889
|
|
|
return false; |
890
|
|
|
|
891
|
|
|
return $currentUser->getPeople()->getLink()->exists( |
892
|
|
|
function ($key, $element) use ($provider) { |
893
|
|
|
return $element->getCompany() === $provider; |
894
|
|
|
} |
895
|
|
|
); |
896
|
|
|
} |
897
|
|
|
|
898
|
|
|
public function justOpened(): bool |
899
|
|
|
{ |
900
|
|
|
return $this->getStatus()->getStatus() == 'quote'; |
901
|
|
|
} |
902
|
|
|
|
903
|
|
|
|
904
|
|
|
public function getOneInvoice() |
905
|
|
|
{ |
906
|
|
|
return (($invoiceOrders = $this->getInvoice()->first()) === false) ? |
907
|
|
|
null : $invoiceOrders->getInvoice(); |
908
|
|
|
} |
909
|
|
|
|
910
|
|
|
/** |
911
|
|
|
* Add Task |
912
|
|
|
* |
913
|
|
|
* @param \ControleOnline\Entity\Task $task |
914
|
|
|
* @return Order |
915
|
|
|
*/ |
916
|
|
|
public function addTask(\ControleOnline\Entity\Task $task) |
|
|
|
|
917
|
|
|
{ |
918
|
|
|
$this->task[] = $task; |
919
|
|
|
|
920
|
|
|
return $this; |
921
|
|
|
} |
922
|
|
|
|
923
|
|
|
/** |
924
|
|
|
* Remove Task |
925
|
|
|
* |
926
|
|
|
* @param \ControleOnline\Entity\Task $task |
927
|
|
|
*/ |
928
|
|
|
public function removeTask(\ControleOnline\Entity\Task $task) |
929
|
|
|
{ |
930
|
|
|
$this->task->removeElement($task); |
931
|
|
|
} |
932
|
|
|
|
933
|
|
|
/** |
934
|
|
|
* Get Task |
935
|
|
|
* |
936
|
|
|
* @return \Doctrine\Common\Collections\Collection |
937
|
|
|
*/ |
938
|
|
|
public function getTask() |
939
|
|
|
{ |
940
|
|
|
return $this->task; |
941
|
|
|
} |
942
|
|
|
|
943
|
|
|
public function isOriginAndDestinationTheSame(): ?bool |
944
|
|
|
{ |
945
|
|
|
if (($origin = $this->getAddressOrigin()) === null) { |
946
|
|
|
return null; |
947
|
|
|
} |
948
|
|
|
|
949
|
|
|
if (($destination = $this->getAddressDestination()) === null) { |
950
|
|
|
return null; |
951
|
|
|
} |
952
|
|
|
|
953
|
|
|
$origCity = $origin->getStreet()->getDistrict()->getCity(); |
954
|
|
|
$destCity = $destination->getStreet()->getDistrict()->getCity(); |
955
|
|
|
|
956
|
|
|
// both objects are the same entity ( = same name and same state) |
957
|
|
|
|
958
|
|
|
if ($origCity === $destCity) { |
959
|
|
|
return true; |
960
|
|
|
} |
961
|
|
|
|
962
|
|
|
return false; |
963
|
|
|
} |
964
|
|
|
|
965
|
|
|
public function isOriginAndDestinationTheSameState(): ?bool |
966
|
|
|
{ |
967
|
|
|
if (($origin = $this->getAddressOrigin()) === null) { |
968
|
|
|
return null; |
969
|
|
|
} |
970
|
|
|
|
971
|
|
|
if (($destination = $this->getAddressDestination()) === null) { |
972
|
|
|
return null; |
973
|
|
|
} |
974
|
|
|
|
975
|
|
|
$origState = $origin->getStreet()->getDistrict()->getCity()->getState(); |
976
|
|
|
$destState = $destination->getStreet()->getDistrict()->getCity()->getState(); |
977
|
|
|
|
978
|
|
|
// both objects are the same entity ( = same name and same country) |
979
|
|
|
|
980
|
|
|
if ($origState === $destState) { |
981
|
|
|
return true; |
982
|
|
|
} |
983
|
|
|
|
984
|
|
|
return false; |
985
|
|
|
} |
986
|
|
|
|
987
|
|
|
|
988
|
|
|
public function getOrderProducts() |
989
|
|
|
{ |
990
|
|
|
return $this->orderProducts; |
991
|
|
|
} |
992
|
|
|
|
993
|
|
|
public function addOrderProduct(OrderProduct $orderProduct): self |
994
|
|
|
{ |
995
|
|
|
$this->orderProducts[] = $orderProduct; |
996
|
|
|
return $this; |
997
|
|
|
} |
998
|
|
|
|
999
|
|
|
public function removeOrderProduct(OrderProduct $orderProduct): self |
1000
|
|
|
{ |
1001
|
|
|
$this->orderProducts->removeElement($orderProduct); |
1002
|
|
|
return $this; |
1003
|
|
|
} |
1004
|
|
|
} |
1005
|
|
|
|
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"]
, you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths