|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace ControleOnline\Entity; |
|
4
|
|
|
|
|
5
|
|
|
use Symfony\Component\Serializer\Attribute\Groups; |
|
|
|
|
|
|
6
|
|
|
|
|
7
|
|
|
use ApiPlatform\Doctrine\Orm\Filter\DateFilter; |
|
|
|
|
|
|
8
|
|
|
use ApiPlatform\Doctrine\Orm\Filter\OrderFilter; |
|
|
|
|
|
|
9
|
|
|
use ApiPlatform\Doctrine\Orm\Filter\SearchFilter; |
|
|
|
|
|
|
10
|
|
|
use ApiPlatform\Metadata\ApiFilter; |
|
|
|
|
|
|
11
|
|
|
use ApiPlatform\Metadata\ApiResource; |
|
|
|
|
|
|
12
|
|
|
use ApiPlatform\Metadata\Get; |
|
|
|
|
|
|
13
|
|
|
use ApiPlatform\Metadata\GetCollection; |
|
|
|
|
|
|
14
|
|
|
use ApiPlatform\Metadata\Post; |
|
|
|
|
|
|
15
|
|
|
use ApiPlatform\Metadata\Put; |
|
|
|
|
|
|
16
|
|
|
use ControleOnline\Controller\AddProductsOrderAction; |
|
17
|
|
|
use ControleOnline\Controller\CreateNFeAction; |
|
|
|
|
|
|
18
|
|
|
use ControleOnline\Controller\DiscoveryCart; |
|
19
|
|
|
use ControleOnline\Controller\PrintOrderAction; |
|
20
|
|
|
use ControleOnline\Listener\LogListener; |
|
21
|
|
|
use ControleOnline\Repository\OrderRepository; |
|
22
|
|
|
use DateTime; |
|
23
|
|
|
use DateTimeInterface; |
|
24
|
|
|
use Doctrine\Common\Collections\ArrayCollection; |
|
|
|
|
|
|
25
|
|
|
use Doctrine\Common\Collections\Collection; |
|
|
|
|
|
|
26
|
|
|
use Doctrine\ORM\Mapping as ORM; |
|
|
|
|
|
|
27
|
|
|
use stdClass; |
|
28
|
|
|
|
|
29
|
|
|
#[ApiResource( |
|
30
|
|
|
operations: [ |
|
31
|
|
|
new Get( |
|
32
|
|
|
security: 'is_granted(\'ROLE_CLIENT\')', |
|
33
|
|
|
), |
|
34
|
|
|
new GetCollection( |
|
35
|
|
|
security: 'is_granted(\'PUBLIC_ACCESS\')', |
|
36
|
|
|
uriTemplate: '/cart', |
|
37
|
|
|
controller: DiscoveryCart::class |
|
38
|
|
|
), |
|
39
|
|
|
new GetCollection( |
|
40
|
|
|
security: 'is_granted(\'ROLE_ADMIN\') or is_granted(\'ROLE_CLIENT\')', |
|
41
|
|
|
normalizationContext: ['groups' => ['order:read']], |
|
42
|
|
|
), |
|
43
|
|
|
new Post( |
|
44
|
|
|
security: 'is_granted(\'ROLE_ADMIN\') or is_granted(\'ROLE_CLIENT\')', |
|
45
|
|
|
validationContext: ['groups' => ['order:write']], |
|
46
|
|
|
denormalizationContext: ['groups' => ['order:write']] |
|
47
|
|
|
), |
|
48
|
|
|
new Put( |
|
49
|
|
|
security: 'is_granted(\'ROLE_ADMIN\') or (is_granted(\'ROLE_CLIENT\'))', |
|
50
|
|
|
validationContext: ['groups' => ['order:write']], |
|
51
|
|
|
denormalizationContext: ['groups' => ['order:write']] |
|
52
|
|
|
), |
|
53
|
|
|
new Post( |
|
54
|
|
|
security: 'is_granted(\'ROLE_CLIENT\')', |
|
55
|
|
|
uriTemplate: '/orders/{id}/nfe', |
|
56
|
|
|
controller: CreateNFeAction::class |
|
57
|
|
|
), |
|
58
|
|
|
new Post( |
|
59
|
|
|
security: 'is_granted(\'ROLE_CLIENT\')', |
|
60
|
|
|
uriTemplate: '/orders/{id}/print', |
|
61
|
|
|
controller: PrintOrderAction::class, |
|
62
|
|
|
denormalizationContext: ['groups' => ['print:write']], |
|
63
|
|
|
normalizationContext: ['groups' => ['print:read']], |
|
64
|
|
|
), |
|
65
|
|
|
new Put( |
|
66
|
|
|
security: 'is_granted(\'ROLE_CLIENT\')', |
|
67
|
|
|
uriTemplate: '/orders/{id}/add-products', |
|
68
|
|
|
controller: AddProductsOrderAction::class, |
|
69
|
|
|
denormalizationContext: ['groups' => ['order:write']], |
|
70
|
|
|
normalizationContext: ['groups' => ['order_details:read']], |
|
71
|
|
|
), |
|
72
|
|
|
|
|
73
|
|
|
], |
|
74
|
|
|
formats: ['jsonld', 'json', 'html', 'jsonhal', 'csv' => ['text/csv']], |
|
75
|
|
|
normalizationContext: ['groups' => ['order_details:read']], |
|
76
|
|
|
denormalizationContext: ['groups' => ['order:write']] |
|
77
|
|
|
)] |
|
78
|
|
|
#[ApiFilter(OrderFilter::class, properties: ['alterDate', 'id'])] |
|
79
|
|
|
#[ORM\Table(name: 'orders')] |
|
80
|
|
|
#[ORM\Index(name: 'adress_destination_id', columns: ['address_destination_id'])] |
|
81
|
|
|
#[ORM\Index(name: 'notified', columns: ['notified'])] |
|
82
|
|
|
#[ORM\Index(name: 'delivery_contact_id', columns: ['delivery_contact_id'])] |
|
83
|
|
|
#[ORM\Index(name: 'delivery_people_id', columns: ['delivery_people_id'])] |
|
84
|
|
|
#[ORM\Index(name: 'status_id', columns: ['status_id'])] |
|
85
|
|
|
#[ORM\Index(name: 'order_date', columns: ['order_date'])] |
|
86
|
|
|
#[ORM\Index(name: 'provider_id', columns: ['provider_id'])] |
|
87
|
|
|
#[ORM\Index(name: 'quote_id', columns: ['quote_id', 'provider_id'])] |
|
88
|
|
|
#[ORM\Index(name: 'adress_origin_id', columns: ['address_origin_id'])] |
|
89
|
|
|
#[ORM\Index(name: 'retrieve_contact_id', columns: ['retrieve_contact_id'])] |
|
90
|
|
|
#[ORM\Index(name: 'main_order_id', columns: ['main_order_id'])] |
|
91
|
|
|
#[ORM\Index(name: 'retrieve_people_id', columns: ['retrieve_people_id'])] |
|
92
|
|
|
#[ORM\Index(name: 'payer_people_id', columns: ['payer_people_id'])] |
|
93
|
|
|
#[ORM\Index(name: 'client_id', columns: ['client_id'])] |
|
94
|
|
|
#[ORM\Index(name: 'alter_date', columns: ['alter_date'])] |
|
95
|
|
|
#[ORM\Index(name: 'IDX_E52FFDEEDB805178', columns: ['quote_id'])] |
|
96
|
|
|
#[ORM\UniqueConstraint(name: 'discount_id', columns: ['discount_coupon_id'])] |
|
97
|
|
|
#[ORM\EntityListeners([LogListener::class])] |
|
98
|
|
|
#[ORM\Entity(repositoryClass: OrderRepository::class)] |
|
99
|
|
|
class Order |
|
100
|
|
|
{ |
|
101
|
|
|
#[ApiFilter(filterClass: SearchFilter::class, properties: ['id' => 'exact'])] |
|
102
|
|
|
#[ORM\Column(name: 'id', type: 'integer', nullable: false)] |
|
103
|
|
|
#[ORM\Id] |
|
104
|
|
|
#[ORM\GeneratedValue(strategy: 'IDENTITY')] |
|
105
|
|
|
#[Groups(['order_product_queue:read', 'order:read', 'order_details:read', 'order:write', 'company_expense:read', 'coupon:read', 'logistic:read', 'order_invoice:read'])] |
|
106
|
|
|
private $id; |
|
107
|
|
|
|
|
108
|
|
|
#[ApiFilter(filterClass: SearchFilter::class, properties: ['client' => 'exact'])] |
|
109
|
|
|
#[ORM\JoinColumn(name: 'client_id', referencedColumnName: 'id')] |
|
110
|
|
|
#[ORM\ManyToOne(targetEntity: People::class)] |
|
111
|
|
|
#[Groups(['order_product_queue:read', 'order:read', 'order_details:read', 'order:write', 'invoice:read'])] |
|
112
|
|
|
private $client; |
|
113
|
|
|
|
|
114
|
|
|
#[ApiFilter(DateFilter::class, properties: ['orderDate'])] |
|
115
|
|
|
#[ORM\Column(name: 'order_date', type: 'datetime', nullable: false, columnDefinition: 'DATETIME')] |
|
116
|
|
|
#[Groups(['order_product_queue:read', 'order:read', 'order_details:read', 'order:write', 'order:write'])] |
|
117
|
|
|
private $orderDate; |
|
118
|
|
|
|
|
119
|
|
|
#[ORM\OneToMany(targetEntity: OrderProduct::class, mappedBy: 'order', cascade: ['persist'])] |
|
120
|
|
|
#[Groups(['order_details:read', 'order:write', 'order:write'])] |
|
121
|
|
|
private $orderProducts; |
|
122
|
|
|
|
|
123
|
|
|
#[ApiFilter(filterClass: SearchFilter::class, properties: ['invoice' => 'exact'])] |
|
124
|
|
|
#[ORM\OneToMany(targetEntity: OrderInvoice::class, mappedBy: 'order')] |
|
125
|
|
|
private $invoice; |
|
126
|
|
|
|
|
127
|
|
|
#[ApiFilter(filterClass: SearchFilter::class, properties: ['task' => 'exact'])] |
|
128
|
|
|
#[ORM\OneToMany(targetEntity: Task::class, mappedBy: 'order')] |
|
129
|
|
|
private $task; |
|
130
|
|
|
|
|
131
|
|
|
#[ApiFilter(filterClass: SearchFilter::class, properties: ['invoiceTax' => 'exact'])] |
|
132
|
|
|
#[ORM\OneToMany(targetEntity: OrderInvoiceTax::class, mappedBy: 'order')] |
|
133
|
|
|
private $invoiceTax; |
|
134
|
|
|
|
|
135
|
|
|
#[ApiFilter(DateFilter::class, properties: ['alterDate'])] |
|
136
|
|
|
#[ORM\Column(name: 'alter_date', type: 'datetime', nullable: false)] |
|
137
|
|
|
#[Groups(['display:read', 'order_product_queue:read', 'order:read', 'order_details:read', 'order:write', 'order:write'])] |
|
138
|
|
|
private $alterDate; |
|
139
|
|
|
|
|
140
|
|
|
#[ApiFilter(filterClass: SearchFilter::class, properties: ['status' => 'exact'])] |
|
141
|
|
|
#[ORM\JoinColumn(name: 'status_id', referencedColumnName: 'id')] |
|
142
|
|
|
#[ORM\ManyToOne(targetEntity: Status::class)] |
|
143
|
|
|
#[Groups(['order_product_queue:read', 'display:read', 'order:read', 'order_details:read', 'order:write', 'order:write'])] |
|
144
|
|
|
private $status; |
|
145
|
|
|
|
|
146
|
|
|
#[ApiFilter(filterClass: SearchFilter::class, properties: ['orderType' => 'exact'])] |
|
147
|
|
|
#[ORM\Column(name: 'order_type', type: 'string', nullable: true)] |
|
148
|
|
|
#[Groups(['order_product_queue:read', 'display:read', 'order:read', 'order_details:read', 'order:write', 'order:write'])] |
|
149
|
|
|
private $orderType; |
|
150
|
|
|
|
|
151
|
|
|
#[ApiFilter(filterClass: SearchFilter::class, properties: ['app' => 'exact'])] |
|
152
|
|
|
#[ORM\Column(name: 'app', type: 'string', nullable: true)] |
|
153
|
|
|
#[Groups(['order_product_queue:read', 'display:read', 'order:read', 'order_details:read', 'order:write', 'order:write'])] |
|
154
|
|
|
private $app = 'Manual'; |
|
155
|
|
|
|
|
156
|
|
|
#[ApiFilter(filterClass: SearchFilter::class, properties: ['otherInformations' => 'exact'])] |
|
157
|
|
|
#[ORM\Column(name: 'other_informations', type: 'json', nullable: true)] |
|
158
|
|
|
#[Groups(['order_product_queue:read', 'order:read', 'order_details:read', 'order:write', 'order:write'])] |
|
159
|
|
|
private $otherInformations; |
|
160
|
|
|
|
|
161
|
|
|
#[ApiFilter(filterClass: SearchFilter::class, properties: ['mainOrder' => 'exact'])] |
|
162
|
|
|
#[ORM\JoinColumn(name: 'main_order_id', referencedColumnName: 'id')] |
|
163
|
|
|
#[ORM\ManyToOne(targetEntity: self::class)] |
|
164
|
|
|
private $mainOrder; |
|
165
|
|
|
|
|
166
|
|
|
#[ApiFilter(filterClass: SearchFilter::class, properties: ['mainOrderId' => 'exact'])] |
|
167
|
|
|
#[ORM\Column(name: 'main_order_id', type: 'integer', nullable: true)] |
|
168
|
|
|
#[Groups(['order_product_queue:read', 'order:read', 'order_details:read', 'order:write', 'order:write'])] |
|
169
|
|
|
private $mainOrderId; |
|
170
|
|
|
|
|
171
|
|
|
#[ApiFilter(filterClass: SearchFilter::class, properties: ['payer' => 'exact'])] |
|
172
|
|
|
#[ORM\JoinColumn(name: 'payer_people_id', referencedColumnName: 'id')] |
|
173
|
|
|
#[ORM\ManyToOne(targetEntity: People::class)] |
|
174
|
|
|
#[Groups(['order_product_queue:read', 'order:read', 'order_details:read', 'order:write', 'invoice:read'])] |
|
175
|
|
|
private $payer; |
|
176
|
|
|
|
|
177
|
|
|
#[ApiFilter(filterClass: SearchFilter::class, properties: ['provider' => 'exact'])] |
|
178
|
|
|
#[ORM\JoinColumn(name: 'provider_id', referencedColumnName: 'id')] |
|
179
|
|
|
#[ORM\ManyToOne(targetEntity: People::class)] |
|
180
|
|
|
#[Groups(['order_product_queue:read', 'order:read', 'order_details:read', 'order:write', 'invoice:read'])] |
|
181
|
|
|
private $provider; |
|
182
|
|
|
|
|
183
|
|
|
#[ApiFilter(filterClass: SearchFilter::class, properties: ['addressOrigin' => 'exact'])] |
|
184
|
|
|
#[ORM\JoinColumn(name: 'address_origin_id', referencedColumnName: 'id')] |
|
185
|
|
|
#[ORM\ManyToOne(targetEntity: Address::class)] |
|
186
|
|
|
#[Groups(['order_details:read', 'order:write', 'order:write'])] |
|
187
|
|
|
private $addressOrigin; |
|
188
|
|
|
|
|
189
|
|
|
#[ApiFilter(filterClass: SearchFilter::class, properties: ['addressDestination' => 'exact'])] |
|
190
|
|
|
#[ORM\JoinColumn(name: 'address_destination_id', referencedColumnName: 'id')] |
|
191
|
|
|
#[ORM\ManyToOne(targetEntity: Address::class)] |
|
192
|
|
|
#[Groups(['order_details:read', 'order:write', 'order:write'])] |
|
193
|
|
|
private $addressDestination; |
|
194
|
|
|
|
|
195
|
|
|
#[ApiFilter(filterClass: SearchFilter::class, properties: ['retrieveContact' => 'exact'])] |
|
196
|
|
|
#[ORM\JoinColumn(name: 'retrieve_contact_id', referencedColumnName: 'id')] |
|
197
|
|
|
#[ORM\ManyToOne(targetEntity: People::class)] |
|
198
|
|
|
private $retrieveContact; |
|
199
|
|
|
|
|
200
|
|
|
#[ApiFilter(filterClass: SearchFilter::class, properties: ['deliveryContact' => 'exact'])] |
|
201
|
|
|
#[ORM\JoinColumn(name: 'delivery_contact_id', referencedColumnName: 'id')] |
|
202
|
|
|
#[ORM\ManyToOne(targetEntity: People::class)] |
|
203
|
|
|
private $deliveryContact; |
|
204
|
|
|
|
|
205
|
|
|
#[ApiFilter(filterClass: SearchFilter::class, properties: ['price' => 'exact'])] |
|
206
|
|
|
#[ORM\Column(name: 'price', type: 'float', nullable: false)] |
|
207
|
|
|
#[Groups(['order_product_queue:read', 'order:read', 'order_details:read', 'order:write', 'order:write'])] |
|
208
|
|
|
private $price = 0; |
|
209
|
|
|
|
|
210
|
|
|
#[ApiFilter(filterClass: SearchFilter::class, properties: ['comments' => 'exact'])] |
|
211
|
|
|
#[ORM\Column(name: 'comments', type: 'string', nullable: true)] |
|
212
|
|
|
#[Groups(['order_product_queue:read', 'order:read', 'order_details:read', 'order:write', 'order:write'])] |
|
213
|
|
|
private $comments; |
|
214
|
|
|
|
|
215
|
|
|
#[ApiFilter(filterClass: SearchFilter::class, properties: ['notified' => 'exact'])] |
|
216
|
|
|
#[ORM\Column(name: 'notified', type: 'boolean')] |
|
217
|
|
|
private $notified = false; |
|
218
|
|
|
|
|
219
|
|
|
#[ApiFilter(filterClass: SearchFilter::class, properties: ['user' => 'exact'])] |
|
220
|
|
|
#[ORM\JoinColumn(nullable: true)] |
|
221
|
|
|
#[ORM\ManyToOne(targetEntity: User::class)] |
|
222
|
|
|
#[Groups(['order_product_queue:read', 'display:read', 'order:read', 'order_details:read', 'order:write', 'order:write'])] |
|
223
|
|
|
private $user; |
|
224
|
|
|
|
|
225
|
|
|
#[ApiFilter(filterClass: SearchFilter::class, properties: ['device' => 'exact', 'device.device' => 'exact'])] |
|
226
|
|
|
#[ORM\JoinColumn(name: 'device_id', referencedColumnName: 'id', nullable: true)] |
|
227
|
|
|
#[ORM\ManyToOne(targetEntity: Device::class)] |
|
228
|
|
|
#[Groups(['device_config:read', 'device:read', 'device_config:write'])] |
|
229
|
|
|
private $device; |
|
230
|
|
|
|
|
231
|
|
|
public function __construct() |
|
232
|
|
|
{ |
|
233
|
|
|
$this->orderDate = new DateTime('now'); |
|
234
|
|
|
$this->alterDate = new DateTime('now'); |
|
235
|
|
|
$this->invoiceTax = new ArrayCollection(); |
|
236
|
|
|
$this->invoice = new ArrayCollection(); |
|
237
|
|
|
$this->task = new ArrayCollection(); |
|
238
|
|
|
$this->orderProducts = new ArrayCollection(); |
|
239
|
|
|
$this->otherInformations = json_encode(new stdClass()); |
|
240
|
|
|
} |
|
241
|
|
|
|
|
242
|
|
|
public function resetId() |
|
243
|
|
|
{ |
|
244
|
|
|
$this->id = null; |
|
245
|
|
|
$this->orderDate = new DateTime('now'); |
|
246
|
|
|
$this->alterDate = new DateTime('now'); |
|
247
|
|
|
} |
|
248
|
|
|
|
|
249
|
|
|
public function getId() |
|
250
|
|
|
{ |
|
251
|
|
|
return $this->id; |
|
252
|
|
|
} |
|
253
|
|
|
|
|
254
|
|
|
public function setStatus(Status $status = null) |
|
255
|
|
|
{ |
|
256
|
|
|
$this->status = $status; |
|
257
|
|
|
return $this; |
|
258
|
|
|
} |
|
259
|
|
|
|
|
260
|
|
|
public function getStatus() |
|
261
|
|
|
{ |
|
262
|
|
|
return $this->status; |
|
263
|
|
|
} |
|
264
|
|
|
|
|
265
|
|
|
public function setClient(People $client = null) |
|
|
|
|
|
|
266
|
|
|
{ |
|
267
|
|
|
$this->client = $client; |
|
268
|
|
|
return $this; |
|
269
|
|
|
} |
|
270
|
|
|
|
|
271
|
|
|
public function getClient() |
|
272
|
|
|
{ |
|
273
|
|
|
return $this->client; |
|
274
|
|
|
} |
|
275
|
|
|
|
|
276
|
|
|
public function setProvider(People $provider = null) |
|
277
|
|
|
{ |
|
278
|
|
|
$this->provider = $provider; |
|
279
|
|
|
return $this; |
|
280
|
|
|
} |
|
281
|
|
|
|
|
282
|
|
|
public function getProvider() |
|
283
|
|
|
{ |
|
284
|
|
|
return $this->provider; |
|
285
|
|
|
} |
|
286
|
|
|
|
|
287
|
|
|
public function setPrice($price) |
|
288
|
|
|
{ |
|
289
|
|
|
$this->price = $price; |
|
290
|
|
|
return $this; |
|
291
|
|
|
} |
|
292
|
|
|
|
|
293
|
|
|
public function getPrice() |
|
294
|
|
|
{ |
|
295
|
|
|
return $this->price; |
|
296
|
|
|
} |
|
297
|
|
|
|
|
298
|
|
|
public function setAddressOrigin(Address $address_origin = null) |
|
|
|
|
|
|
299
|
|
|
{ |
|
300
|
|
|
$this->addressOrigin = $address_origin; |
|
301
|
|
|
return $this; |
|
302
|
|
|
} |
|
303
|
|
|
|
|
304
|
|
|
public function getAddressOrigin() |
|
305
|
|
|
{ |
|
306
|
|
|
return $this->addressOrigin; |
|
307
|
|
|
} |
|
308
|
|
|
|
|
309
|
|
|
public function setAddressDestination(Address $address_destination = null) |
|
310
|
|
|
{ |
|
311
|
|
|
$this->addressDestination = $address_destination; |
|
312
|
|
|
return $this; |
|
313
|
|
|
} |
|
314
|
|
|
|
|
315
|
|
|
public function getAddressDestination() |
|
316
|
|
|
{ |
|
317
|
|
|
return $this->addressDestination; |
|
318
|
|
|
} |
|
319
|
|
|
|
|
320
|
|
|
public function getRetrieveContact() |
|
321
|
|
|
{ |
|
322
|
|
|
return $this->retrieveContact; |
|
323
|
|
|
} |
|
324
|
|
|
|
|
325
|
|
|
public function setRetrieveContact(People $retrieve_contact = null) |
|
326
|
|
|
{ |
|
327
|
|
|
$this->retrieveContact = $retrieve_contact; |
|
328
|
|
|
return $this; |
|
329
|
|
|
} |
|
330
|
|
|
|
|
331
|
|
|
public function getDeliveryContact() |
|
332
|
|
|
{ |
|
333
|
|
|
return $this->deliveryContact; |
|
334
|
|
|
} |
|
335
|
|
|
|
|
336
|
|
|
public function setDeliveryContact(People $delivery_contact = null) |
|
337
|
|
|
{ |
|
338
|
|
|
$this->deliveryContact = $delivery_contact; |
|
339
|
|
|
return $this; |
|
340
|
|
|
} |
|
341
|
|
|
|
|
342
|
|
|
public function setPayer(People $payer = null) |
|
343
|
|
|
{ |
|
344
|
|
|
$this->payer = $payer; |
|
345
|
|
|
return $this; |
|
346
|
|
|
} |
|
347
|
|
|
|
|
348
|
|
|
public function getPayer() |
|
349
|
|
|
{ |
|
350
|
|
|
return $this->payer; |
|
351
|
|
|
} |
|
352
|
|
|
|
|
353
|
|
|
public function setComments($comments) |
|
354
|
|
|
{ |
|
355
|
|
|
$this->comments = $comments; |
|
356
|
|
|
return $this; |
|
357
|
|
|
} |
|
358
|
|
|
|
|
359
|
|
|
public function getComments() |
|
360
|
|
|
{ |
|
361
|
|
|
return $this->comments; |
|
362
|
|
|
} |
|
363
|
|
|
|
|
364
|
|
|
public function getOtherInformations($decode = false) |
|
365
|
|
|
{ |
|
366
|
|
|
return $decode ? (object) json_decode((is_array($this->otherInformations) ? json_encode($this->otherInformations) : $this->otherInformations)) : $this->otherInformations; |
|
|
|
|
|
|
367
|
|
|
} |
|
368
|
|
|
|
|
369
|
|
|
public function addOtherInformations($key, $value) |
|
370
|
|
|
{ |
|
371
|
|
|
$otherInformations = $this->getOtherInformations(true); |
|
372
|
|
|
$otherInformations->$key = $value; |
|
373
|
|
|
$this->otherInformations = json_encode($otherInformations); |
|
374
|
|
|
return $this; |
|
375
|
|
|
} |
|
376
|
|
|
|
|
377
|
|
|
public function setOtherInformations($otherInformations) |
|
378
|
|
|
{ |
|
379
|
|
|
$this->otherInformations = json_encode($otherInformations); |
|
380
|
|
|
return $this; |
|
381
|
|
|
} |
|
382
|
|
|
|
|
383
|
|
|
public function getOrderDate() |
|
384
|
|
|
{ |
|
385
|
|
|
return $this->orderDate; |
|
386
|
|
|
} |
|
387
|
|
|
|
|
388
|
|
|
public function setAlterDate(DateTimeInterface $alter_date = null): self |
|
389
|
|
|
{ |
|
390
|
|
|
$this->alterDate = $alter_date; |
|
391
|
|
|
return $this; |
|
392
|
|
|
} |
|
393
|
|
|
|
|
394
|
|
|
public function getAlterDate(): ?DateTimeInterface |
|
395
|
|
|
{ |
|
396
|
|
|
return $this->alterDate; |
|
397
|
|
|
} |
|
398
|
|
|
|
|
399
|
|
|
public function addAInvoiceTax(OrderInvoiceTax $invoice_tax) |
|
|
|
|
|
|
400
|
|
|
{ |
|
401
|
|
|
$this->invoiceTax[] = $invoice_tax; |
|
402
|
|
|
return $this; |
|
403
|
|
|
} |
|
404
|
|
|
|
|
405
|
|
|
public function removeInvoiceTax(OrderInvoiceTax $invoice_tax) |
|
406
|
|
|
{ |
|
407
|
|
|
$this->invoiceTax->removeElement($invoice_tax); |
|
408
|
|
|
} |
|
409
|
|
|
|
|
410
|
|
|
public function getInvoiceTax() |
|
411
|
|
|
{ |
|
412
|
|
|
return $this->invoiceTax; |
|
413
|
|
|
} |
|
414
|
|
|
|
|
415
|
|
|
public function getClientInvoiceTax() |
|
416
|
|
|
{ |
|
417
|
|
|
foreach ($this->getInvoiceTax() as $invoice) { |
|
418
|
|
|
if ($invoice->getInvoiceType() == 55) { |
|
419
|
|
|
return $invoice; |
|
420
|
|
|
} |
|
421
|
|
|
} |
|
422
|
|
|
} |
|
423
|
|
|
|
|
424
|
|
|
public function getCarrierInvoiceTax() |
|
425
|
|
|
{ |
|
426
|
|
|
foreach ($this->getInvoiceTax() as $invoice) { |
|
427
|
|
|
if ($invoice->getInvoiceType() == 57) { |
|
428
|
|
|
return $invoice->getInvoiceTax(); |
|
429
|
|
|
} |
|
430
|
|
|
} |
|
431
|
|
|
} |
|
432
|
|
|
|
|
433
|
|
|
public function addInvoice(OrderInvoice $invoice) |
|
434
|
|
|
{ |
|
435
|
|
|
$this->invoice[] = $invoice; |
|
436
|
|
|
return $this; |
|
437
|
|
|
} |
|
438
|
|
|
|
|
439
|
|
|
public function removeInvoice(OrderInvoice $invoice) |
|
440
|
|
|
{ |
|
441
|
|
|
$this->invoice->removeElement($invoice); |
|
442
|
|
|
} |
|
443
|
|
|
|
|
444
|
|
|
public function getInvoice() |
|
445
|
|
|
{ |
|
446
|
|
|
return $this->invoice; |
|
447
|
|
|
} |
|
448
|
|
|
|
|
449
|
|
|
public function getNotified() |
|
450
|
|
|
{ |
|
451
|
|
|
return $this->notified; |
|
452
|
|
|
} |
|
453
|
|
|
|
|
454
|
|
|
public function setNotified($notified) |
|
455
|
|
|
{ |
|
456
|
|
|
$this->notified = $notified ? 1 : 0; |
|
457
|
|
|
return $this; |
|
458
|
|
|
} |
|
459
|
|
|
|
|
460
|
|
|
public function setOrderType($order_type) |
|
461
|
|
|
{ |
|
462
|
|
|
$this->orderType = $order_type; |
|
463
|
|
|
return $this; |
|
464
|
|
|
} |
|
465
|
|
|
|
|
466
|
|
|
public function getOrderType() |
|
467
|
|
|
{ |
|
468
|
|
|
return $this->orderType; |
|
469
|
|
|
} |
|
470
|
|
|
|
|
471
|
|
|
public function setApp($app) |
|
472
|
|
|
{ |
|
473
|
|
|
$this->app = $app; |
|
474
|
|
|
return $this; |
|
475
|
|
|
} |
|
476
|
|
|
|
|
477
|
|
|
public function getApp() |
|
478
|
|
|
{ |
|
479
|
|
|
return $this->app; |
|
480
|
|
|
} |
|
481
|
|
|
|
|
482
|
|
|
public function setMainOrder(self $main_order) |
|
483
|
|
|
{ |
|
484
|
|
|
$this->mainOrder = $main_order; |
|
485
|
|
|
return $this; |
|
486
|
|
|
} |
|
487
|
|
|
|
|
488
|
|
|
public function getMainOrder() |
|
489
|
|
|
{ |
|
490
|
|
|
return $this->mainOrder; |
|
491
|
|
|
} |
|
492
|
|
|
|
|
493
|
|
|
public function setMainOrderId($mainOrderId) |
|
494
|
|
|
{ |
|
495
|
|
|
$this->mainOrderId = $mainOrderId; |
|
496
|
|
|
return $this; |
|
497
|
|
|
} |
|
498
|
|
|
|
|
499
|
|
|
public function getMainOrderId() |
|
500
|
|
|
{ |
|
501
|
|
|
return $this->mainOrderId; |
|
502
|
|
|
} |
|
503
|
|
|
|
|
504
|
|
|
public function getInvoiceByStatus(array $status) |
|
505
|
|
|
{ |
|
506
|
|
|
foreach ($this->getInvoice() as $purchasingOrderInvoice) { |
|
507
|
|
|
$invoice = $purchasingOrderInvoice->getInvoice(); |
|
508
|
|
|
if (in_array($invoice->getStatus()->getStatus(), $status)) { |
|
509
|
|
|
return $invoice; |
|
510
|
|
|
} |
|
511
|
|
|
} |
|
512
|
|
|
} |
|
513
|
|
|
|
|
514
|
|
|
public function canAccess($currentUser): bool |
|
515
|
|
|
{ |
|
516
|
|
|
if (($provider = $this->getProvider()) === null) { |
|
517
|
|
|
return false; |
|
518
|
|
|
} |
|
519
|
|
|
|
|
520
|
|
|
return $currentUser->getPeople()->getLink()->exists( |
|
521
|
|
|
fn($key, $element) => $element->getCompany() === $provider |
|
522
|
|
|
); |
|
523
|
|
|
} |
|
524
|
|
|
|
|
525
|
|
|
public function justOpened(): bool |
|
526
|
|
|
{ |
|
527
|
|
|
return $this->getStatus()->getStatus() == 'quote'; |
|
528
|
|
|
} |
|
529
|
|
|
|
|
530
|
|
|
public function getOneInvoice() |
|
531
|
|
|
{ |
|
532
|
|
|
return (($invoiceOrders = $this->getInvoice()->first()) === false) ? |
|
533
|
|
|
null : $invoiceOrders->getInvoice(); |
|
534
|
|
|
} |
|
535
|
|
|
|
|
536
|
|
|
public function addTask(Task $task) |
|
|
|
|
|
|
537
|
|
|
{ |
|
538
|
|
|
$this->task[] = $task; |
|
539
|
|
|
return $this; |
|
540
|
|
|
} |
|
541
|
|
|
|
|
542
|
|
|
public function removeTask(Task $task) |
|
543
|
|
|
{ |
|
544
|
|
|
$this->task->removeElement($task); |
|
545
|
|
|
} |
|
546
|
|
|
|
|
547
|
|
|
public function getTask() |
|
548
|
|
|
{ |
|
549
|
|
|
return $this->task; |
|
550
|
|
|
} |
|
551
|
|
|
|
|
552
|
|
|
public function isOriginAndDestinationTheSame(): ?bool |
|
553
|
|
|
{ |
|
554
|
|
|
if (($origin = $this->getAddressOrigin()) === null) { |
|
555
|
|
|
return null; |
|
556
|
|
|
} |
|
557
|
|
|
|
|
558
|
|
|
if (($destination = $this->getAddressDestination()) === null) { |
|
559
|
|
|
return null; |
|
560
|
|
|
} |
|
561
|
|
|
|
|
562
|
|
|
$origCity = $origin->getStreet()->getDistrict()->getCity(); |
|
563
|
|
|
$destCity = $destination->getStreet()->getDistrict()->getCity(); |
|
564
|
|
|
|
|
565
|
|
|
if ($origCity === $destCity) { |
|
566
|
|
|
return true; |
|
567
|
|
|
} |
|
568
|
|
|
|
|
569
|
|
|
return false; |
|
570
|
|
|
} |
|
571
|
|
|
|
|
572
|
|
|
public function isOriginAndDestinationTheSameState(): ?bool |
|
573
|
|
|
{ |
|
574
|
|
|
if (($origin = $this->getAddressOrigin()) === null) { |
|
575
|
|
|
return null; |
|
576
|
|
|
} |
|
577
|
|
|
|
|
578
|
|
|
if (($destination = $this->getAddressDestination()) === null) { |
|
579
|
|
|
return null; |
|
580
|
|
|
} |
|
581
|
|
|
|
|
582
|
|
|
$origState = $origin->getStreet()->getDistrict()->getCity()->getState(); |
|
583
|
|
|
$destState = $destination->getStreet()->getDistrict()->getCity()->getState(); |
|
584
|
|
|
|
|
585
|
|
|
if ($origState === $destState) { |
|
586
|
|
|
return true; |
|
587
|
|
|
} |
|
588
|
|
|
|
|
589
|
|
|
return false; |
|
590
|
|
|
} |
|
591
|
|
|
|
|
592
|
|
|
public function getOrderProducts() |
|
593
|
|
|
{ |
|
594
|
|
|
return $this->orderProducts; |
|
595
|
|
|
} |
|
596
|
|
|
|
|
597
|
|
|
public function addOrderProduct(OrderProduct $orderProduct): self |
|
598
|
|
|
{ |
|
599
|
|
|
$this->orderProducts[] = $orderProduct; |
|
600
|
|
|
return $this; |
|
601
|
|
|
} |
|
602
|
|
|
|
|
603
|
|
|
public function removeOrderProduct(OrderProduct $orderProduct): self |
|
604
|
|
|
{ |
|
605
|
|
|
$this->orderProducts->removeElement($orderProduct); |
|
606
|
|
|
return $this; |
|
607
|
|
|
} |
|
608
|
|
|
|
|
609
|
|
|
public function getUser() |
|
610
|
|
|
{ |
|
611
|
|
|
return $this->user; |
|
612
|
|
|
} |
|
613
|
|
|
|
|
614
|
|
|
public function setUser($user): self |
|
615
|
|
|
{ |
|
616
|
|
|
$this->user = $user; |
|
617
|
|
|
return $this; |
|
618
|
|
|
} |
|
619
|
|
|
|
|
620
|
|
|
public function getDevice() |
|
621
|
|
|
{ |
|
622
|
|
|
return $this->device; |
|
623
|
|
|
} |
|
624
|
|
|
|
|
625
|
|
|
public function setDevice($device): self |
|
626
|
|
|
{ |
|
627
|
|
|
$this->device = $device; |
|
628
|
|
|
return $this; |
|
629
|
|
|
} |
|
630
|
|
|
} |
|
631
|
|
|
|
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