1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
|
4
|
|
|
namespace Stockbase\Integration\Model\Inventory; |
5
|
|
|
|
6
|
|
|
use Magento\CatalogInventory\Api\Data\StockItemInterface; |
7
|
|
|
|
8
|
|
|
/** |
9
|
|
|
* Class CombinedStockbaseStockItem |
10
|
|
|
*/ |
11
|
|
|
class CombinedStockbaseStockItem implements StockItemInterface |
12
|
|
|
{ |
13
|
|
|
/** |
14
|
|
|
* @var StockItemInterface |
15
|
|
|
*/ |
16
|
|
|
private $magentoStockItem; |
17
|
|
|
|
18
|
|
|
/** |
19
|
|
|
* @var float |
20
|
|
|
*/ |
21
|
|
|
private $stockbaseQty; |
22
|
|
|
|
23
|
|
|
/** |
24
|
|
|
* CombinedStockbaseStockItem constructor. |
25
|
|
|
* @param StockItemInterface $magentoStockItem |
26
|
|
|
* @param float $stockbaseQty |
27
|
|
|
*/ |
28
|
60 |
|
public function __construct(StockItemInterface $magentoStockItem, $stockbaseQty) |
29
|
|
|
{ |
30
|
60 |
|
$this->magentoStockItem = $magentoStockItem; |
31
|
60 |
|
$this->stockbaseQty = $stockbaseQty; |
32
|
60 |
|
} |
33
|
|
|
|
34
|
|
|
/** |
35
|
|
|
* {@inheritdoc} |
36
|
|
|
*/ |
37
|
1 |
|
public function __call($name, $arguments) |
38
|
|
|
{ |
39
|
|
|
// @codingStandardsIgnoreStart |
40
|
1 |
|
return call_user_func_array([$this->magentoStockItem, $name], $arguments); |
41
|
|
|
// @codingStandardsIgnoreEnd |
42
|
|
|
} |
43
|
|
|
|
44
|
|
|
/** |
45
|
|
|
* {@inheritdoc} |
46
|
|
|
*/ |
47
|
5 |
|
public function getQty() |
48
|
|
|
{ |
49
|
5 |
|
return $this->magentoStockItem->getQty() + $this->stockbaseQty; |
50
|
|
|
} |
51
|
|
|
|
52
|
|
|
/** |
53
|
|
|
* {@inheritdoc} |
54
|
|
|
*/ |
55
|
1 |
|
public function setQty($qty) |
56
|
|
|
{ |
57
|
1 |
|
throw new \Exception('Can not set quantity on combined Stockbase stock item.'); |
58
|
|
|
} |
59
|
|
|
|
60
|
|
|
/** |
61
|
|
|
* {@inheritdoc} |
62
|
|
|
*/ |
63
|
1 |
|
public function getItemId() |
64
|
|
|
{ |
65
|
1 |
|
return $this->magentoStockItem->getItemId(); |
66
|
|
|
} |
67
|
|
|
|
68
|
|
|
/** |
69
|
|
|
* {@inheritdoc} |
70
|
|
|
*/ |
71
|
1 |
|
public function setItemId($itemId) |
72
|
|
|
{ |
73
|
1 |
|
$this->magentoStockItem->setItemId($itemId); |
74
|
|
|
|
75
|
1 |
|
return $this; |
76
|
|
|
} |
77
|
|
|
|
78
|
|
|
/** |
79
|
|
|
* {@inheritdoc} |
80
|
|
|
*/ |
81
|
1 |
|
public function getProductId() |
82
|
|
|
{ |
83
|
1 |
|
return $this->magentoStockItem->getProductId(); |
84
|
|
|
} |
85
|
|
|
|
86
|
|
|
/** |
87
|
|
|
* {@inheritdoc} |
88
|
|
|
*/ |
89
|
1 |
|
public function setProductId($productId) |
90
|
|
|
{ |
91
|
1 |
|
$this->magentoStockItem->setProductId($productId); |
92
|
|
|
|
93
|
1 |
|
return $this; |
94
|
|
|
} |
95
|
|
|
|
96
|
|
|
/** |
97
|
|
|
* {@inheritdoc} |
98
|
|
|
*/ |
99
|
1 |
|
public function getStockId() |
100
|
|
|
{ |
101
|
1 |
|
return $this->magentoStockItem->getStockId(); |
102
|
|
|
} |
103
|
|
|
|
104
|
|
|
/** |
105
|
|
|
* {@inheritdoc} |
106
|
|
|
*/ |
107
|
1 |
|
public function setStockId($stockId) |
108
|
|
|
{ |
109
|
1 |
|
$this->magentoStockItem->setStockId($stockId); |
110
|
|
|
|
111
|
1 |
|
return $this; |
112
|
|
|
} |
113
|
|
|
|
114
|
|
|
/** |
115
|
|
|
* {@inheritdoc} |
116
|
|
|
*/ |
117
|
1 |
|
public function getIsInStock() |
118
|
|
|
{ |
119
|
1 |
|
return $this->magentoStockItem->getIsInStock(); |
120
|
|
|
} |
121
|
|
|
|
122
|
|
|
/** |
123
|
|
|
* {@inheritdoc} |
124
|
|
|
*/ |
125
|
1 |
|
public function setIsInStock($isInStock) |
126
|
|
|
{ |
127
|
1 |
|
$this->magentoStockItem->setIsInStock($isInStock); |
128
|
|
|
|
129
|
1 |
|
return $this; |
130
|
|
|
} |
131
|
|
|
|
132
|
|
|
/** |
133
|
|
|
* {@inheritdoc} |
134
|
|
|
*/ |
135
|
2 |
|
public function getIsQtyDecimal() |
136
|
|
|
{ |
137
|
2 |
|
return $this->magentoStockItem->getIsQtyDecimal(); |
138
|
|
|
} |
139
|
|
|
|
140
|
|
|
/** |
141
|
|
|
* {@inheritdoc} |
142
|
|
|
*/ |
143
|
2 |
|
public function setIsQtyDecimal($isQtyDecimal) |
144
|
|
|
{ |
145
|
2 |
|
$this->magentoStockItem->setIsQtyDecimal($isQtyDecimal); |
146
|
|
|
|
147
|
2 |
|
return $this; |
148
|
|
|
} |
149
|
|
|
|
150
|
|
|
/** |
151
|
|
|
* {@inheritdoc} |
152
|
|
|
*/ |
153
|
1 |
|
public function getShowDefaultNotificationMessage() |
154
|
|
|
{ |
155
|
1 |
|
return $this->magentoStockItem->getShowDefaultNotificationMessage(); |
156
|
|
|
} |
157
|
|
|
|
158
|
|
|
/** |
159
|
|
|
* {@inheritdoc} |
160
|
|
|
*/ |
161
|
1 |
|
public function getUseConfigMinQty() |
162
|
|
|
{ |
163
|
1 |
|
return $this->magentoStockItem->getUseConfigMinQty(); |
164
|
|
|
} |
165
|
|
|
|
166
|
|
|
/** |
167
|
|
|
* {@inheritdoc} |
168
|
|
|
*/ |
169
|
1 |
|
public function setUseConfigMinQty($useConfigMinQty) |
170
|
|
|
{ |
171
|
1 |
|
$this->magentoStockItem->setUseConfigMinQty($useConfigMinQty); |
172
|
|
|
|
173
|
1 |
|
return $this; |
174
|
|
|
} |
175
|
|
|
|
176
|
|
|
/** |
177
|
|
|
* {@inheritdoc} |
178
|
|
|
*/ |
179
|
1 |
|
public function getMinQty() |
180
|
|
|
{ |
181
|
1 |
|
return $this->magentoStockItem->getMinQty(); |
182
|
|
|
} |
183
|
|
|
|
184
|
|
|
/** |
185
|
|
|
* {@inheritdoc} |
186
|
|
|
*/ |
187
|
1 |
|
public function setMinQty($minQty) |
188
|
|
|
{ |
189
|
1 |
|
$this->magentoStockItem->setMinQty($minQty); |
190
|
|
|
|
191
|
1 |
|
return $this; |
192
|
|
|
} |
193
|
|
|
|
194
|
|
|
/** |
195
|
|
|
* {@inheritdoc} |
196
|
|
|
*/ |
197
|
1 |
|
public function getUseConfigMinSaleQty() |
198
|
|
|
{ |
199
|
1 |
|
return $this->magentoStockItem->getUseConfigMinSaleQty(); |
200
|
|
|
} |
201
|
|
|
|
202
|
|
|
/** |
203
|
|
|
* {@inheritdoc} |
204
|
|
|
*/ |
205
|
1 |
|
public function setUseConfigMinSaleQty($useConfigMinSaleQty) |
206
|
|
|
{ |
207
|
1 |
|
$this->magentoStockItem->setUseConfigMinSaleQty($useConfigMinSaleQty); |
208
|
|
|
|
209
|
1 |
|
return $this; |
210
|
|
|
} |
211
|
|
|
|
212
|
|
|
/** |
213
|
|
|
* {@inheritdoc} |
214
|
|
|
*/ |
215
|
1 |
|
public function getMinSaleQty() |
216
|
|
|
{ |
217
|
1 |
|
return $this->magentoStockItem->getMinSaleQty(); |
218
|
|
|
} |
219
|
|
|
|
220
|
|
|
/** |
221
|
|
|
* {@inheritdoc} |
222
|
|
|
*/ |
223
|
1 |
|
public function setMinSaleQty($minSaleQty) |
224
|
|
|
{ |
225
|
1 |
|
$this->magentoStockItem->setMinSaleQty($minSaleQty); |
226
|
|
|
|
227
|
1 |
|
return $this; |
228
|
|
|
} |
229
|
|
|
|
230
|
|
|
/** |
231
|
|
|
* {@inheritdoc} |
232
|
|
|
*/ |
233
|
1 |
|
public function getUseConfigMaxSaleQty() |
234
|
|
|
{ |
235
|
1 |
|
return $this->magentoStockItem->getUseConfigMaxSaleQty(); |
236
|
|
|
} |
237
|
|
|
|
238
|
|
|
/** |
239
|
|
|
* {@inheritdoc} |
240
|
|
|
*/ |
241
|
1 |
|
public function setUseConfigMaxSaleQty($useConfigMaxSaleQty) |
242
|
|
|
{ |
243
|
1 |
|
$this->magentoStockItem->setUseConfigMaxSaleQty($useConfigMaxSaleQty); |
244
|
|
|
|
245
|
1 |
|
return $this; |
246
|
|
|
} |
247
|
|
|
|
248
|
|
|
/** |
249
|
|
|
* {@inheritdoc} |
250
|
|
|
*/ |
251
|
1 |
|
public function getMaxSaleQty() |
252
|
|
|
{ |
253
|
1 |
|
return $this->magentoStockItem->getMaxSaleQty(); |
254
|
|
|
} |
255
|
|
|
|
256
|
|
|
/** |
257
|
|
|
* {@inheritdoc} |
258
|
|
|
*/ |
259
|
1 |
|
public function setMaxSaleQty($maxSaleQty) |
260
|
|
|
{ |
261
|
1 |
|
$this->magentoStockItem->setMaxSaleQty($maxSaleQty); |
262
|
|
|
|
263
|
1 |
|
return $this; |
264
|
|
|
} |
265
|
|
|
|
266
|
|
|
/** |
267
|
|
|
* {@inheritdoc} |
268
|
|
|
*/ |
269
|
1 |
|
public function getUseConfigBackorders() |
270
|
|
|
{ |
271
|
1 |
|
return $this->magentoStockItem->getUseConfigBackorders(); |
272
|
|
|
} |
273
|
|
|
|
274
|
|
|
/** |
275
|
|
|
* {@inheritdoc} |
276
|
|
|
*/ |
277
|
1 |
|
public function setUseConfigBackorders($useConfigBackorders) |
278
|
|
|
{ |
279
|
1 |
|
$this->magentoStockItem->setUseConfigBackorders($useConfigBackorders); |
280
|
|
|
|
281
|
1 |
|
return $this; |
282
|
|
|
} |
283
|
|
|
|
284
|
|
|
/** |
285
|
|
|
* {@inheritdoc} |
286
|
|
|
*/ |
287
|
1 |
|
public function getBackorders() |
288
|
|
|
{ |
289
|
1 |
|
return $this->magentoStockItem->getBackorders(); |
290
|
|
|
} |
291
|
|
|
|
292
|
|
|
/** |
293
|
|
|
* {@inheritdoc} |
294
|
|
|
*/ |
295
|
1 |
|
public function setBackorders($backOrders) |
296
|
|
|
{ |
297
|
1 |
|
$this->magentoStockItem->setBackorders($backOrders); |
298
|
|
|
|
299
|
1 |
|
return $this; |
300
|
|
|
} |
301
|
|
|
|
302
|
|
|
/** |
303
|
|
|
* {@inheritdoc} |
304
|
|
|
*/ |
305
|
1 |
|
public function getUseConfigNotifyStockQty() |
306
|
|
|
{ |
307
|
1 |
|
return $this->magentoStockItem->getUseConfigNotifyStockQty(); |
308
|
|
|
} |
309
|
|
|
|
310
|
|
|
/** |
311
|
|
|
* {@inheritdoc} |
312
|
|
|
*/ |
313
|
1 |
|
public function setUseConfigNotifyStockQty($useConfigNotifyStockQty) |
314
|
|
|
{ |
315
|
1 |
|
$this->magentoStockItem->setUseConfigNotifyStockQty($useConfigNotifyStockQty); |
316
|
|
|
|
317
|
1 |
|
return $this; |
318
|
|
|
} |
319
|
|
|
|
320
|
|
|
/** |
321
|
|
|
* {@inheritdoc} |
322
|
|
|
*/ |
323
|
1 |
|
public function getNotifyStockQty() |
324
|
|
|
{ |
325
|
1 |
|
return $this->magentoStockItem->getNotifyStockQty(); |
326
|
|
|
} |
327
|
|
|
|
328
|
|
|
/** |
329
|
|
|
* {@inheritdoc} |
330
|
|
|
*/ |
331
|
1 |
|
public function setNotifyStockQty($notifyStockQty) |
332
|
|
|
{ |
333
|
1 |
|
$this->magentoStockItem->setNotifyStockQty($notifyStockQty); |
334
|
|
|
|
335
|
1 |
|
return $this; |
336
|
|
|
} |
337
|
|
|
|
338
|
|
|
/** |
339
|
|
|
* {@inheritdoc} |
340
|
|
|
*/ |
341
|
1 |
|
public function getUseConfigQtyIncrements() |
342
|
|
|
{ |
343
|
1 |
|
return $this->magentoStockItem->getUseConfigQtyIncrements(); |
344
|
|
|
} |
345
|
|
|
|
346
|
|
|
/** |
347
|
|
|
* {@inheritdoc} |
348
|
|
|
*/ |
349
|
1 |
|
public function setUseConfigQtyIncrements($useConfigQtyIncrements) |
350
|
|
|
{ |
351
|
1 |
|
$this->magentoStockItem->setUseConfigQtyIncrements($useConfigQtyIncrements); |
352
|
|
|
|
353
|
1 |
|
return $this; |
354
|
|
|
} |
355
|
|
|
|
356
|
|
|
/** |
357
|
|
|
* {@inheritdoc} |
358
|
|
|
*/ |
359
|
1 |
|
public function getQtyIncrements() |
360
|
|
|
{ |
361
|
1 |
|
return $this->magentoStockItem->getQtyIncrements(); |
362
|
|
|
} |
363
|
|
|
|
364
|
|
|
/** |
365
|
|
|
* {@inheritdoc} |
366
|
|
|
*/ |
367
|
1 |
|
public function setQtyIncrements($qtyIncrements) |
368
|
|
|
{ |
369
|
1 |
|
$this->magentoStockItem->setQtyIncrements($qtyIncrements); |
370
|
|
|
|
371
|
1 |
|
return $this; |
372
|
|
|
} |
373
|
|
|
|
374
|
|
|
/** |
375
|
|
|
* {@inheritdoc} |
376
|
|
|
*/ |
377
|
1 |
|
public function getUseConfigEnableQtyInc() |
378
|
|
|
{ |
379
|
1 |
|
return $this->magentoStockItem->getUseConfigEnableQtyInc(); |
380
|
|
|
} |
381
|
|
|
|
382
|
|
|
/** |
383
|
|
|
* {@inheritdoc} |
384
|
|
|
*/ |
385
|
1 |
|
public function setUseConfigEnableQtyInc($useConfigEnableQtyInc) |
386
|
|
|
{ |
387
|
1 |
|
$this->magentoStockItem->setUseConfigEnableQtyInc($useConfigEnableQtyInc); |
388
|
|
|
|
389
|
1 |
|
return $this; |
390
|
|
|
} |
391
|
|
|
|
392
|
|
|
/** |
393
|
|
|
* {@inheritdoc} |
394
|
|
|
*/ |
395
|
1 |
|
public function getEnableQtyIncrements() |
396
|
|
|
{ |
397
|
1 |
|
return $this->magentoStockItem->getEnableQtyIncrements(); |
398
|
|
|
} |
399
|
|
|
|
400
|
|
|
/** |
401
|
|
|
* {@inheritdoc} |
402
|
|
|
*/ |
403
|
1 |
|
public function setEnableQtyIncrements($enableQtyIncrements) |
404
|
|
|
{ |
405
|
1 |
|
$this->magentoStockItem->setEnableQtyIncrements($enableQtyIncrements); |
406
|
|
|
|
407
|
1 |
|
return $this; |
408
|
|
|
} |
409
|
|
|
|
410
|
|
|
/** |
411
|
|
|
* {@inheritdoc} |
412
|
|
|
*/ |
413
|
1 |
|
public function getUseConfigManageStock() |
414
|
|
|
{ |
415
|
1 |
|
return $this->magentoStockItem->getUseConfigManageStock(); |
416
|
|
|
} |
417
|
|
|
|
418
|
|
|
/** |
419
|
|
|
* {@inheritdoc} |
420
|
|
|
*/ |
421
|
1 |
|
public function setUseConfigManageStock($useConfigManageStock) |
422
|
|
|
{ |
423
|
1 |
|
$this->magentoStockItem->setUseConfigManageStock($useConfigManageStock); |
424
|
|
|
|
425
|
1 |
|
return $this; |
426
|
|
|
} |
427
|
|
|
|
428
|
|
|
/** |
429
|
|
|
* {@inheritdoc} |
430
|
|
|
*/ |
431
|
1 |
|
public function getManageStock() |
432
|
|
|
{ |
433
|
1 |
|
return $this->magentoStockItem->getManageStock(); |
434
|
|
|
} |
435
|
|
|
|
436
|
|
|
/** |
437
|
|
|
* {@inheritdoc} |
438
|
|
|
*/ |
439
|
1 |
|
public function setManageStock($manageStock) |
440
|
|
|
{ |
441
|
1 |
|
$this->magentoStockItem->setManageStock($manageStock); |
442
|
|
|
|
443
|
1 |
|
return $this; |
444
|
|
|
} |
445
|
|
|
|
446
|
|
|
/** |
447
|
|
|
* {@inheritdoc} |
448
|
|
|
*/ |
449
|
1 |
|
public function getLowStockDate() |
450
|
|
|
{ |
451
|
1 |
|
return $this->magentoStockItem->getLowStockDate(); |
452
|
|
|
} |
453
|
|
|
|
454
|
|
|
/** |
455
|
|
|
* {@inheritdoc} |
456
|
|
|
*/ |
457
|
1 |
|
public function setLowStockDate($lowStockDate) |
458
|
|
|
{ |
459
|
1 |
|
$this->magentoStockItem->setLowStockDate($lowStockDate); |
460
|
|
|
|
461
|
1 |
|
return $this; |
462
|
|
|
} |
463
|
|
|
|
464
|
|
|
/** |
465
|
|
|
* {@inheritdoc} |
466
|
|
|
*/ |
467
|
1 |
|
public function getIsDecimalDivided() |
468
|
|
|
{ |
469
|
1 |
|
return $this->magentoStockItem->getIsDecimalDivided(); |
470
|
|
|
} |
471
|
|
|
|
472
|
|
|
/** |
473
|
|
|
* {@inheritdoc} |
474
|
|
|
*/ |
475
|
1 |
|
public function setIsDecimalDivided($isDecimalDivided) |
476
|
|
|
{ |
477
|
1 |
|
$this->magentoStockItem->setIsDecimalDivided($isDecimalDivided); |
478
|
|
|
|
479
|
1 |
|
return $this; |
480
|
|
|
} |
481
|
|
|
|
482
|
|
|
/** |
483
|
|
|
* {@inheritdoc} |
484
|
|
|
*/ |
485
|
1 |
|
public function getStockStatusChangedAuto() |
486
|
|
|
{ |
487
|
1 |
|
return $this->magentoStockItem->getStockStatusChangedAuto(); |
488
|
|
|
} |
489
|
|
|
|
490
|
|
|
/** |
491
|
|
|
* {@inheritdoc} |
492
|
|
|
*/ |
493
|
1 |
|
public function setStockStatusChangedAuto($stockStatusChangedAuto) |
494
|
|
|
{ |
495
|
1 |
|
$this->magentoStockItem->setStockStatusChangedAuto($stockStatusChangedAuto); |
496
|
|
|
|
497
|
1 |
|
return $this; |
498
|
|
|
} |
499
|
|
|
|
500
|
|
|
/** |
501
|
|
|
* {@inheritdoc} |
502
|
|
|
*/ |
503
|
1 |
|
public function getExtensionAttributes() |
504
|
|
|
{ |
505
|
1 |
|
return $this->magentoStockItem->getExtensionAttributes(); |
506
|
|
|
} |
507
|
|
|
|
508
|
|
|
/** |
509
|
|
|
* {@inheritdoc} |
510
|
|
|
*/ |
511
|
1 |
|
public function setExtensionAttributes( |
512
|
|
|
\Magento\CatalogInventory\Api\Data\StockItemExtensionInterface $extensionAttributes |
513
|
|
|
) { |
514
|
1 |
|
$this->magentoStockItem->setExtensionAttributes($extensionAttributes); |
515
|
|
|
|
516
|
1 |
|
return $this; |
517
|
|
|
} |
518
|
|
|
} |
519
|
|
|
|