Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/mtf-eol' into MC-4758
Browse files Browse the repository at this point in the history
  • Loading branch information
tomreece committed May 23, 2019
2 parents c5aed93 + 097e3da commit 90f6a73
Show file tree
Hide file tree
Showing 120 changed files with 3,783 additions and 424 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,8 @@ define([
element = $('#' + this.options.elementId),
self = this,
params = {},
msg = '';
msg = '',
fieldToCheck = this.options.fieldToCheck || 'success';

element.removeClass('success').addClass('fail');
$.each($.parseJSON(this.options.fieldMapping), function (key, el) {
Expand All @@ -49,9 +50,10 @@ define([
$.ajax({
url: this.options.url,
showLoader: true,
data: params
data: params,
headers: this.options.headers || {}
}).done(function (response) {
if (response.success) {
if (response[fieldToCheck]) {
element.removeClass('fail').addClass('success');
result = self.options.successText;
} else {
Expand Down
66 changes: 33 additions & 33 deletions app/code/Magento/Bundle/etc/db_schema.xml
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@
comment="Website Id"/>
<column xsi:type="smallint" name="selection_price_type" padding="5" unsigned="true" nullable="false"
identity="false" default="0" comment="Selection Price Type"/>
<column xsi:type="decimal" name="selection_price_value" scale="4" precision="12" unsigned="false"
<column xsi:type="decimal" name="selection_price_value" scale="6" precision="20" unsigned="false"
nullable="false" default="0" comment="Selection Price Value"/>
<column xsi:type="int" name="parent_product_id" padding="10" unsigned="true" nullable="false" identity="false"
comment="Parent Product Id"/>
Expand Down Expand Up @@ -125,9 +125,9 @@
comment="Website Id"/>
<column xsi:type="int" name="customer_group_id" padding="10" unsigned="true" nullable="false" identity="false"
comment="Customer Group ID"/>
<column xsi:type="decimal" name="min_price" scale="4" precision="12" unsigned="false" nullable="false"
<column xsi:type="decimal" name="min_price" scale="6" precision="20" unsigned="false" nullable="false"
comment="Min Price"/>
<column xsi:type="decimal" name="max_price" scale="4" precision="12" unsigned="false" nullable="false"
<column xsi:type="decimal" name="max_price" scale="6" precision="20" unsigned="false" nullable="false"
comment="Max Price"/>
<constraint xsi:type="primary" referenceId="PRIMARY">
<column name="entity_id"/>
Expand Down Expand Up @@ -181,21 +181,21 @@
default="0" comment="Tax Class ID"/>
<column xsi:type="smallint" name="price_type" padding="5" unsigned="true" nullable="false" identity="false"
comment="Price Type"/>
<column xsi:type="decimal" name="special_price" scale="4" precision="12" unsigned="false" nullable="true"
<column xsi:type="decimal" name="special_price" scale="6" precision="20" unsigned="false" nullable="true"
comment="Special Price"/>
<column xsi:type="decimal" name="tier_percent" scale="4" precision="12" unsigned="false" nullable="true"
<column xsi:type="decimal" name="tier_percent" scale="6" precision="20" unsigned="false" nullable="true"
comment="Tier Percent"/>
<column xsi:type="decimal" name="orig_price" scale="4" precision="12" unsigned="false" nullable="true"
<column xsi:type="decimal" name="orig_price" scale="6" precision="20" unsigned="false" nullable="true"
comment="Orig Price"/>
<column xsi:type="decimal" name="price" scale="4" precision="12" unsigned="false" nullable="true"
<column xsi:type="decimal" name="price" scale="6" precision="20" unsigned="false" nullable="true"
comment="Price"/>
<column xsi:type="decimal" name="min_price" scale="4" precision="12" unsigned="false" nullable="true"
<column xsi:type="decimal" name="min_price" scale="6" precision="20" unsigned="false" nullable="true"
comment="Min Price"/>
<column xsi:type="decimal" name="max_price" scale="4" precision="12" unsigned="false" nullable="true"
<column xsi:type="decimal" name="max_price" scale="6" precision="20" unsigned="false" nullable="true"
comment="Max Price"/>
<column xsi:type="decimal" name="tier_price" scale="4" precision="12" unsigned="false" nullable="true"
<column xsi:type="decimal" name="tier_price" scale="6" precision="20" unsigned="false" nullable="true"
comment="Tier Price"/>
<column xsi:type="decimal" name="base_tier" scale="4" precision="12" unsigned="false" nullable="true"
<column xsi:type="decimal" name="base_tier" scale="6" precision="20" unsigned="false" nullable="true"
comment="Base Tier"/>
<constraint xsi:type="primary" referenceId="PRIMARY">
<column name="entity_id"/>
Expand All @@ -215,21 +215,21 @@
default="0" comment="Tax Class ID"/>
<column xsi:type="smallint" name="price_type" padding="5" unsigned="true" nullable="false" identity="false"
comment="Price Type"/>
<column xsi:type="decimal" name="special_price" scale="4" precision="12" unsigned="false" nullable="true"
<column xsi:type="decimal" name="special_price" scale="6" precision="20" unsigned="false" nullable="true"
comment="Special Price"/>
<column xsi:type="decimal" name="tier_percent" scale="4" precision="12" unsigned="false" nullable="true"
<column xsi:type="decimal" name="tier_percent" scale="6" precision="20" unsigned="false" nullable="true"
comment="Tier Percent"/>
<column xsi:type="decimal" name="orig_price" scale="4" precision="12" unsigned="false" nullable="true"
<column xsi:type="decimal" name="orig_price" scale="6" precision="20" unsigned="false" nullable="true"
comment="Orig Price"/>
<column xsi:type="decimal" name="price" scale="4" precision="12" unsigned="false" nullable="true"
<column xsi:type="decimal" name="price" scale="6" precision="20" unsigned="false" nullable="true"
comment="Price"/>
<column xsi:type="decimal" name="min_price" scale="4" precision="12" unsigned="false" nullable="true"
<column xsi:type="decimal" name="min_price" scale="6" precision="20" unsigned="false" nullable="true"
comment="Min Price"/>
<column xsi:type="decimal" name="max_price" scale="4" precision="12" unsigned="false" nullable="true"
<column xsi:type="decimal" name="max_price" scale="6" precision="20" unsigned="false" nullable="true"
comment="Max Price"/>
<column xsi:type="decimal" name="tier_price" scale="4" precision="12" unsigned="false" nullable="true"
<column xsi:type="decimal" name="tier_price" scale="6" precision="20" unsigned="false" nullable="true"
comment="Tier Price"/>
<column xsi:type="decimal" name="base_tier" scale="4" precision="12" unsigned="false" nullable="true"
<column xsi:type="decimal" name="base_tier" scale="6" precision="20" unsigned="false" nullable="true"
comment="Base Tier"/>
<constraint xsi:type="primary" referenceId="PRIMARY">
<column name="entity_id"/>
Expand All @@ -253,9 +253,9 @@
default="0" comment="Group Type"/>
<column xsi:type="smallint" name="is_required" padding="5" unsigned="true" nullable="true" identity="false"
default="0" comment="Is Required"/>
<column xsi:type="decimal" name="price" scale="4" precision="12" unsigned="false" nullable="true"
<column xsi:type="decimal" name="price" scale="6" precision="20" unsigned="false" nullable="true"
comment="Price"/>
<column xsi:type="decimal" name="tier_price" scale="4" precision="12" unsigned="false" nullable="true"
<column xsi:type="decimal" name="tier_price" scale="6" precision="20" unsigned="false" nullable="true"
comment="Tier Price"/>
<constraint xsi:type="primary" referenceId="PRIMARY">
<column name="entity_id"/>
Expand All @@ -281,9 +281,9 @@
default="0" comment="Group Type"/>
<column xsi:type="smallint" name="is_required" padding="5" unsigned="true" nullable="true" identity="false"
default="0" comment="Is Required"/>
<column xsi:type="decimal" name="price" scale="4" precision="12" unsigned="false" nullable="true"
<column xsi:type="decimal" name="price" scale="6" precision="20" unsigned="false" nullable="true"
comment="Price"/>
<column xsi:type="decimal" name="tier_price" scale="4" precision="12" unsigned="false" nullable="true"
<column xsi:type="decimal" name="tier_price" scale="6" precision="20" unsigned="false" nullable="true"
comment="Tier Price"/>
<constraint xsi:type="primary" referenceId="PRIMARY">
<column name="entity_id"/>
Expand All @@ -303,15 +303,15 @@
comment="Website ID"/>
<column xsi:type="int" name="option_id" padding="10" unsigned="true" nullable="false" identity="false"
default="0" comment="Option Id"/>
<column xsi:type="decimal" name="min_price" scale="4" precision="12" unsigned="false" nullable="true"
<column xsi:type="decimal" name="min_price" scale="6" precision="20" unsigned="false" nullable="true"
comment="Min Price"/>
<column xsi:type="decimal" name="alt_price" scale="4" precision="12" unsigned="false" nullable="true"
<column xsi:type="decimal" name="alt_price" scale="6" precision="20" unsigned="false" nullable="true"
comment="Alt Price"/>
<column xsi:type="decimal" name="max_price" scale="4" precision="12" unsigned="false" nullable="true"
<column xsi:type="decimal" name="max_price" scale="6" precision="20" unsigned="false" nullable="true"
comment="Max Price"/>
<column xsi:type="decimal" name="tier_price" scale="4" precision="12" unsigned="false" nullable="true"
<column xsi:type="decimal" name="tier_price" scale="6" precision="20" unsigned="false" nullable="true"
comment="Tier Price"/>
<column xsi:type="decimal" name="alt_tier_price" scale="4" precision="12" unsigned="false" nullable="true"
<column xsi:type="decimal" name="alt_tier_price" scale="6" precision="20" unsigned="false" nullable="true"
comment="Alt Tier Price"/>
<constraint xsi:type="primary" referenceId="PRIMARY">
<column name="entity_id"/>
Expand All @@ -330,15 +330,15 @@
comment="Website ID"/>
<column xsi:type="int" name="option_id" padding="10" unsigned="true" nullable="false" identity="false"
default="0" comment="Option Id"/>
<column xsi:type="decimal" name="min_price" scale="4" precision="12" unsigned="false" nullable="true"
<column xsi:type="decimal" name="min_price" scale="6" precision="20" unsigned="false" nullable="true"
comment="Min Price"/>
<column xsi:type="decimal" name="alt_price" scale="4" precision="12" unsigned="false" nullable="true"
<column xsi:type="decimal" name="alt_price" scale="6" precision="20" unsigned="false" nullable="true"
comment="Alt Price"/>
<column xsi:type="decimal" name="max_price" scale="4" precision="12" unsigned="false" nullable="true"
<column xsi:type="decimal" name="max_price" scale="6" precision="20" unsigned="false" nullable="true"
comment="Max Price"/>
<column xsi:type="decimal" name="tier_price" scale="4" precision="12" unsigned="false" nullable="true"
<column xsi:type="decimal" name="tier_price" scale="6" precision="20" unsigned="false" nullable="true"
comment="Tier Price"/>
<column xsi:type="decimal" name="alt_tier_price" scale="4" precision="12" unsigned="false" nullable="true"
<column xsi:type="decimal" name="alt_tier_price" scale="6" precision="20" unsigned="false" nullable="true"
comment="Alt Tier Price"/>
<constraint xsi:type="primary" referenceId="PRIMARY">
<column name="entity_id"/>
Expand Down
50 changes: 30 additions & 20 deletions app/code/Magento/Catalog/Model/ResourceModel/Product.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
use Magento\Framework\App\ObjectManager;
use Magento\Catalog\Model\Indexer\Category\Product\TableMaintainer;
use Magento\Eav\Model\Entity\Attribute\UniqueValidationInterface;
use Magento\Framework\EntityManager\EntityManager;
use Magento\Framework\Model\AbstractModel;

/**
* Product entity resource model
Expand Down Expand Up @@ -44,7 +46,7 @@ class Product extends AbstractResource
/**
* Category collection factory
*
* @var \Magento\Catalog\Model\ResourceModel\Category\CollectionFactory
* @var Category\CollectionFactory
*/
protected $_categoryCollectionFactory;

Expand All @@ -64,7 +66,7 @@ class Product extends AbstractResource
protected $typeFactory;

/**
* @var \Magento\Framework\EntityManager\EntityManager
* @var EntityManager
* @since 101.0.0
*/
protected $entityManager;
Expand All @@ -81,7 +83,7 @@ class Product extends AbstractResource
protected $availableCategoryIdsCache = [];

/**
* @var \Magento\Catalog\Model\ResourceModel\Product\CategoryLink
* @var Product\CategoryLink
*/
private $productCategoryLink;

Expand Down Expand Up @@ -110,7 +112,7 @@ public function __construct(
\Magento\Eav\Model\Entity\Context $context,
\Magento\Store\Model\StoreManagerInterface $storeManager,
\Magento\Catalog\Model\Factory $modelFactory,
\Magento\Catalog\Model\ResourceModel\Category\CollectionFactory $categoryCollectionFactory,
Category\CollectionFactory $categoryCollectionFactory,
Category $catalogCategory,
\Magento\Framework\Event\ManagerInterface $eventManager,
\Magento\Eav\Model\Entity\Attribute\SetFactory $setFactory,
Expand Down Expand Up @@ -236,7 +238,7 @@ public function getWebsiteIdsByProductIds($productIds)
/**
* Retrieve product category identifiers
*
* @param \Magento\Catalog\Model\Product $product
* @param \Magento\Catalog\Model\Product $product
* @return array
*/
public function getCategoryIds($product)
Expand All @@ -248,7 +250,7 @@ public function getCategoryIds($product)
/**
* Get product identifier by sku
*
* @param string $sku
* @param string $sku
* @return int|false
*/
public function getIdBySku($sku)
Expand Down Expand Up @@ -348,11 +350,11 @@ protected function _saveCategories(\Magento\Framework\DataObject $object)
* Get collection of product categories
*
* @param \Magento\Catalog\Model\Product $product
* @return \Magento\Catalog\Model\ResourceModel\Category\Collection
* @return Category\Collection
*/
public function getCategoryCollection($product)
{
/** @var \Magento\Catalog\Model\ResourceModel\Category\Collection $collection */
/** @var Category\Collection $collection */
$collection = $this->_categoryCollectionFactory->create();
$collection->joinField(
'product_id',
Expand Down Expand Up @@ -428,18 +430,26 @@ public function getDefaultAttributeSourceModel()
/**
* Check availability display product in category
*
* @param \Magento\Catalog\Model\Product $product
* @param \Magento\Catalog\Model\Product|int $product
* @param int $categoryId
* @return string
*/
public function canBeShowInCategory($product, $categoryId)
{
if ($product instanceof \Magento\Catalog\Model\Product) {
$productId = $product->getEntityId();
$storeId = $product->getStoreId();
} else {
$productId = $product;
$storeId = $this->_storeManager->getStore()->getId();
}

$select = $this->getConnection()->select()->from(
$this->tableMaintainer->getMainTable($product->getStoreId()),
$this->tableMaintainer->getMainTable($storeId),
'product_id'
)->where(
'product_id = ?',
(int)$product->getEntityId()
(int)$productId
)->where(
'category_id = ?',
(int)$categoryId
Expand Down Expand Up @@ -614,7 +624,7 @@ public function validate($object)
/**
* Reset firstly loaded attributes
*
* @param \Magento\Framework\Model\AbstractModel $object
* @param AbstractModel $object
* @param integer $entityId
* @param array|null $attributes
* @return $this
Expand Down Expand Up @@ -667,12 +677,12 @@ protected function evaluateDelete($object, $id, $connection)
/**
* Save entity's attributes into the object's resource
*
* @param \Magento\Framework\Model\AbstractModel $object
* @param AbstractModel $object
* @return $this
* @throws \Exception
* @since 101.0.0
*/
public function save(\Magento\Framework\Model\AbstractModel $object)
public function save(AbstractModel $object)
{
$this->getEntityManager()->save($object);
return $this;
Expand All @@ -681,13 +691,13 @@ public function save(\Magento\Framework\Model\AbstractModel $object)
/**
* Retrieve entity manager object
*
* @return \Magento\Framework\EntityManager\EntityManager
* @return EntityManager
*/
private function getEntityManager()
{
if (null === $this->entityManager) {
$this->entityManager = \Magento\Framework\App\ObjectManager::getInstance()
->get(\Magento\Framework\EntityManager\EntityManager::class);
$this->entityManager = ObjectManager::getInstance()
->get(EntityManager::class);
}
return $this->entityManager;
}
Expand All @@ -707,13 +717,13 @@ private function getProductWebsiteLink()
* Retrieve CategoryLink object
*
* @deprecated 101.1.0
* @return \Magento\Catalog\Model\ResourceModel\Product\CategoryLink
* @return Product\CategoryLink
*/
private function getProductCategoryLink()
{
if (null === $this->productCategoryLink) {
$this->productCategoryLink = \Magento\Framework\App\ObjectManager::getInstance()
->get(\Magento\Catalog\Model\ResourceModel\Product\CategoryLink::class);
$this->productCategoryLink = ObjectManager::getInstance()
->get(Product\CategoryLink::class);
}
return $this->productCategoryLink;
}
Expand Down
Loading

0 comments on commit 90f6a73

Please sign in to comment.