15
15
use Magento \Inventory \Model \ResourceModel \SourceItem \CollectionFactory ;
16
16
use Magento \InventoryApi \Api \Data \SourceInterface ;
17
17
use Magento \InventoryApi \Api \Data \SourceItemInterface ;
18
+ use Magento \InventoryCatalog \Model \CanManageSourceItemsBySku ;
18
19
use Magento \InventoryCatalog \Model \IsSingleSourceModeInterface ;
19
- use Magento \InventoryCatalog \Ui \DataProvider \Product \Form \Modifier \SourceItems \ManageStock ;
20
20
use Magento \InventoryConfiguration \Model \IsSourceItemsAllowedForProductTypeInterface ;
21
21
22
22
/**
@@ -50,34 +50,32 @@ class SourceItems extends AbstractModifier
50
50
private $ resourceConnection ;
51
51
52
52
/**
53
- * Check, if stock should be managed for given product.
54
- *
55
- * @var ManageStock
53
+ * @var CanManageSourceItemsBySku
56
54
*/
57
- private $ manageStock ;
55
+ private $ canManageSourceItemsBySku ;
58
56
59
57
/**
60
58
* @param IsSourceItemsAllowedForProductTypeInterface $isSourceItemsAllowedForProductType
61
59
* @param IsSingleSourceModeInterface $isSingleSourceMode
62
60
* @param LocatorInterface $locator
63
61
* @param CollectionFactory $sourceItemCollectionFactory
64
62
* @param ResourceConnection $resourceConnection
65
- * @param ManageStock $manageStock
63
+ * @param CanManageSourceItemsBySku $canManageSourceItemsBySku
66
64
*/
67
65
public function __construct (
68
66
IsSourceItemsAllowedForProductTypeInterface $ isSourceItemsAllowedForProductType ,
69
67
IsSingleSourceModeInterface $ isSingleSourceMode ,
70
68
LocatorInterface $ locator ,
71
69
CollectionFactory $ sourceItemCollectionFactory ,
72
70
ResourceConnection $ resourceConnection ,
73
- ManageStock $ manageStock
71
+ CanManageSourceItemsBySku $ canManageSourceItemsBySku
74
72
) {
75
73
$ this ->isSourceItemsAllowedForProductType = $ isSourceItemsAllowedForProductType ;
76
74
$ this ->isSingleSourceMode = $ isSingleSourceMode ;
77
75
$ this ->locator = $ locator ;
78
76
$ this ->sourceItemCollectionFactory = $ sourceItemCollectionFactory ;
79
77
$ this ->resourceConnection = $ resourceConnection ;
80
- $ this ->manageStock = $ manageStock ;
78
+ $ this ->canManageSourceItemsBySku = $ canManageSourceItemsBySku ;
81
79
}
82
80
83
81
/**
@@ -138,7 +136,8 @@ public function modifyMeta(array $meta)
138
136
|| $ this ->isSourceItemsAllowedForProductType ->execute ($ product ->getTypeId ()) === false ) {
139
137
return $ meta ;
140
138
}
141
- $ isMangeStock = $ this ->manageStock ->execute ($ product ->getSku ());
139
+
140
+ $ canMangeSourceItems = $ this ->canManageSourceItemsBySku ->execute ($ product ->getSku ());
142
141
$ meta ['sources ' ] = [
143
142
'arguments ' => [
144
143
'data ' => [
@@ -154,7 +153,7 @@ public function modifyMeta(array $meta)
154
153
'arguments ' => [
155
154
'data ' => [
156
155
'config ' => [
157
- 'visible ' => $ isMangeStock ,
156
+ 'visible ' => $ canMangeSourceItems ,
158
157
],
159
158
],
160
159
],
@@ -165,7 +164,7 @@ public function modifyMeta(array $meta)
165
164
'arguments ' => [
166
165
'data ' => [
167
166
'config ' => [
168
- 'visible ' => $ isMangeStock ,
167
+ 'visible ' => $ canMangeSourceItems ,
169
168
],
170
169
],
171
170
],
0 commit comments