Skip to content

Commit 1df7174

Browse files
author
Oleksandr Karpenko
committed
Merge branch 'develop' of https://github.corp.magento.com/magento2/magento2ce into BUGS
2 parents e70a157 + 3cc19fe commit 1df7174

File tree

140 files changed

+4618
-1353
lines changed

Some content is hidden

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

140 files changed

+4618
-1353
lines changed

app/code/Magento/Backend/Block/Store/Switcher.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ class Switcher extends \Magento\Backend\Block\Template
1616
/**
1717
* URL for store switcher hint
1818
*/
19-
const HINT_URL = 'http://docs.magento.com/m2/ce/user_guide/stores/configuration.html';
19+
const HINT_URL = 'http://docs.magento.com/m2/ce/user_guide/configuration/scope.html';
2020

2121
/**
2222
* Name of website variable

app/code/Magento/Backend/view/adminhtml/templates/admin/login.phtml

Lines changed: 28 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -10,38 +10,41 @@
1010

1111
<form method="post" action="" id="login-form" data-mage-init='{"form": {}, "validation": {}}' autocomplete="off">
1212
<fieldset class="admin__fieldset">
13-
<legend class="admin__legend"><span><?php /* @escapeNotVerified */ echo __('Welcome, please sign in') ?></span></legend><br/>
13+
<legend class="admin__legend">
14+
<span><?php /* @escapeNotVerified */ echo __('Welcome, please sign in') ?></span>
15+
</legend><br/>
1416
<input name="form_key" type="hidden" value="<?php /* @escapeNotVerified */ echo $block->getFormKey() ?>" />
1517
<div class="admin__field _required field-username">
16-
<label for="username" class="admin__field-label"><span><?php /* @escapeNotVerified */ echo __('Username') ?></span></label>
18+
<label for="username" class="admin__field-label">
19+
<span><?php /* @escapeNotVerified */ echo __('Username') ?></span>
20+
</label>
1721
<div class="admin__field-control">
18-
<input
19-
id="username"
20-
class="admin__control-text"
21-
type="text"
22-
name="login[username]"
23-
autofocus
24-
value=""
25-
data-validate="{required:true}"
26-
placeholder="<?php /* @escapeNotVerified */ echo __('user name') ?>"/>
22+
<input id="username"
23+
class="admin__control-text"
24+
type="text"
25+
name="login[username]"
26+
autofocus
27+
value=""
28+
data-validate="{required:true}"
29+
placeholder="<?php /* @escapeNotVerified */ echo __('user name') ?>"
30+
autocomplete="username"
31+
/>
2732
</div>
2833
</div>
2934
<div class="admin__field _required field-password">
30-
<label for="login" class="admin__field-label"><span><?php /* @escapeNotVerified */ echo __('Password') ?></span></label>
35+
<label for="login" class="admin__field-label">
36+
<span><?php /* @escapeNotVerified */ echo __('Password') ?></span>
37+
</label>
3138
<div class="admin__field-control">
32-
<!-- This is a dummy hidden field to trick firefox from auto filling the password -->
33-
<input
34-
id="dummy"
35-
class="admin__control-dummy"
36-
type="text"
37-
name="dummy"/>
38-
<input
39-
id="login"
40-
class="admin__control-text"
41-
type="password"
42-
name="login[password]"
43-
data-validate="{required:true}"
44-
value="" placeholder="<?php /* @escapeNotVerified */ echo __('password') ?>" />
39+
<input id="login"
40+
class="admin__control-text"
41+
type="password"
42+
name="login[password]"
43+
data-validate="{required:true}"
44+
value=""
45+
placeholder="<?php /* @escapeNotVerified */ echo __('password') ?>"
46+
autocomplete="current-password"
47+
/>
4548
</div>
4649
</div>
4750
<?php echo $block->getChildHtml('form.additional.info'); ?>
Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
<?php
2+
/**
3+
* Copyright © 2016 Magento. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
namespace Magento\Bundle\Setup;
7+
8+
use Magento\Framework\Setup\ExternalFKSetup;
9+
use Magento\Framework\Setup\InstallSchemaInterface;
10+
use Magento\Framework\Setup\ModuleContextInterface;
11+
use Magento\Framework\Setup\SchemaSetupInterface;
12+
use Magento\Framework\Model\Entity\MetadataPool;
13+
use Magento\Catalog\Api\Data\ProductInterface;
14+
15+
/**
16+
* @codeCoverageIgnore
17+
*/
18+
class Recurring implements InstallSchemaInterface
19+
{
20+
/**
21+
* @var MetadataPool
22+
*/
23+
protected $metadataPool;
24+
25+
/**
26+
* @var ExternalFKSetup
27+
*/
28+
protected $externalFKSetup;
29+
30+
/**
31+
* @param MetadataPool $metadataPool
32+
* @param ExternalFKSetup $externalFKSetup
33+
*/
34+
public function __construct(
35+
MetadataPool $metadataPool,
36+
ExternalFKSetup $externalFKSetup
37+
) {
38+
$this->metadataPool = $metadataPool;
39+
$this->externalFKSetup = $externalFKSetup;
40+
}
41+
42+
/**
43+
* {@inheritdoc}
44+
*/
45+
public function install(SchemaSetupInterface $setup, ModuleContextInterface $context)
46+
{
47+
$installer = $setup;
48+
$installer->startSetup();
49+
50+
$listTables = [
51+
'catalog_product_bundle_price_index' => 'entity_id',
52+
'catalog_product_bundle_selection' => 'product_id',
53+
];
54+
foreach ($listTables as $tableName => $columnName) {
55+
$this->addExternalForeignKeys($installer, $tableName, $columnName);
56+
}
57+
58+
$installer->endSetup();
59+
}
60+
61+
/**
62+
* Add external foreign keys
63+
*
64+
* @param SchemaSetupInterface $installer
65+
* @param string $tableName
66+
* @param string $columnName
67+
* @return void
68+
* @throws \Exception
69+
*/
70+
protected function addExternalForeignKeys(SchemaSetupInterface $installer, $tableName, $columnName)
71+
{
72+
$metadata = $this->metadataPool->getMetadata(ProductInterface::class);
73+
$this->externalFKSetup->install(
74+
$installer,
75+
$metadata->getEntityTable(),
76+
$metadata->getIdentifierField(),
77+
$tableName,
78+
$columnName
79+
);
80+
}
81+
}

app/code/Magento/Catalog/Controller/Adminhtml/Category/Edit.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,9 @@ public function __construct(
5252
public function execute()
5353
{
5454
$storeId = (int)$this->getRequest()->getParam('store');
55+
$store = $this->storeManager->getStore($storeId);
56+
$this->storeManager->setCurrentStore($store->getCode());
57+
5558
$categoryId = (int)$this->getRequest()->getParam('id');
5659

5760
if (!$categoryId) {

app/code/Magento/Catalog/Controller/Adminhtml/Category/Save.php

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
*/
66
namespace Magento\Catalog\Controller\Adminhtml\Category;
77

8+
use Magento\Store\Model\StoreManagerInterface;
9+
810
/**
911
* Class Save
1012
*
@@ -43,24 +45,32 @@ class Save extends \Magento\Catalog\Controller\Adminhtml\Category
4345
]
4446
];
4547

48+
/**
49+
* @var StoreManagerInterface
50+
*/
51+
private $storeManager;
52+
4653
/**
4754
* Constructor
4855
*
4956
* @param \Magento\Backend\App\Action\Context $context
5057
* @param \Magento\Framework\Controller\Result\RawFactory $resultRawFactory
5158
* @param \Magento\Framework\Controller\Result\JsonFactory $resultJsonFactory
5259
* @param \Magento\Framework\View\LayoutFactory $layoutFactory
60+
* @param StoreManagerInterface $storeManager
5361
*/
5462
public function __construct(
5563
\Magento\Backend\App\Action\Context $context,
5664
\Magento\Framework\Controller\Result\RawFactory $resultRawFactory,
5765
\Magento\Framework\Controller\Result\JsonFactory $resultJsonFactory,
58-
\Magento\Framework\View\LayoutFactory $layoutFactory
66+
\Magento\Framework\View\LayoutFactory $layoutFactory,
67+
StoreManagerInterface $storeManager
5968
) {
6069
parent::__construct($context);
6170
$this->resultRawFactory = $resultRawFactory;
6271
$this->resultJsonFactory = $resultJsonFactory;
6372
$this->layoutFactory = $layoutFactory;
73+
$this->storeManager = $storeManager;
6474
}
6575

6676
/**
@@ -104,6 +114,8 @@ public function execute()
104114
$data = $this->stringToBoolConverting($data);
105115
$data = $this->imagePreprocessing($data);
106116
$storeId = isset($data['general']['store_id']) ? $data['general']['store_id'] : null;
117+
$store = $this->storeManager->getStore($storeId);
118+
$this->storeManager->setCurrentStore($store->getCode());
107119
$parentId = isset($data['general']['parent']) ? $data['general']['parent'] : null;
108120
if ($data['general']) {
109121
$category->addData($this->_filterCategoryPostData($data['general']));
@@ -163,6 +175,7 @@ public function execute()
163175
if ($category->hasCustomDesignTo()) {
164176
$categoryResource->getAttribute('custom_design_from')->setMaxValue($category->getCustomDesignTo());
165177
}
178+
166179
$validate = $category->validate();
167180
if ($validate !== true) {
168181
foreach ($validate as $code => $error) {

app/code/Magento/Catalog/Controller/Adminhtml/Product/AddAttributeToTemplate.php

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
use Magento\Framework\Api\SortOrderBuilder;
2020
use Magento\Framework\Exception\LocalizedException;
2121
use Psr\Log\LoggerInterface;
22+
use Magento\Framework\Api\ExtensionAttributesFactory;
2223

2324
/**
2425
* Class AddAttributeToTemplate
@@ -72,6 +73,11 @@ class AddAttributeToTemplate extends \Magento\Catalog\Controller\Adminhtml\Produ
7273
*/
7374
protected $logger;
7475

76+
/**
77+
* @var ExtensionAttributesFactory
78+
*/
79+
protected $extensionAttributesFactory;
80+
7581
/**
7682
* @param \Magento\Backend\App\Action\Context $context
7783
* @param Builder $productBuilder
@@ -84,6 +90,7 @@ class AddAttributeToTemplate extends \Magento\Catalog\Controller\Adminhtml\Produ
8490
* @param SortOrderBuilder $sortOrderBuilder
8591
* @param AttributeManagementInterface $attributeManagement
8692
* @param LoggerInterface $logger
93+
* @param ExtensionAttributesFactory $extensionAttributesFactory
8794
* @SuppressWarnings(PHPMD.ExcessiveParameterList)
8895
*/
8996
public function __construct(
@@ -97,7 +104,8 @@ public function __construct(
97104
SearchCriteriaBuilder $searchCriteriaBuilder,
98105
SortOrderBuilder $sortOrderBuilder,
99106
AttributeManagementInterface $attributeManagement,
100-
LoggerInterface $logger
107+
LoggerInterface $logger,
108+
ExtensionAttributesFactory $extensionAttributesFactory
101109
) {
102110
parent::__construct($context, $productBuilder);
103111
$this->resultJsonFactory = $resultJsonFactory;
@@ -109,6 +117,7 @@ public function __construct(
109117
$this->sortOrderBuilder = $sortOrderBuilder;
110118
$this->attributeManagement = $attributeManagement;
111119
$this->logger = $logger;
120+
$this->extensionAttributesFactory = $extensionAttributesFactory;
112121
}
113122

114123
/**
@@ -153,10 +162,14 @@ public function execute()
153162
$attributeGroup = $this->attributeGroupFactory->create();
154163
}
155164

156-
$attributeGroup->setAttributeGroupCode($groupCode);
157-
$attributeGroup->setSortOrder($groupSortOrder);
165+
$extensionAttributes = $attributeGroup->getExtensionAttributes()
166+
?: $this->extensionAttributesFactory->create(AttributeGroupInterface::class);
167+
168+
$extensionAttributes->setAttributeGroupCode($groupCode);
169+
$extensionAttributes->setSortOrder($groupSortOrder);
158170
$attributeGroup->setAttributeGroupName($groupName);
159171
$attributeGroup->setAttributeSetId($attributeSet->getAttributeSetId());
172+
$attributeGroup->setExtensionAttributes($extensionAttributes);
160173

161174
$this->attributeGroupRepository->save($attributeGroup);
162175

app/code/Magento/Catalog/Controller/Adminhtml/Product/Edit.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,11 @@ public function __construct(
4141
*/
4242
public function execute()
4343
{
44+
/** @var \Magento\Store\Model\StoreManagerInterface $storeManager */
45+
$storeManager = $this->_objectManager->get('Magento\Store\Model\StoreManagerInterface');
46+
$storeId = (int) $this->getRequest()->getParam('store', 0);
47+
$store = $storeManager->getStore($storeId);
48+
$storeManager->setCurrentStore($store->getCode());
4449
$productId = (int) $this->getRequest()->getParam('id');
4550
$product = $this->productBuilder->build($this->getRequest());
4651

app/code/Magento/Catalog/Controller/Adminhtml/Product/Initialization/Helper.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ public function initialize(\Magento\Catalog\Model\Product $product)
156156
$product->lockAttribute('media');
157157
}
158158

159-
if ($this->storeManager->hasSingleStore()) {
159+
if ($this->storeManager->hasSingleStore() && empty($product->getWebsiteIds())) {
160160
$product->setWebsiteIds([$this->storeManager->getStore(true)->getWebsite()->getId()]);
161161
}
162162

app/code/Magento/Catalog/Controller/Adminhtml/Product/Save.php

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88

99
use Magento\Backend\App\Action;
1010
use Magento\Catalog\Controller\Adminhtml\Product;
11+
use Magento\Store\Model\StoreManagerInterface;
1112

1213
class Save extends \Magento\Catalog\Controller\Adminhtml\Product
1314
{
@@ -37,13 +38,21 @@ class Save extends \Magento\Catalog\Controller\Adminhtml\Product
3738
protected $productRepository;
3839

3940
/**
41+
* @var StoreManagerInterface
42+
*/
43+
private $storeManager;
44+
45+
/**
46+
* Save constructor.
47+
*
4048
* @param Action\Context $context
4149
* @param Builder $productBuilder
4250
* @param Initialization\Helper $initializationHelper
4351
* @param \Magento\Catalog\Model\Product\Copier $productCopier
4452
* @param \Magento\Catalog\Model\Product\TypeTransitionManager $productTypeManager
4553
* @param \Magento\Catalog\Api\CategoryLinkManagementInterface $categoryLinkManagement
4654
* @param \Magento\Catalog\Api\ProductRepositoryInterface $productRepository
55+
* @param StoreManagerInterface $storeManager
4756
*/
4857
public function __construct(
4958
\Magento\Backend\App\Action\Context $context,
@@ -52,13 +61,15 @@ public function __construct(
5261
\Magento\Catalog\Model\Product\Copier $productCopier,
5362
\Magento\Catalog\Model\Product\TypeTransitionManager $productTypeManager,
5463
\Magento\Catalog\Api\CategoryLinkManagementInterface $categoryLinkManagement,
55-
\Magento\Catalog\Api\ProductRepositoryInterface $productRepository
64+
\Magento\Catalog\Api\ProductRepositoryInterface $productRepository,
65+
StoreManagerInterface $storeManager
5666
) {
5767
$this->initializationHelper = $initializationHelper;
5868
$this->productCopier = $productCopier;
5969
$this->productTypeManager = $productTypeManager;
6070
$this->categoryLinkManagement = $categoryLinkManagement;
6171
$this->productRepository = $productRepository;
72+
$this->storeManager = $storeManager;
6273
parent::__construct($context, $productBuilder);
6374
}
6475

@@ -71,7 +82,9 @@ public function __construct(
7182
*/
7283
public function execute()
7384
{
74-
$storeId = $this->getRequest()->getParam('store');
85+
$storeId = $this->getRequest()->getParam('store', 0);
86+
$store = $this->storeManager->getStore($storeId);
87+
$this->storeManager->setCurrentStore($store->getCode());
7588
$redirectBack = $this->getRequest()->getParam('back', false);
7689
$productId = $this->getRequest()->getParam('id');
7790
$resultRedirect = $this->resultRedirectFactory->create();

app/code/Magento/Catalog/Model/Category/Attribute/Backend/Sortby.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,12 @@ public function afterLoad($object)
116116
if ($attributeCode == 'available_sort_by') {
117117
$data = $object->getData($attributeCode);
118118
if ($data) {
119-
$object->setData($attributeCode, explode(',', $data));
119+
if (!is_array($data)) {
120+
$object->setData($attributeCode, explode(',', $data));
121+
} else {
122+
$object->setData($attributeCode, $data);
123+
}
124+
120125
}
121126
}
122127
return $this;

0 commit comments

Comments
 (0)