Skip to content

Commit a445e1c

Browse files
Merge remote-tracking branch 'remotes/github/MAGETWO-91639' into EPAM-PR-21
2 parents 55ce196 + 8f7940b commit a445e1c

File tree

132 files changed

+2313
-966
lines changed

Some content is hidden

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

132 files changed

+2313
-966
lines changed

app/code/Magento/Analytics/Test/Mftf/Test/AdminConfigurationIndustryTest.xml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,6 @@
1717
<severity value="MAJOR"/>
1818
<testCaseId value="MAGETWO-63898"/>
1919
<group value="analytics"/>
20-
<skip>
21-
<issueId value="MAGETWO-96223"/>
22-
</skip>
2320
</annotations>
2421

2522
<actionGroup ref="LoginActionGroup" stepKey="loginAsAdmin"/>

app/code/Magento/Authorizenet/view/adminhtml/templates/order/view/info/fraud_details.phtml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,8 @@ $fraudDetails = $payment->getAdditionalInformation('fraud_details');
4444
<?php endif; ?>
4545

4646
<?php if(!empty($fraudDetails['fraud_filters'])): ?>
47-
<b><?= $block->escapeHtml(__('Fraud Filters')) ?>:
48-
</b></br>
47+
<strong><?= $block->escapeHtml(__('Fraud Filters')) ?>:
48+
</strong></br>
4949
<?php foreach($fraudDetails['fraud_filters'] as $filter): ?>
5050
<?= $block->escapeHtml($filter['name']) ?>:
5151
<?= $block->escapeHtml($filter['action']) ?>

app/code/Magento/Backup/Test/Mftf/Test/AdminCreateAndDeleteBackupsTest.xml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,7 @@
1818
<testCaseId value="MAGETWO-94176"/>
1919
<group value="backup"/>
2020
<skip>
21-
<issueId value="MQE-1187"/>
22-
<issueId value="DEVOPS-3512"/>
21+
<issueId value="MC-5807"/>
2322
</skip>
2423
</annotations>
2524

app/code/Magento/Bundle/Model/Product/Type.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -823,11 +823,11 @@ private function recursiveIntval(array $array)
823823
private function multiToFlatArray(array $array)
824824
{
825825
$flatArray = [];
826-
foreach ($array as $key => $value) {
826+
foreach ($array as $value) {
827827
if (is_array($value)) {
828828
$flatArray = array_merge($flatArray, $this->multiToFlatArray($value));
829829
} else {
830-
$flatArray[$key] = $value;
830+
$flatArray[] = $value;
831831
}
832832
}
833833

app/code/Magento/Catalog/Block/Product/AbstractProduct.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,7 @@ public function __construct(\Magento\Catalog\Block\Product\Context $context, arr
125125

126126
/**
127127
* Retrieve url for add product to cart
128+
*
128129
* Will return product view page URL if product has required options
129130
*
130131
* @param \Magento\Catalog\Model\Product $product
@@ -473,7 +474,9 @@ public function getProductDetailsHtml(\Magento\Catalog\Model\Product $product)
473474
}
474475

475476
/**
476-
* @param null $type
477+
* Get the renderer that will be used to render the details block
478+
*
479+
* @param string|null $type
477480
* @return bool|\Magento\Framework\View\Element\AbstractBlock
478481
*/
479482
public function getDetailsRenderer($type = null)
@@ -489,6 +492,8 @@ public function getDetailsRenderer($type = null)
489492
}
490493

491494
/**
495+
* Return the list of details
496+
*
492497
* @return \Magento\Framework\View\Element\RendererList
493498
*/
494499
protected function getDetailsRendererList()

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

Lines changed: 54 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,10 @@
66

77
namespace Magento\Catalog\Controller\Adminhtml\Product;
88

9+
use Magento\Backend\App\Action\Context;
910
use Magento\Catalog\Api\AttributeSetRepositoryInterface;
1011
use Magento\Catalog\Api\Data\ProductAttributeInterface;
12+
use Magento\Catalog\Controller\Adminhtml\Product;
1113
use Magento\Eav\Api\AttributeGroupRepositoryInterface;
1214
use Magento\Eav\Api\AttributeManagementInterface;
1315
use Magento\Eav\Api\AttributeRepositoryInterface;
@@ -16,19 +18,25 @@
1618
use Magento\Eav\Api\Data\AttributeInterface;
1719
use Magento\Eav\Api\Data\AttributeSetInterface;
1820
use Magento\Framework\Api\SearchCriteriaBuilder;
21+
use Magento\Framework\App\Action\HttpPostActionInterface;
22+
use Magento\Framework\Controller\Result\Json;
23+
use Magento\Framework\Controller\Result\JsonFactory;
24+
use Magento\Framework\DataObject;
1925
use Magento\Framework\Exception\LocalizedException;
26+
use Magento\Framework\App\ObjectManager;
2027
use Psr\Log\LoggerInterface;
28+
use Magento\Framework\Exception\NoSuchEntityException;
2129
use Magento\Framework\Api\ExtensionAttributesFactory;
2230

2331
/**
2432
* Class AddAttributeToTemplate
2533
*
2634
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
2735
*/
28-
class AddAttributeToTemplate extends \Magento\Catalog\Controller\Adminhtml\Product
36+
class AddAttributeToTemplate extends Product implements HttpPostActionInterface
2937
{
3038
/**
31-
* @var \Magento\Framework\Controller\Result\JsonFactory
39+
* @var JsonFactory
3240
*/
3341
protected $resultJsonFactory;
3442

@@ -75,33 +83,34 @@ class AddAttributeToTemplate extends \Magento\Catalog\Controller\Adminhtml\Produ
7583
/**
7684
* Constructor
7785
*
78-
* @param \Magento\Backend\App\Action\Context $context
86+
* @param Context $context
7987
* @param Builder $productBuilder
80-
* @param \Magento\Framework\Controller\Result\JsonFactory $resultJsonFactory
81-
* @param \Magento\Eav\Api\Data\AttributeGroupInterfaceFactory|null $attributeGroupFactory
88+
* @param JsonFactory $resultJsonFactory
89+
* @param AttributeGroupInterfaceFactory|null $attributeGroupFactory
8290
* @SuppressWarnings(PHPMD.ExcessiveParameterList)
91+
* @SuppressWarnings(PHPMD.LongVariable)
8392
*/
8493
public function __construct(
85-
\Magento\Backend\App\Action\Context $context,
86-
\Magento\Catalog\Controller\Adminhtml\Product\Builder $productBuilder,
87-
\Magento\Framework\Controller\Result\JsonFactory $resultJsonFactory,
88-
\Magento\Eav\Api\Data\AttributeGroupInterfaceFactory $attributeGroupFactory = null
94+
Context $context,
95+
Builder $productBuilder,
96+
JsonFactory $resultJsonFactory,
97+
AttributeGroupInterfaceFactory $attributeGroupFactory = null
8998
) {
9099
parent::__construct($context, $productBuilder);
91100
$this->resultJsonFactory = $resultJsonFactory;
92-
$this->attributeGroupFactory = $attributeGroupFactory ?: \Magento\Framework\App\ObjectManager::getInstance()
93-
->get(\Magento\Eav\Api\Data\AttributeGroupInterfaceFactory::class);
101+
$this->attributeGroupFactory = $attributeGroupFactory ?: ObjectManager::getInstance()
102+
->get(AttributeGroupInterfaceFactory::class);
94103
}
95104

96105
/**
97106
* Add attribute to attribute set
98107
*
99-
* @return \Magento\Framework\Controller\Result\Json
108+
* @return Json
100109
*/
101110
public function execute()
102111
{
103112
$request = $this->getRequest();
104-
$response = new \Magento\Framework\DataObject();
113+
$response = new DataObject();
105114
$response->setError(false);
106115

107116
try {
@@ -124,12 +133,12 @@ public function execute()
124133
->getItems();
125134

126135
if (!$attributeGroupItems) {
127-
throw new \Magento\Framework\Exception\NoSuchEntityException;
136+
throw new NoSuchEntityException;
128137
}
129138

130139
/** @var AttributeGroupInterface $attributeGroup */
131140
$attributeGroup = reset($attributeGroupItems);
132-
} catch (\Magento\Framework\Exception\NoSuchEntityException $e) {
141+
} catch (NoSuchEntityException $e) {
133142
/** @var AttributeGroupInterface $attributeGroup */
134143
$attributeGroup = $this->attributeGroupFactory->create();
135144
}
@@ -176,101 +185,114 @@ public function execute()
176185
* Adding basic filters
177186
*
178187
* @return SearchCriteriaBuilder
179-
* @throws \Magento\Framework\Exception\LocalizedException
188+
* @throws LocalizedException
180189
*/
181190
private function getBasicAttributeSearchCriteriaBuilder()
182191
{
183-
$attributeIds = (array)$this->getRequest()->getParam('attributeIds', []);
192+
$attributeIds = (array) $this->getRequest()->getParam('attributeIds', []);
184193

185194
if (empty($attributeIds['selected'])) {
186195
throw new LocalizedException(__('Attributes were missing and must be specified.'));
187196
}
188197

189198
return $this->getSearchCriteriaBuilder()
190-
->addFilter('attribute_set_id', new \Zend_Db_Expr('null'), 'is')
191199
->addFilter('attribute_id', [$attributeIds['selected']], 'in');
192200
}
193201

194202
/**
203+
* Get AttributeRepositoryInterface
204+
*
195205
* @return AttributeRepositoryInterface
196206
*/
197207
private function getAttributeRepository()
198208
{
199209
if (null === $this->attributeRepository) {
200-
$this->attributeRepository = \Magento\Framework\App\ObjectManager::getInstance()
201-
->get(\Magento\Eav\Api\AttributeRepositoryInterface::class);
210+
$this->attributeRepository = ObjectManager::getInstance()
211+
->get(AttributeRepositoryInterface::class);
202212
}
203213
return $this->attributeRepository;
204214
}
205215

206216
/**
217+
* Get AttributeSetRepositoryInterface
218+
*
207219
* @return AttributeSetRepositoryInterface
208220
*/
209221
private function getAttributeSetRepository()
210222
{
211223
if (null === $this->attributeSetRepository) {
212-
$this->attributeSetRepository = \Magento\Framework\App\ObjectManager::getInstance()
213-
->get(\Magento\Catalog\Api\AttributeSetRepositoryInterface::class);
224+
$this->attributeSetRepository = ObjectManager::getInstance()
225+
->get(AttributeSetRepositoryInterface::class);
214226
}
215227
return $this->attributeSetRepository;
216228
}
217229

218230
/**
231+
* Get AttributeGroupInterface
232+
*
219233
* @return AttributeGroupRepositoryInterface
220234
*/
221235
private function getAttributeGroupRepository()
222236
{
223237
if (null === $this->attributeGroupRepository) {
224-
$this->attributeGroupRepository = \Magento\Framework\App\ObjectManager::getInstance()
225-
->get(\Magento\Eav\Api\AttributeGroupRepositoryInterface::class);
238+
$this->attributeGroupRepository = ObjectManager::getInstance()
239+
->get(AttributeGroupRepositoryInterface::class);
226240
}
227241
return $this->attributeGroupRepository;
228242
}
229243

230244
/**
245+
* Get SearchCriteriaBuilder
246+
*
231247
* @return SearchCriteriaBuilder
232248
*/
233249
private function getSearchCriteriaBuilder()
234250
{
235251
if (null === $this->searchCriteriaBuilder) {
236-
$this->searchCriteriaBuilder = \Magento\Framework\App\ObjectManager::getInstance()
237-
->get(\Magento\Framework\Api\SearchCriteriaBuilder::class);
252+
$this->searchCriteriaBuilder = ObjectManager::getInstance()
253+
->get(SearchCriteriaBuilder::class);
238254
}
239255
return $this->searchCriteriaBuilder;
240256
}
241257

242258
/**
259+
* Get AttributeManagementInterface
260+
*
243261
* @return AttributeManagementInterface
244262
*/
245263
private function getAttributeManagement()
246264
{
247265
if (null === $this->attributeManagement) {
248-
$this->attributeManagement = \Magento\Framework\App\ObjectManager::getInstance()
249-
->get(\Magento\Eav\Api\AttributeManagementInterface::class);
266+
$this->attributeManagement = ObjectManager::getInstance()
267+
->get(AttributeManagementInterface::class);
250268
}
251269
return $this->attributeManagement;
252270
}
253271

254272
/**
273+
* Get LoggerInterface
274+
*
255275
* @return LoggerInterface
256276
*/
257277
private function getLogger()
258278
{
259279
if (null === $this->logger) {
260-
$this->logger = \Magento\Framework\App\ObjectManager::getInstance()
261-
->get(\Psr\Log\LoggerInterface::class);
280+
$this->logger = ObjectManager::getInstance()
281+
->get(LoggerInterface::class);
262282
}
263283
return $this->logger;
264284
}
265285

266286
/**
287+
* Get ExtensionAttributesFactory.
288+
*
267289
* @return ExtensionAttributesFactory
268290
*/
269291
private function getExtensionAttributesFactory()
270292
{
271293
if (null === $this->extensionAttributesFactory) {
272-
$this->extensionAttributesFactory = \Magento\Framework\App\ObjectManager::getInstance()
273-
->get(\Magento\Framework\Api\ExtensionAttributesFactory::class);
294+
$this->extensionAttributesFactory = ObjectManager::getInstance()
295+
->get(ExtensionAttributesFactory::class);
274296
}
275297
return $this->extensionAttributesFactory;
276298
}

app/code/Magento/Catalog/Controller/Adminhtml/Product/Attribute/Validate.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ public function execute()
105105
$attributeCode
106106
);
107107

108-
if ($attribute->getId() && !$attributeId) {
108+
if ($attribute->getId() && !$attributeId || $attributeCode === 'product_type') {
109109
$message = strlen($this->getRequest()->getParam('attribute_code'))
110110
? __('An attribute with this code already exists.')
111111
: __('An attribute with the same code (%1) already exists.', $attributeCode);

app/code/Magento/Catalog/Helper/Product/Compare.php

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,15 @@ public function getListUrl()
166166
*/
167167
public function getPostDataParams($product)
168168
{
169-
return $this->postHelper->getPostData($this->getAddUrl(), ['product' => $product->getId()]);
169+
$params = ['product' => $product->getId()];
170+
$requestingPageUrl = $this->_getRequest()->getParam('requesting_page_url');
171+
172+
if (!empty($requestingPageUrl)) {
173+
$encodedUrl = $this->urlEncoder->encode($requestingPageUrl);
174+
$params[\Magento\Framework\App\ActionInterface::PARAM_NAME_URL_ENCODED] = $encodedUrl;
175+
}
176+
177+
return $this->postHelper->getPostData($this->getAddUrl(), $params);
170178
}
171179

172180
/**

0 commit comments

Comments
 (0)