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