Skip to content

Commit a2f2893

Browse files
duhonvzabaznov
authored andcommitted
MAGETWO-69073: Functional Improvements for Magento 2.1.7
1 parent b8b698b commit a2f2893

File tree

123 files changed

+12400
-8780
lines changed

Some content is hidden

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

123 files changed

+12400
-8780
lines changed

app/code/Magento/Authorizenet/Controller/Directpost/Payment/BackendResponse.php

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,48 @@
66
*/
77
namespace Magento\Authorizenet\Controller\Directpost\Payment;
88

9+
use Magento\Authorizenet\Helper\DataFactory;
10+
use Magento\Authorizenet\Model\Directpost;
11+
use Magento\Authorizenet\Model\DirectpostFactory;
12+
use Magento\Framework\App\Action\Context;
13+
use Magento\Framework\Controller\ResultFactory;
14+
use Magento\Framework\Exception\LocalizedException;
15+
use Magento\Framework\Registry;
16+
use Psr\Log\LoggerInterface;
17+
918
class BackendResponse extends \Magento\Authorizenet\Controller\Directpost\Payment
1019
{
20+
/**
21+
* @var LoggerInterface
22+
*/
23+
private $logger;
24+
25+
/**
26+
* @var DirectpostFactory
27+
*/
28+
private $directpostFactory;
29+
30+
/**
31+
* BackendResponse constructor.
32+
*
33+
* @param Context $context
34+
* @param Registry $coreRegistry
35+
* @param DataFactory $dataFactory
36+
* @param DirectpostFactory $directpostFactory
37+
* @param LoggerInterface|null $logger
38+
*/
39+
public function __construct(
40+
Context $context,
41+
Registry $coreRegistry,
42+
DataFactory $dataFactory,
43+
DirectpostFactory $directpostFactory = null,
44+
LoggerInterface $logger = null
45+
) {
46+
parent::__construct($context, $coreRegistry, $dataFactory);
47+
$this->directpostFactory = $directpostFactory ?: $this->_objectManager->create(DirectpostFactory::class);
48+
$this->logger = $logger ?: $this->_objectManager->get(LoggerInterface::class);
49+
}
50+
1151
/**
1252
* Response action.
1353
* Action for Authorize.net SIM Relay Request.
@@ -16,6 +56,21 @@ class BackendResponse extends \Magento\Authorizenet\Controller\Directpost\Paymen
1656
*/
1757
public function execute()
1858
{
59+
$data = $this->getRequest()->getParams();
60+
/** @var Directpost $paymentMethod */
61+
$paymentMethod = $this->directpostFactory->create();
62+
if (!empty($data['store_id'])) {
63+
$paymentMethod->setStore($data['store_id']);
64+
}
65+
$paymentMethod->setResponseData($data);
66+
try {
67+
$paymentMethod->validateResponse();
68+
} catch (LocalizedException $e) {
69+
$this->logger->critical($e->getMessage());
70+
$this->_redirect('noroute');
71+
return;
72+
}
1973
$this->_responseAction('adminhtml');
74+
$this->resultFactory->create(ResultFactory::TYPE_PAGE);
2075
}
2176
}

app/code/Magento/Braintree/view/adminhtml/ui_component/braintree_report.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
<item name="deps" xsi:type="string">braintree_report.braintree_report_data_source</item>
1313
</item>
1414
<item name="spinner" xsi:type="string">braintree_report_columns</item>
15+
<item name="acl" xsi:type="string">Magento_Braintree::settlement_report</item>
1516
</argument>
1617
<dataSource name="braintree_report_data_source">
1718
<argument name="dataProvider" xsi:type="configurableObject">

app/code/Magento/Braintree/view/adminhtml/web/js/vault.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ define([
109109

110110
$('body').trigger('processStart');
111111

112-
$.get(self.nonceUrl, {
112+
$.getJSON(self.nonceUrl, {
113113
'public_hash': self.publicHash
114114
}).done(function (response) {
115115
self.setPaymentDetails(response.paymentMethodNonce);

app/code/Magento/Braintree/view/frontend/web/js/view/payment/method-renderer/paypal-vault.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ define([
4949
var self = this;
5050

5151
fullScreenLoader.startLoader();
52-
$.get(self.nonceUrl, {
52+
$.getJSON(self.nonceUrl, {
5353
'public_hash': self.publicHash
5454
})
5555
.done(function (response) {

app/code/Magento/Braintree/view/frontend/web/js/view/payment/method-renderer/vault.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ define([
6969
var self = this;
7070

7171
fullScreenLoader.startLoader();
72-
$.get(self.nonceUrl, {
72+
$.getJSON(self.nonceUrl, {
7373
'public_hash': self.publicHash
7474
})
7575
.done(function (response) {

app/code/Magento/Bundle/view/adminhtml/ui_component/bundle_product_listing.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
<item name="deps" xsi:type="string">bundle_product_listing.bundle_product_listing_data_source</item>
1313
</item>
1414
<item name="spinner" xsi:type="string">product_columns</item>
15+
<item name="acl" xsi:type="string">Magento_Catalog::products</item>
1516
</argument>
1617
<dataSource name="bundle_product_listing_data_source">
1718
<argument name="dataProvider" xsi:type="configurableObject">

app/code/Magento/Catalog/Block/Product/View/Attributes.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
namespace Magento\Catalog\Block\Product\View;
1313

1414
use Magento\Catalog\Model\Product;
15+
use Magento\Framework\Phrase;
1516
use Magento\Framework\Pricing\PriceCurrencyInterface;
1617

1718
class Attributes extends \Magento\Framework\View\Element\Template
@@ -86,7 +87,7 @@ public function getAdditionalData(array $excludeAttr = [])
8687
$value = $this->priceCurrency->convertAndFormat($value);
8788
}
8889

89-
if (is_string($value) && strlen($value)) {
90+
if (($value instanceof Phrase || is_string($value)) && strlen($value)) {
9091
$data[$attribute->getAttributeCode()] = [
9192
'label' => __($attribute->getStoreLabel()),
9293
'value' => $value,

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

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,24 +28,34 @@ class NewAction extends \Magento\Catalog\Controller\Adminhtml\Product
2828
*/
2929
protected $resultForwardFactory;
3030

31+
/**
32+
* @var \Magento\Store\Model\StoreManagerInterface
33+
*/
34+
private $storeManager;
35+
3136
/**
3237
* @param Action\Context $context
3338
* @param Builder $productBuilder
3439
* @param Initialization\StockDataFilter $stockFilter
3540
* @param \Magento\Framework\View\Result\PageFactory $resultPageFactory
3641
* @param \Magento\Backend\Model\View\Result\ForwardFactory $resultForwardFactory
42+
* @param \Magento\Store\Model\StoreManagerInterface $storeManager
3743
*/
3844
public function __construct(
3945
\Magento\Backend\App\Action\Context $context,
4046
Product\Builder $productBuilder,
4147
Initialization\StockDataFilter $stockFilter,
4248
\Magento\Framework\View\Result\PageFactory $resultPageFactory,
43-
\Magento\Backend\Model\View\Result\ForwardFactory $resultForwardFactory
49+
\Magento\Backend\Model\View\Result\ForwardFactory $resultForwardFactory,
50+
\Magento\Store\Model\StoreManagerInterface $storeManager = null
4451
) {
4552
$this->stockFilter = $stockFilter;
4653
parent::__construct($context, $productBuilder);
4754
$this->resultPageFactory = $resultPageFactory;
4855
$this->resultForwardFactory = $resultForwardFactory;
56+
$this->storeManager = $storeManager ?: $this->_objectManager->get(
57+
\Magento\Store\Model\StoreManagerInterface::class
58+
);
4959
}
5060

5161
/**
@@ -60,6 +70,10 @@ public function execute()
6070
}
6171

6272
$product = $this->productBuilder->build($this->getRequest());
73+
74+
$store = $this->storeManager->getStore($product->getStoreId());
75+
$this->storeManager->setCurrentStore($store->getCode());
76+
6377
$this->_eventManager->dispatch('catalog_product_new_action', ['product' => $product]);
6478

6579
/** @var \Magento\Backend\Model\View\Result\Page $resultPage */

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

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,37 @@
55
*/
66
namespace Magento\Catalog\Controller\Adminhtml\Product;
77

8+
use Magento\Backend\App\Action\Context;
89
use Magento\Framework\Controller\ResultFactory;
10+
use Magento\Store\Model\StoreManagerInterface;
911

1012
/**
1113
* Backend reload of product create/edit form
1214
*/
1315
class Reload extends \Magento\Catalog\Controller\Adminhtml\Product
1416
{
17+
/**
18+
* @var StoreManagerInterface
19+
*/
20+
private $storeManager;
21+
22+
/**
23+
* @param Context $context
24+
* @param Builder $productBuilder
25+
* @param StoreManagerInterface|null $storeManager
26+
*/
27+
public function __construct(
28+
Context $context,
29+
Builder $productBuilder,
30+
StoreManagerInterface $storeManager = null
31+
) {
32+
parent::__construct($context, $productBuilder);
33+
34+
$this->storeManager = $storeManager ?: $this->_objectManager->get(
35+
StoreManagerInterface::class
36+
);
37+
}
38+
1539
/**
1640
* {@inheritdoc}
1741
*/
@@ -23,11 +47,15 @@ public function execute()
2347

2448
$product = $this->productBuilder->build($this->getRequest());
2549

50+
$store = $this->storeManager->getStore($product->getStoreId());
51+
$this->storeManager->setCurrentStore($store->getCode());
52+
2653
/** @var \Magento\Framework\View\Result\Layout $resultLayout */
2754
$resultLayout = $this->resultFactory->create(ResultFactory::TYPE_LAYOUT);
2855
$resultLayout->getLayout()->getUpdate()->addHandle(['catalog_product_' . $product->getTypeId()]);
2956
$resultLayout->getLayout()->getUpdate()->removeHandle('default');
3057
$resultLayout->setHeader('Content-Type', 'application/json', true);
58+
3159
return $resultLayout;
3260
}
3361
}

app/code/Magento/Catalog/Model/Indexer/Product/Flat/TableBuilder.php

Lines changed: 10 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
namespace Magento\Catalog\Model\Indexer\Product\Flat;
77

88
use Magento\Catalog\Model\Indexer\Product\Flat\Table\BuilderInterfaceFactory;
9+
use Magento\Framework\App\ObjectManager;
910

1011
/**
1112
* Class TableBuilder
@@ -47,14 +48,18 @@ class TableBuilder
4748
/**
4849
* @param \Magento\Catalog\Helper\Product\Flat\Indexer $productIndexerHelper
4950
* @param \Magento\Framework\App\ResourceConnection $resource
51+
* @param BuilderInterfaceFactory|null $tableBuilderFactory
5052
*/
5153
public function __construct(
5254
\Magento\Catalog\Helper\Product\Flat\Indexer $productIndexerHelper,
53-
\Magento\Framework\App\ResourceConnection $resource
55+
\Magento\Framework\App\ResourceConnection $resource,
56+
BuilderInterfaceFactory $tableBuilderFactory = null
5457
) {
5558
$this->_productIndexerHelper = $productIndexerHelper;
5659
$this->resource = $resource;
5760
$this->_connection = $resource->getConnection();
61+
$this->tableBuilderFactory = $tableBuilderFactory ?:
62+
ObjectManager::getInstance()->get(BuilderInterfaceFactory::class);
5863
}
5964

6065
/**
@@ -128,13 +133,13 @@ protected function _createTemporaryTable($tableName, array $columns, $valueField
128133
$valueTables = [];
129134
if (!empty($columns)) {
130135
$valueTableName = $tableName . $valueFieldSuffix;
131-
$temporaryTableBuilder = $this->getTableBuilderFactory()->create(
136+
$temporaryTableBuilder = $this->tableBuilderFactory->create(
132137
[
133138
'connection' => $this->_connection,
134139
'tableName' => $tableName
135140
]
136141
);
137-
$valueTemporaryTableBuilder = $this->getTableBuilderFactory()->create(
142+
$valueTemporaryTableBuilder = $this->tableBuilderFactory->create(
138143
[
139144
'connection' => $this->_connection,
140145
'tableName' => $valueTableName
@@ -349,27 +354,14 @@ protected function _fillTemporaryTable(
349354
}
350355
}
351356

352-
/**
353-
* @return BuilderInterfaceFactory
354-
*/
355-
private function getTableBuilderFactory()
356-
{
357-
if (null === $this->tableBuilderFactory) {
358-
$this->tableBuilderFactory = \Magento\Framework\App\ObjectManager::getInstance()
359-
->get(BuilderInterfaceFactory::class);
360-
}
361-
362-
return $this->tableBuilderFactory;
363-
}
364-
365357
/**
366358
* @return \Magento\Framework\EntityManager\MetadataPool
367359
*/
368360
private function getMetadataPool()
369361
{
370362
if (null === $this->metadataPool) {
371-
$this->metadataPool = \Magento\Framework\App\ObjectManager::getInstance()
372-
->get('Magento\Framework\EntityManager\MetadataPool');
363+
$this->metadataPool = ObjectManager::getInstance()
364+
->get(\Magento\Framework\EntityManager\MetadataPool::class);
373365
}
374366
return $this->metadataPool;
375367
}

0 commit comments

Comments
 (0)