Skip to content

Commit 645973c

Browse files
author
Joan He
committed
Merge remote-tracking branch 'upstream/2.3-develop' into MAGETWO-55099
2 parents 246e7a5 + ef04c2c commit 645973c

File tree

84 files changed

+2174
-419
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

84 files changed

+2174
-419
lines changed

app/code/Magento/AdvancedSearch/view/adminhtml/web/js/testconnection.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,8 @@ define([
4040
element = $('#' + this.options.elementId),
4141
self = this,
4242
params = {},
43-
msg = '';
43+
msg = '',
44+
fieldToCheck = this.options.fieldToCheck || 'success';
4445

4546
element.removeClass('success').addClass('fail');
4647
$.each($.parseJSON(this.options.fieldMapping), function (key, el) {
@@ -49,9 +50,10 @@ define([
4950
$.ajax({
5051
url: this.options.url,
5152
showLoader: true,
52-
data: params
53+
data: params,
54+
headers: this.options.headers || {}
5355
}).done(function (response) {
54-
if (response.success) {
56+
if (response[fieldToCheck]) {
5557
element.removeClass('fail').addClass('success');
5658
result = self.options.successText;
5759
} else {

app/code/Magento/Bundle/etc/db_schema.xml

Lines changed: 33 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@
9797
comment="Website Id"/>
9898
<column xsi:type="smallint" name="selection_price_type" padding="5" unsigned="true" nullable="false"
9999
identity="false" default="0" comment="Selection Price Type"/>
100-
<column xsi:type="decimal" name="selection_price_value" scale="4" precision="12" unsigned="false"
100+
<column xsi:type="decimal" name="selection_price_value" scale="6" precision="20" unsigned="false"
101101
nullable="false" default="0" comment="Selection Price Value"/>
102102
<column xsi:type="int" name="parent_product_id" padding="10" unsigned="true" nullable="false" identity="false"
103103
comment="Parent Product Id"/>
@@ -125,9 +125,9 @@
125125
comment="Website Id"/>
126126
<column xsi:type="int" name="customer_group_id" padding="10" unsigned="true" nullable="false" identity="false"
127127
comment="Customer Group ID"/>
128-
<column xsi:type="decimal" name="min_price" scale="4" precision="12" unsigned="false" nullable="false"
128+
<column xsi:type="decimal" name="min_price" scale="6" precision="20" unsigned="false" nullable="false"
129129
comment="Min Price"/>
130-
<column xsi:type="decimal" name="max_price" scale="4" precision="12" unsigned="false" nullable="false"
130+
<column xsi:type="decimal" name="max_price" scale="6" precision="20" unsigned="false" nullable="false"
131131
comment="Max Price"/>
132132
<constraint xsi:type="primary" referenceId="PRIMARY">
133133
<column name="entity_id"/>
@@ -181,21 +181,21 @@
181181
default="0" comment="Tax Class ID"/>
182182
<column xsi:type="smallint" name="price_type" padding="5" unsigned="true" nullable="false" identity="false"
183183
comment="Price Type"/>
184-
<column xsi:type="decimal" name="special_price" scale="4" precision="12" unsigned="false" nullable="true"
184+
<column xsi:type="decimal" name="special_price" scale="6" precision="20" unsigned="false" nullable="true"
185185
comment="Special Price"/>
186-
<column xsi:type="decimal" name="tier_percent" scale="4" precision="12" unsigned="false" nullable="true"
186+
<column xsi:type="decimal" name="tier_percent" scale="6" precision="20" unsigned="false" nullable="true"
187187
comment="Tier Percent"/>
188-
<column xsi:type="decimal" name="orig_price" scale="4" precision="12" unsigned="false" nullable="true"
188+
<column xsi:type="decimal" name="orig_price" scale="6" precision="20" unsigned="false" nullable="true"
189189
comment="Orig Price"/>
190-
<column xsi:type="decimal" name="price" scale="4" precision="12" unsigned="false" nullable="true"
190+
<column xsi:type="decimal" name="price" scale="6" precision="20" unsigned="false" nullable="true"
191191
comment="Price"/>
192-
<column xsi:type="decimal" name="min_price" scale="4" precision="12" unsigned="false" nullable="true"
192+
<column xsi:type="decimal" name="min_price" scale="6" precision="20" unsigned="false" nullable="true"
193193
comment="Min Price"/>
194-
<column xsi:type="decimal" name="max_price" scale="4" precision="12" unsigned="false" nullable="true"
194+
<column xsi:type="decimal" name="max_price" scale="6" precision="20" unsigned="false" nullable="true"
195195
comment="Max Price"/>
196-
<column xsi:type="decimal" name="tier_price" scale="4" precision="12" unsigned="false" nullable="true"
196+
<column xsi:type="decimal" name="tier_price" scale="6" precision="20" unsigned="false" nullable="true"
197197
comment="Tier Price"/>
198-
<column xsi:type="decimal" name="base_tier" scale="4" precision="12" unsigned="false" nullable="true"
198+
<column xsi:type="decimal" name="base_tier" scale="6" precision="20" unsigned="false" nullable="true"
199199
comment="Base Tier"/>
200200
<constraint xsi:type="primary" referenceId="PRIMARY">
201201
<column name="entity_id"/>
@@ -215,21 +215,21 @@
215215
default="0" comment="Tax Class ID"/>
216216
<column xsi:type="smallint" name="price_type" padding="5" unsigned="true" nullable="false" identity="false"
217217
comment="Price Type"/>
218-
<column xsi:type="decimal" name="special_price" scale="4" precision="12" unsigned="false" nullable="true"
218+
<column xsi:type="decimal" name="special_price" scale="6" precision="20" unsigned="false" nullable="true"
219219
comment="Special Price"/>
220-
<column xsi:type="decimal" name="tier_percent" scale="4" precision="12" unsigned="false" nullable="true"
220+
<column xsi:type="decimal" name="tier_percent" scale="6" precision="20" unsigned="false" nullable="true"
221221
comment="Tier Percent"/>
222-
<column xsi:type="decimal" name="orig_price" scale="4" precision="12" unsigned="false" nullable="true"
222+
<column xsi:type="decimal" name="orig_price" scale="6" precision="20" unsigned="false" nullable="true"
223223
comment="Orig Price"/>
224-
<column xsi:type="decimal" name="price" scale="4" precision="12" unsigned="false" nullable="true"
224+
<column xsi:type="decimal" name="price" scale="6" precision="20" unsigned="false" nullable="true"
225225
comment="Price"/>
226-
<column xsi:type="decimal" name="min_price" scale="4" precision="12" unsigned="false" nullable="true"
226+
<column xsi:type="decimal" name="min_price" scale="6" precision="20" unsigned="false" nullable="true"
227227
comment="Min Price"/>
228-
<column xsi:type="decimal" name="max_price" scale="4" precision="12" unsigned="false" nullable="true"
228+
<column xsi:type="decimal" name="max_price" scale="6" precision="20" unsigned="false" nullable="true"
229229
comment="Max Price"/>
230-
<column xsi:type="decimal" name="tier_price" scale="4" precision="12" unsigned="false" nullable="true"
230+
<column xsi:type="decimal" name="tier_price" scale="6" precision="20" unsigned="false" nullable="true"
231231
comment="Tier Price"/>
232-
<column xsi:type="decimal" name="base_tier" scale="4" precision="12" unsigned="false" nullable="true"
232+
<column xsi:type="decimal" name="base_tier" scale="6" precision="20" unsigned="false" nullable="true"
233233
comment="Base Tier"/>
234234
<constraint xsi:type="primary" referenceId="PRIMARY">
235235
<column name="entity_id"/>
@@ -253,9 +253,9 @@
253253
default="0" comment="Group Type"/>
254254
<column xsi:type="smallint" name="is_required" padding="5" unsigned="true" nullable="true" identity="false"
255255
default="0" comment="Is Required"/>
256-
<column xsi:type="decimal" name="price" scale="4" precision="12" unsigned="false" nullable="true"
256+
<column xsi:type="decimal" name="price" scale="6" precision="20" unsigned="false" nullable="true"
257257
comment="Price"/>
258-
<column xsi:type="decimal" name="tier_price" scale="4" precision="12" unsigned="false" nullable="true"
258+
<column xsi:type="decimal" name="tier_price" scale="6" precision="20" unsigned="false" nullable="true"
259259
comment="Tier Price"/>
260260
<constraint xsi:type="primary" referenceId="PRIMARY">
261261
<column name="entity_id"/>
@@ -281,9 +281,9 @@
281281
default="0" comment="Group Type"/>
282282
<column xsi:type="smallint" name="is_required" padding="5" unsigned="true" nullable="true" identity="false"
283283
default="0" comment="Is Required"/>
284-
<column xsi:type="decimal" name="price" scale="4" precision="12" unsigned="false" nullable="true"
284+
<column xsi:type="decimal" name="price" scale="6" precision="20" unsigned="false" nullable="true"
285285
comment="Price"/>
286-
<column xsi:type="decimal" name="tier_price" scale="4" precision="12" unsigned="false" nullable="true"
286+
<column xsi:type="decimal" name="tier_price" scale="6" precision="20" unsigned="false" nullable="true"
287287
comment="Tier Price"/>
288288
<constraint xsi:type="primary" referenceId="PRIMARY">
289289
<column name="entity_id"/>
@@ -303,15 +303,15 @@
303303
comment="Website ID"/>
304304
<column xsi:type="int" name="option_id" padding="10" unsigned="true" nullable="false" identity="false"
305305
default="0" comment="Option Id"/>
306-
<column xsi:type="decimal" name="min_price" scale="4" precision="12" unsigned="false" nullable="true"
306+
<column xsi:type="decimal" name="min_price" scale="6" precision="20" unsigned="false" nullable="true"
307307
comment="Min Price"/>
308-
<column xsi:type="decimal" name="alt_price" scale="4" precision="12" unsigned="false" nullable="true"
308+
<column xsi:type="decimal" name="alt_price" scale="6" precision="20" unsigned="false" nullable="true"
309309
comment="Alt Price"/>
310-
<column xsi:type="decimal" name="max_price" scale="4" precision="12" unsigned="false" nullable="true"
310+
<column xsi:type="decimal" name="max_price" scale="6" precision="20" unsigned="false" nullable="true"
311311
comment="Max Price"/>
312-
<column xsi:type="decimal" name="tier_price" scale="4" precision="12" unsigned="false" nullable="true"
312+
<column xsi:type="decimal" name="tier_price" scale="6" precision="20" unsigned="false" nullable="true"
313313
comment="Tier Price"/>
314-
<column xsi:type="decimal" name="alt_tier_price" scale="4" precision="12" unsigned="false" nullable="true"
314+
<column xsi:type="decimal" name="alt_tier_price" scale="6" precision="20" unsigned="false" nullable="true"
315315
comment="Alt Tier Price"/>
316316
<constraint xsi:type="primary" referenceId="PRIMARY">
317317
<column name="entity_id"/>
@@ -330,15 +330,15 @@
330330
comment="Website ID"/>
331331
<column xsi:type="int" name="option_id" padding="10" unsigned="true" nullable="false" identity="false"
332332
default="0" comment="Option Id"/>
333-
<column xsi:type="decimal" name="min_price" scale="4" precision="12" unsigned="false" nullable="true"
333+
<column xsi:type="decimal" name="min_price" scale="6" precision="20" unsigned="false" nullable="true"
334334
comment="Min Price"/>
335-
<column xsi:type="decimal" name="alt_price" scale="4" precision="12" unsigned="false" nullable="true"
335+
<column xsi:type="decimal" name="alt_price" scale="6" precision="20" unsigned="false" nullable="true"
336336
comment="Alt Price"/>
337-
<column xsi:type="decimal" name="max_price" scale="4" precision="12" unsigned="false" nullable="true"
337+
<column xsi:type="decimal" name="max_price" scale="6" precision="20" unsigned="false" nullable="true"
338338
comment="Max Price"/>
339-
<column xsi:type="decimal" name="tier_price" scale="4" precision="12" unsigned="false" nullable="true"
339+
<column xsi:type="decimal" name="tier_price" scale="6" precision="20" unsigned="false" nullable="true"
340340
comment="Tier Price"/>
341-
<column xsi:type="decimal" name="alt_tier_price" scale="4" precision="12" unsigned="false" nullable="true"
341+
<column xsi:type="decimal" name="alt_tier_price" scale="6" precision="20" unsigned="false" nullable="true"
342342
comment="Alt Tier Price"/>
343343
<constraint xsi:type="primary" referenceId="PRIMARY">
344344
<column name="entity_id"/>

app/code/Magento/Catalog/Model/ResourceModel/Product.php

Lines changed: 30 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99
use Magento\Framework\App\ObjectManager;
1010
use Magento\Catalog\Model\Indexer\Category\Product\TableMaintainer;
1111
use Magento\Eav\Model\Entity\Attribute\UniqueValidationInterface;
12+
use Magento\Framework\EntityManager\EntityManager;
13+
use Magento\Framework\Model\AbstractModel;
1214

1315
/**
1416
* Product entity resource model
@@ -44,7 +46,7 @@ class Product extends AbstractResource
4446
/**
4547
* Category collection factory
4648
*
47-
* @var \Magento\Catalog\Model\ResourceModel\Category\CollectionFactory
49+
* @var Category\CollectionFactory
4850
*/
4951
protected $_categoryCollectionFactory;
5052

@@ -64,7 +66,7 @@ class Product extends AbstractResource
6466
protected $typeFactory;
6567

6668
/**
67-
* @var \Magento\Framework\EntityManager\EntityManager
69+
* @var EntityManager
6870
* @since 101.0.0
6971
*/
7072
protected $entityManager;
@@ -81,7 +83,7 @@ class Product extends AbstractResource
8183
protected $availableCategoryIdsCache = [];
8284

8385
/**
84-
* @var \Magento\Catalog\Model\ResourceModel\Product\CategoryLink
86+
* @var Product\CategoryLink
8587
*/
8688
private $productCategoryLink;
8789

@@ -110,7 +112,7 @@ public function __construct(
110112
\Magento\Eav\Model\Entity\Context $context,
111113
\Magento\Store\Model\StoreManagerInterface $storeManager,
112114
\Magento\Catalog\Model\Factory $modelFactory,
113-
\Magento\Catalog\Model\ResourceModel\Category\CollectionFactory $categoryCollectionFactory,
115+
Category\CollectionFactory $categoryCollectionFactory,
114116
Category $catalogCategory,
115117
\Magento\Framework\Event\ManagerInterface $eventManager,
116118
\Magento\Eav\Model\Entity\Attribute\SetFactory $setFactory,
@@ -236,7 +238,7 @@ public function getWebsiteIdsByProductIds($productIds)
236238
/**
237239
* Retrieve product category identifiers
238240
*
239-
* @param \Magento\Catalog\Model\Product $product
241+
* @param \Magento\Catalog\Model\Product $product
240242
* @return array
241243
*/
242244
public function getCategoryIds($product)
@@ -248,7 +250,7 @@ public function getCategoryIds($product)
248250
/**
249251
* Get product identifier by sku
250252
*
251-
* @param string $sku
253+
* @param string $sku
252254
* @return int|false
253255
*/
254256
public function getIdBySku($sku)
@@ -348,11 +350,11 @@ protected function _saveCategories(\Magento\Framework\DataObject $object)
348350
* Get collection of product categories
349351
*
350352
* @param \Magento\Catalog\Model\Product $product
351-
* @return \Magento\Catalog\Model\ResourceModel\Category\Collection
353+
* @return Category\Collection
352354
*/
353355
public function getCategoryCollection($product)
354356
{
355-
/** @var \Magento\Catalog\Model\ResourceModel\Category\Collection $collection */
357+
/** @var Category\Collection $collection */
356358
$collection = $this->_categoryCollectionFactory->create();
357359
$collection->joinField(
358360
'product_id',
@@ -428,18 +430,26 @@ public function getDefaultAttributeSourceModel()
428430
/**
429431
* Check availability display product in category
430432
*
431-
* @param \Magento\Catalog\Model\Product $product
433+
* @param \Magento\Catalog\Model\Product|int $product
432434
* @param int $categoryId
433435
* @return string
434436
*/
435437
public function canBeShowInCategory($product, $categoryId)
436438
{
439+
if ($product instanceof \Magento\Catalog\Model\Product) {
440+
$productId = $product->getEntityId();
441+
$storeId = $product->getStoreId();
442+
} else {
443+
$productId = $product;
444+
$storeId = $this->_storeManager->getStore()->getId();
445+
}
446+
437447
$select = $this->getConnection()->select()->from(
438-
$this->tableMaintainer->getMainTable($product->getStoreId()),
448+
$this->tableMaintainer->getMainTable($storeId),
439449
'product_id'
440450
)->where(
441451
'product_id = ?',
442-
(int)$product->getEntityId()
452+
(int)$productId
443453
)->where(
444454
'category_id = ?',
445455
(int)$categoryId
@@ -614,7 +624,7 @@ public function validate($object)
614624
/**
615625
* Reset firstly loaded attributes
616626
*
617-
* @param \Magento\Framework\Model\AbstractModel $object
627+
* @param AbstractModel $object
618628
* @param integer $entityId
619629
* @param array|null $attributes
620630
* @return $this
@@ -667,12 +677,12 @@ protected function evaluateDelete($object, $id, $connection)
667677
/**
668678
* Save entity's attributes into the object's resource
669679
*
670-
* @param \Magento\Framework\Model\AbstractModel $object
680+
* @param AbstractModel $object
671681
* @return $this
672682
* @throws \Exception
673683
* @since 101.0.0
674684
*/
675-
public function save(\Magento\Framework\Model\AbstractModel $object)
685+
public function save(AbstractModel $object)
676686
{
677687
$this->getEntityManager()->save($object);
678688
return $this;
@@ -681,13 +691,13 @@ public function save(\Magento\Framework\Model\AbstractModel $object)
681691
/**
682692
* Retrieve entity manager object
683693
*
684-
* @return \Magento\Framework\EntityManager\EntityManager
694+
* @return EntityManager
685695
*/
686696
private function getEntityManager()
687697
{
688698
if (null === $this->entityManager) {
689-
$this->entityManager = \Magento\Framework\App\ObjectManager::getInstance()
690-
->get(\Magento\Framework\EntityManager\EntityManager::class);
699+
$this->entityManager = ObjectManager::getInstance()
700+
->get(EntityManager::class);
691701
}
692702
return $this->entityManager;
693703
}
@@ -707,13 +717,13 @@ private function getProductWebsiteLink()
707717
* Retrieve CategoryLink object
708718
*
709719
* @deprecated 101.1.0
710-
* @return \Magento\Catalog\Model\ResourceModel\Product\CategoryLink
720+
* @return Product\CategoryLink
711721
*/
712722
private function getProductCategoryLink()
713723
{
714724
if (null === $this->productCategoryLink) {
715-
$this->productCategoryLink = \Magento\Framework\App\ObjectManager::getInstance()
716-
->get(\Magento\Catalog\Model\ResourceModel\Product\CategoryLink::class);
725+
$this->productCategoryLink = ObjectManager::getInstance()
726+
->get(Product\CategoryLink::class);
717727
}
718728
return $this->productCategoryLink;
719729
}

0 commit comments

Comments
 (0)