Skip to content
This repository has been archived by the owner on Dec 19, 2019. It is now read-only.

Commit

Permalink
Merge branch '2.3-develop' into feature/271-Customer-Attributes-Valid…
Browse files Browse the repository at this point in the history
…ation
  • Loading branch information
furseyev committed May 19, 2019
2 parents 9f1ba1a + 211dd25 commit 670116c
Show file tree
Hide file tree
Showing 295 changed files with 8,446 additions and 685 deletions.
2 changes: 1 addition & 1 deletion .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,4 @@
- [ ] Pull request has a meaningful description of its purpose
- [ ] All commits are accompanied by meaningful commit messages
- [ ] All new or changed code is covered with unit/integration tests (if applicable)
- [ ] All automated tests passed successfully (all builds on Travis CI are green)
- [ ] All automated tests passed successfully (all builds are green)
File renamed without changes.
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
[![Build Status](https://travis-ci.org/magento/magento2.svg?branch=2.3-develop)](https://travis-ci.org/magento/magento2)
[![Open Source Helpers](https://www.codetriage.com/magento/magento2/badges/users.svg)](https://www.codetriage.com/magento/magento2)
[![Gitter](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/magento/magento2?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge)
[![Crowdin](https://d322cqt584bo4o.cloudfront.net/magento-2/localized.svg)](https://crowdin.com/project/magento-2)
Expand Down
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
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->

<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
<actionGroup name="AssertAdminPageIsNot404ActionGroup">
<dontSee userInput="404 Error" selector="{{AdminHeaderSection.pageHeading}}" stepKey="dontSee404PageHeading"/>
</actionGroup>
</actionGroups>
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->

<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
<actionGroup name="AssertMessageInAdminPanelActionGroup">
<arguments>
<argument name="message" type="string" />
<argument name="messageType" type="string" defaultValue="success" />
</arguments>

<waitForElementVisible selector="{{AdminMessagesSection.messageByType(messageType)}}" stepKey="waitForMessageVisible" />
<see userInput="{{message}}" selector="{{AdminMessagesSection.messageByType(messageType)}}" stepKey="verifyMessage" />
</actionGroup>
</actionGroups>
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,7 @@
<section name="AdminHeaderSection">
<element name="pageTitle" type="text" selector=".page-header h1.page-title"/>
<element name="adminUserAccountText" type="text" selector=".page-header .admin-user-account-text" />
<!-- Legacy heading section. Mostly used for admin 404 and 403 pages -->
<element name="pageHeading" type="text" selector=".page-content .page-heading"/>
</section>
</sections>
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,6 @@
<element name="nthSuccess" type="text" selector=".message.message-success.success:nth-of-type({{n}})>div" parameterized="true"/>
<element name="error" type="text" selector="#messages div.message-error"/>
<element name="notice" type="text" selector=".message.message-notice.notice"/>
<element name="messageByType" type="text" selector="#messages div.message-{{messageType}}" parameterized="true" />
</section>
</sections>
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->

<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd">
<test name="AdminLoginAfterJSMinificationTest">
<annotations>
<features value="Backend"/>
<title value="Admin panel should be accessible with JS minification enabled"/>
<description value="Admin panel should be accessible with JS minification enabled"/>
<testCaseId value="MC-14104" />
<group value="backend"/>
<group value="mtf_migrated"/>
</annotations>
<before>
<magentoCLI command="config:set {{MinifyJavaScriptFilesEnableConfigData.path}} {{MinifyJavaScriptFilesEnableConfigData.value}}" stepKey="enableJsMinification"/>
<actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/>
</before>
<after>
<magentoCLI command="config:set {{MinifyJavaScriptFilesDisableConfigData.path}} {{MinifyJavaScriptFilesDisableConfigData.value}}" stepKey="disableJsMinification"/>
<actionGroup ref="logout" stepKey="logout"/>
</after>

<actionGroup ref="AssertAdminSuccessLoginActionGroup" stepKey="loggedInSuccessfully"/>
<actionGroup ref="AssertAdminPageIsNot404ActionGroup" stepKey="dontSee404Page"/>
</test>
</tests>
9 changes: 3 additions & 6 deletions app/code/Magento/Catalog/Block/Product/View.php
Original file line number Diff line number Diff line change
Expand Up @@ -169,8 +169,7 @@ public function getAddToCartUrl($product, $additional = [])
}

/**
* Get JSON encoded configuration array which can be used for JS dynamic
* price calculation depending on product options
* Get JSON encoded configuration which can be used for JS dynamic price calculation depending on product options
*
* @return string
*/
Expand Down Expand Up @@ -262,6 +261,7 @@ public function isStartCustomization()

/**
* Get default qty - either as preconfigured, or as 1.
*
* Also restricts it by minimal qty.
*
* @param null|\Magento\Catalog\Model\Product $product
Expand Down Expand Up @@ -323,10 +323,7 @@ public function getQuantityValidators()
public function getIdentities()
{
$identities = $this->getProduct()->getIdentities();
$category = $this->_coreRegistry->registry('current_category');
if ($category) {
$identities[] = Category::CACHE_TAG . '_' . $category->getId();
}

return $identities;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,9 @@
use Magento\Catalog\Pricing\Price\CustomOptionPriceInterface;

/**
* Product aoptions section abstract block.
* Product options section abstract block.
*
* phpcs:disable Magento2.Classes.AbstractApi
* @api
* @since 100.0.2
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ public function prepareProductAttributes(Product $product, array $productData, a
}

/**
* Reset "Use Config Settings" to false in product data.
*
* @param Product $product
* @param string $attributeCode
* @param array $productData
Expand All @@ -62,6 +64,8 @@ private function prepareConfigData(Product $product, string $attributeCode, arra
}

/**
* Prepare default attribute data for product.
*
* @param array $attributeList
* @param string $attributeCode
* @param array $productData
Expand All @@ -73,7 +77,7 @@ private function prepareDefaultData(array $attributeList, string $attributeCode,
/** @var \Magento\Catalog\Model\ResourceModel\Eav\Attribute $attribute */
$attribute = $attributeList[$attributeCode];
$attributeType = $attribute->getBackendType();
// For non-numberic types set the attributeValue to 'false' to trigger their removal from the db
// For non-numeric types set the attributeValue to 'false' to trigger their removal from the db
if ($attributeType === 'varchar' || $attributeType === 'text' || $attributeType === 'datetime') {
$attribute->setIsRequired(false);
$productData[$attributeCode] = false;
Expand All @@ -86,6 +90,8 @@ private function prepareDefaultData(array $attributeList, string $attributeCode,
}

/**
* Check, whether attribute should not be updated.
*
* @param Product $product
* @param array $useDefaults
* @param string $attribute
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,9 @@

namespace Magento\Catalog\Model\Product\Attribute\Backend\TierPrice;

use Magento\Framework\EntityManager\Operation\ExtensionInterface;
use Magento\Catalog\Api\Data\ProductInterface;
use Magento\Framework\App\ObjectManager;
use Magento\Framework\Locale\FormatInterface;
use Magento\Store\Model\StoreManagerInterface;
use Magento\Catalog\Api\ProductAttributeRepositoryInterface;
use Magento\Customer\Api\GroupManagementInterface;
Expand Down Expand Up @@ -40,26 +41,34 @@ class UpdateHandler extends AbstractHandler
*/
private $tierPriceResource;

/**
* @var FormatInterface
*/
private $localeFormat;

/**
* @param \Magento\Store\Model\StoreManagerInterface $storeManager
* @param \Magento\Catalog\Api\ProductAttributeRepositoryInterface $attributeRepository
* @param \Magento\Customer\Api\GroupManagementInterface $groupManagement
* @param \Magento\Framework\EntityManager\MetadataPool $metadataPool
* @param \Magento\Catalog\Model\ResourceModel\Product\Attribute\Backend\Tierprice $tierPriceResource
* @param FormatInterface|null $localeFormat
*/
public function __construct(
StoreManagerInterface $storeManager,
ProductAttributeRepositoryInterface $attributeRepository,
GroupManagementInterface $groupManagement,
MetadataPool $metadataPool,
Tierprice $tierPriceResource
Tierprice $tierPriceResource,
FormatInterface $localeFormat = null
) {
parent::__construct($groupManagement);

$this->storeManager = $storeManager;
$this->attributeRepository = $attributeRepository;
$this->metadataPoll = $metadataPool;
$this->tierPriceResource = $tierPriceResource;
$this->localeFormat = $localeFormat ?: ObjectManager::getInstance()->get(FormatInterface::class);
}

/**
Expand Down Expand Up @@ -125,8 +134,9 @@ private function updateValues(array $valuesToUpdate, array $oldValues): bool
{
$isChanged = false;
foreach ($valuesToUpdate as $key => $value) {
if ((!empty($value['value']) && (float)$oldValues[$key]['price'] !== (float)$value['value'])
|| $this->getPercentage($oldValues[$key]) !== $this->getPercentage($value)
if ((!empty($value['value'])
&& (float)$oldValues[$key]['price'] !== $this->localeFormat->getNumber($value['value'])
) || $this->getPercentage($oldValues[$key]) !== $this->getPercentage($value)
) {
$price = new \Magento\Framework\DataObject(
[
Expand Down
22 changes: 16 additions & 6 deletions app/code/Magento/Catalog/Model/Product/Option/Type/Select.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@

/**
* Catalog product option select type
*
* @SuppressWarnings(PHPMD.CookieAndSessionMisuse)
*/
class Select extends \Magento\Catalog\Model\Product\Option\Type\DefaultType
{
Expand All @@ -30,23 +32,35 @@ class Select extends \Magento\Catalog\Model\Product\Option\Type\DefaultType
*/
protected $string;

/**
* @var array
*/
private $singleSelectionTypes;

/**
* @param \Magento\Checkout\Model\Session $checkoutSession
* @param \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig
* @param \Magento\Framework\Stdlib\StringUtils $string
* @param \Magento\Framework\Escaper $escaper
* @param array $data
* @param array $singleSelectionTypes
*/
public function __construct(
\Magento\Checkout\Model\Session $checkoutSession,
\Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig,
\Magento\Framework\Stdlib\StringUtils $string,
\Magento\Framework\Escaper $escaper,
array $data = []
array $data = [],
array $singleSelectionTypes = []
) {
$this->string = $string;
$this->_escaper = $escaper;
parent::__construct($checkoutSession, $scopeConfig, $data);

$this->singleSelectionTypes = $singleSelectionTypes ?: [
'drop_down' => \Magento\Catalog\Api\Data\ProductCustomOptionInterface::OPTION_TYPE_DROP_DOWN,
'radio' => \Magento\Catalog\Api\Data\ProductCustomOptionInterface::OPTION_TYPE_RADIO,
];
}

/**
Expand Down Expand Up @@ -310,10 +324,6 @@ public function getOptionSku($optionValue, $skuDelimiter)
*/
protected function _isSingleSelection()
{
$single = [
\Magento\Catalog\Api\Data\ProductCustomOptionInterface::OPTION_TYPE_DROP_DOWN,
\Magento\Catalog\Api\Data\ProductCustomOptionInterface::OPTION_TYPE_RADIO,
];
return in_array($this->getOption()->getType(), $single);
return in_array($this->getOption()->getType(), $this->singleSelectionTypes, true);
}
}
Loading

0 comments on commit 670116c

Please sign in to comment.