Skip to content

Commit

Permalink
Merge remote-tracking branch 'mainline/2.2-develop' into 2.2-develop-…
Browse files Browse the repository at this point in the history
…bp-20936
  • Loading branch information
nmalevanec committed Mar 21, 2019
2 parents dd3a94a + ae34e60 commit 5c8dba8
Show file tree
Hide file tree
Showing 34 changed files with 280 additions and 99 deletions.
10 changes: 5 additions & 5 deletions app/code/Magento/Backend/etc/adminhtml/system.xml
Original file line number Diff line number Diff line change
Expand Up @@ -153,27 +153,27 @@
</group>
<group id="js" translate="label" type="text" sortOrder="100" showInDefault="1" showInWebsite="1" showInStore="1">
<label>JavaScript Settings</label>
<field id="merge_files" translate="label" type="select" sortOrder="10" showInDefault="1" showInWebsite="1" showInStore="1">
<field id="merge_files" translate="label" type="select" sortOrder="10" showInDefault="1" showInWebsite="1" showInStore="1" canRestore="1">
<label>Merge JavaScript Files</label>
<source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
</field>
<field id="enable_js_bundling" translate="label" type="select" sortOrder="10" showInDefault="1" showInWebsite="1" showInStore="1">
<field id="enable_js_bundling" translate="label" type="select" sortOrder="10" showInDefault="1" showInWebsite="1" showInStore="1" canRestore="1">
<label>Enable JavaScript Bundling</label>
<source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
</field>
<field id="minify_files" translate="label comment" type="select" sortOrder="20" showInDefault="1" showInWebsite="1" showInStore="1">
<field id="minify_files" translate="label comment" type="select" sortOrder="20" showInDefault="1" showInWebsite="1" showInStore="1" canRestore="1">
<label>Minify JavaScript Files</label>
<source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
<comment>Minification is not applied in developer mode.</comment>
</field>
</group>
<group id="css" translate="label" type="text" sortOrder="110" showInDefault="1" showInWebsite="1" showInStore="1">
<label>CSS Settings</label>
<field id="merge_css_files" translate="label" type="select" sortOrder="10" showInDefault="1" showInWebsite="1" showInStore="1">
<field id="merge_css_files" translate="label" type="select" sortOrder="10" showInDefault="1" showInWebsite="1" showInStore="1" canRestore="1">
<label>Merge CSS Files</label>
<source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
</field>
<field id="minify_files" translate="label comment" type="select" sortOrder="20" showInDefault="1" showInWebsite="1" showInStore="1">
<field id="minify_files" translate="label comment" type="select" sortOrder="20" showInDefault="1" showInWebsite="1" showInStore="1" canRestore="1">
<label>Minify CSS Files</label>
<source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
<comment>Minification is not applied in developer mode.</comment>
Expand Down
2 changes: 1 addition & 1 deletion app/code/Magento/CatalogInventory/etc/di.xml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
</type>
<type name="Magento\CatalogInventory\Observer\UpdateItemsStockUponConfigChangeObserver">
<arguments>
<argument name="resourceStock" xsi:type="object">Magento\CatalogInventory\Model\ResourceModel\Stock\Proxy</argument>
<argument name="resourceStockItem" xsi:type="object">Magento\CatalogInventory\Model\ResourceModel\Stock\Item\Proxy</argument>
</arguments>
</type>
<type name="Magento\Catalog\Model\Layer">
Expand Down
103 changes: 103 additions & 0 deletions app/code/Magento/CatalogWidget/Setup/UpgradeData.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
declare(strict_types=1);

namespace Magento\CatalogWidget\Setup;

use Magento\CatalogWidget\Block\Product\ProductsList;
use Magento\CatalogWidget\Model\Rule\Condition\Product as ConditionProduct;
use Magento\Framework\Serialize\Serializer\Json as Serializer;
use Magento\Framework\Setup\ModuleContextInterface;
use Magento\Framework\Setup\ModuleDataSetupInterface;
use Magento\Framework\Setup\UpgradeDataInterface;

/**
* Upgrade data for CatalogWidget module.
*/
class UpgradeData implements UpgradeDataInterface
{
/**
* @var Serializer
*/
private $serializer;

/**
* @param Serializer $serializer
*/
public function __construct(
Serializer $serializer
) {
$this->serializer = $serializer;
}

/**
* @inheritdoc
*/
public function upgrade(ModuleDataSetupInterface $setup, ModuleContextInterface $context)
{
if (version_compare($context->getVersion(), '2.0.1', '<')) {
$this->replaceIsWithIsOneOf($setup);
}
}

/**
* Replace 'is' condition with 'is one of' in database.
*
* If 'is' product list condition is used with multiple skus it should be replaced by 'is one of' condition.
*
* @param ModuleDataSetupInterface $setup
*/
private function replaceIsWithIsOneOf(ModuleDataSetupInterface $setup)
{
$tableName = $setup->getTable('widget_instance');
$connection = $setup->getConnection();
$select = $connection->select()
->from(
$tableName,
[
'instance_id',
'widget_parameters',
]
)->where('instance_type = ? ', ProductsList::class);

$result = $setup->getConnection()->fetchAll($select);

if ($result) {
$updatedData = $this->updateWidgetData($result);

$connection->insertOnDuplicate(
$tableName,
$updatedData
);
}
}

/**
* Replace 'is' condition with 'is one of' in widget parameters.
*
* @param array $result
* @return array
*/
private function updateWidgetData(array $result): array
{
return array_map(
function ($widgetData) {
$widgetParameters = $this->serializer->unserialize($widgetData['widget_parameters']);
foreach ($widgetParameters['conditions'] as &$condition) {
if (ConditionProduct::class === $condition['type'] &&
'sku' === $condition['attribute'] &&
'==' === $condition['operator']) {
$condition['operator'] = '()';
}
}
$widgetData['widget_parameters'] = $this->serializer->serialize($widgetParameters);

return $widgetData;
},
$result
);
}
}
2 changes: 1 addition & 1 deletion app/code/Magento/CatalogWidget/etc/module.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
*/
-->
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
<module name="Magento_CatalogWidget" setup_version="2.0.0">
<module name="Magento_CatalogWidget" setup_version="2.0.1">
<sequence>
<module name="Magento_Catalog"/>
<module name="Magento_Widget"/>
Expand Down
3 changes: 0 additions & 3 deletions app/code/Magento/Checkout/etc/di.xml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,4 @@
</argument>
</arguments>
</type>
<type name="Magento\Quote\Model\Quote">
<plugin name="clear_addresses_after_product_delete" type="Magento\Checkout\Plugin\Model\Quote\ResetQuoteAddresses"/>
</type>
</config>
3 changes: 3 additions & 0 deletions app/code/Magento/Checkout/etc/frontend/di.xml
Original file line number Diff line number Diff line change
Expand Up @@ -96,4 +96,7 @@
</argument>
</arguments>
</type>
<type name="Magento\Quote\Model\Quote">
<plugin name="clear_addresses_after_product_delete" type="Magento\Checkout\Plugin\Model\Quote\ResetQuoteAddresses"/>
</type>
</config>
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,17 @@
*/
-->
<div data-role="checkout-agreements">
<div class="checkout-agreements" data-bind="visible: isVisible">
<div class="checkout-agreements fieldset" data-bind="visible: isVisible">
<!-- ko foreach: agreements -->
<!-- ko if: ($parent.isAgreementRequired($data)) -->
<div class="checkout-agreement required">
<div class="checkout-agreement field choice required">
<input type="checkbox" class="required-entry"
data-bind="attr: {
'id': $parent.getCheckboxId($parentContext, agreementId),
'name': 'agreement[' + agreementId + ']',
'value': agreementId
}"/>
<label data-bind="attr: {'for': $parent.getCheckboxId($parentContext, agreementId)}">
<label class="label" data-bind="attr: {'for': $parent.getCheckboxId($parentContext, agreementId)}">
<button type="button"
class="action action-show"
data-bind="click: function(data, event) { return $parent.showContent(data, event) }"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,24 @@
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/

namespace Magento\Downloadable\Ui\DataProvider\Product\Form\Modifier;

use Magento\Catalog\Ui\DataProvider\Product\Form\Modifier\AbstractModifier;
use Magento\Catalog\Model\Locator\LocatorInterface;
use Magento\Catalog\Ui\DataProvider\Product\Form\Modifier\AbstractModifier;
use Magento\Downloadable\Model\Product\Type;
use Magento\Downloadable\Model\Source\TypeUpload;
use Magento\Downloadable\Model\Source\Shareable;
use Magento\Store\Model\StoreManagerInterface;
use Magento\Downloadable\Model\Source\TypeUpload;
use Magento\Framework\Stdlib\ArrayManager;
use Magento\Ui\Component\DynamicRows;
use Magento\Framework\UrlInterface;
use Magento\Store\Model\StoreManagerInterface;
use Magento\Ui\Component\Container;
use Magento\Ui\Component\DynamicRows;
use Magento\Ui\Component\Form;

/**
* Class adds a grid with links
* Class adds a grid with links.
*
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
*/
class Links extends AbstractModifier
Expand Down Expand Up @@ -86,7 +88,7 @@ public function __construct(
}

/**
* {@inheritdoc}
* @inheritdoc
*/
public function modifyData(array $data)
{
Expand All @@ -101,7 +103,7 @@ public function modifyData(array $data)
}

/**
* {@inheritdoc}
* @inheritdoc
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
*/
public function modifyMeta(array $meta)
Expand Down Expand Up @@ -160,6 +162,8 @@ public function modifyMeta(array $meta)
}

/**
* Get dynamic rows meta.
*
* @return array
*/
protected function getDynamicRows()
Expand All @@ -180,6 +184,8 @@ protected function getDynamicRows()
}

/**
* Get single link record meta.
*
* @return array
*/
protected function getRecord()
Expand Down Expand Up @@ -221,6 +227,8 @@ protected function getRecord()
}

/**
* Get link title meta.
*
* @return array
*/
protected function getTitleColumn()
Expand All @@ -232,6 +240,7 @@ protected function getTitleColumn()
'label' => __('Title'),
'showLabel' => false,
'dataScope' => '',
'sortOrder' => 10,
];
$titleField['arguments']['data']['config'] = [
'formElement' => Form\Element\Input::NAME,
Expand All @@ -247,6 +256,8 @@ protected function getTitleColumn()
}

/**
* Get link price meta.
*
* @return array
*/
protected function getPriceColumn()
Expand All @@ -258,6 +269,7 @@ protected function getPriceColumn()
'label' => __('Price'),
'showLabel' => false,
'dataScope' => '',
'sortOrder' => 20,
];
$priceField['arguments']['data']['config'] = [
'formElement' => Form\Element\Input::NAME,
Expand All @@ -281,6 +293,8 @@ protected function getPriceColumn()
}

/**
* Get link file element meta.
*
* @return array
*/
protected function getFileColumn()
Expand All @@ -292,6 +306,7 @@ protected function getFileColumn()
'label' => __('File'),
'showLabel' => false,
'dataScope' => '',
'sortOrder' => 30,
];
$fileTypeField['arguments']['data']['config'] = [
'formElement' => Form\Element\Select::NAME,
Expand Down Expand Up @@ -344,6 +359,8 @@ protected function getFileColumn()
}

/**
* Get sample container meta.
*
* @return array
*/
protected function getSampleColumn()
Expand All @@ -355,6 +372,7 @@ protected function getSampleColumn()
'label' => __('Sample'),
'showLabel' => false,
'dataScope' => '',
'sortOrder' => 40,
];
$sampleTypeField['arguments']['data']['config'] = [
'formElement' => Form\Element\Select::NAME,
Expand Down Expand Up @@ -403,6 +421,8 @@ protected function getSampleColumn()
}

/**
* Get link "is sharable" element meta.
*
* @return array
*/
protected function getShareableColumn()
Expand All @@ -413,13 +433,16 @@ protected function getShareableColumn()
'componentType' => Form\Field::NAME,
'dataType' => Form\Element\DataType\Number::NAME,
'dataScope' => 'is_shareable',
'sortOrder' => 50,
'options' => $this->shareable->toOptionArray(),
];

return $shareableField;
}

/**
* Get link "max downloads" element meta.
*
* @return array
*/
protected function getMaxDownloadsColumn()
Expand All @@ -431,6 +454,7 @@ protected function getMaxDownloadsColumn()
'label' => __('Max. Downloads'),
'showLabel' => false,
'dataScope' => '',
'sortOrder' => 60,
];
$numberOfDownloadsField['arguments']['data']['config'] = [
'formElement' => Form\Element\Input::NAME,
Expand Down
Loading

0 comments on commit 5c8dba8

Please sign in to comment.