Skip to content
This repository was archived by the owner on Apr 29, 2019. It is now read-only.

Commit 964d4ef

Browse files
authored
Merge pull request #13 from magento/2.2-develop
New code
2 parents 3259f5a + f66f469 commit 964d4ef

File tree

874 files changed

+13924
-3542
lines changed

Some content is hidden

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

874 files changed

+13924
-3542
lines changed

app/code/Magento/AdminNotification/Controller/Adminhtml/Notification/MarkAsRead.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,11 @@ public function execute()
2828
)->markAsRead(
2929
$notificationId
3030
);
31-
$this->messageManager->addSuccess(__('The message has been marked as Read.'));
31+
$this->messageManager->addSuccessMessage(__('The message has been marked as Read.'));
3232
} catch (\Magento\Framework\Exception\LocalizedException $e) {
33-
$this->messageManager->addError($e->getMessage());
33+
$this->messageManager->addErrorMessage($e->getMessage());
3434
} catch (\Exception $e) {
35-
$this->messageManager->addException(
35+
$this->messageManager->addExceptionMessage(
3636
$e,
3737
__("We couldn't mark the notification as Read because of an error.")
3838
);

app/code/Magento/AdminNotification/Controller/Adminhtml/Notification/MassMarkAsRead.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ public function execute()
2323
{
2424
$ids = $this->getRequest()->getParam('notification');
2525
if (!is_array($ids)) {
26-
$this->messageManager->addError(__('Please select messages.'));
26+
$this->messageManager->addErrorMessage(__('Please select messages.'));
2727
} else {
2828
try {
2929
foreach ($ids as $id) {
@@ -32,13 +32,13 @@ public function execute()
3232
$model->setIsRead(1)->save();
3333
}
3434
}
35-
$this->messageManager->addSuccess(
35+
$this->messageManager->addSuccessMessage(
3636
__('A total of %1 record(s) have been marked as Read.', count($ids))
3737
);
3838
} catch (\Magento\Framework\Exception\LocalizedException $e) {
39-
$this->messageManager->addError($e->getMessage());
39+
$this->messageManager->addErrorMessage($e->getMessage());
4040
} catch (\Exception $e) {
41-
$this->messageManager->addException(
41+
$this->messageManager->addExceptionMessage(
4242
$e,
4343
__("We couldn't mark the notification as Read because of an error.")
4444
);

app/code/Magento/AdminNotification/Controller/Adminhtml/Notification/MassRemove.php

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ public function execute()
2323
{
2424
$ids = $this->getRequest()->getParam('notification');
2525
if (!is_array($ids)) {
26-
$this->messageManager->addError(__('Please select messages.'));
26+
$this->messageManager->addErrorMessage(__('Please select messages.'));
2727
} else {
2828
try {
2929
foreach ($ids as $id) {
@@ -32,11 +32,12 @@ public function execute()
3232
$model->setIsRemove(1)->save();
3333
}
3434
}
35-
$this->messageManager->addSuccess(__('Total of %1 record(s) have been removed.', count($ids)));
35+
$this->messageManager->addSuccessMessage(__('Total of %1 record(s) have been removed.', count($ids)));
3636
} catch (\Magento\Framework\Exception\LocalizedException $e) {
37-
$this->messageManager->addError($e->getMessage());
37+
$this->messageManager->addErrorMessage($e->getMessage());
3838
} catch (\Exception $e) {
39-
$this->messageManager->addException($e, __("We couldn't remove the messages because of an error."));
39+
$this->messageManager
40+
->addExceptionMessage($e, __("We couldn't remove the messages because of an error."));
4041
}
4142
}
4243
$this->_redirect('adminhtml/*/');

app/code/Magento/AdminNotification/Controller/Adminhtml/Notification/Remove.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,12 @@ public function execute()
3131

3232
try {
3333
$model->setIsRemove(1)->save();
34-
$this->messageManager->addSuccess(__('The message has been removed.'));
34+
$this->messageManager->addSuccessMessage(__('The message has been removed.'));
3535
} catch (\Magento\Framework\Exception\LocalizedException $e) {
36-
$this->messageManager->addError($e->getMessage());
36+
$this->messageManager->addErrorMessage($e->getMessage());
3737
} catch (\Exception $e) {
38-
$this->messageManager->addException($e, __("We couldn't remove the messages because of an error."));
38+
$this->messageManager
39+
->addExceptionMessage($e, __("We couldn't remove the messages because of an error."));
3940
}
4041

4142
$this->_redirect('adminhtml/*/');

app/code/Magento/AdvancedPricingImportExport/Controller/Adminhtml/Export/GetFilter.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,10 @@ public function execute()
3737
);
3838
return $resultLayout;
3939
} catch (\Exception $e) {
40-
$this->messageManager->addError($e->getMessage());
40+
$this->messageManager->addErrorMessage($e->getMessage());
4141
}
4242
} else {
43-
$this->messageManager->addError(__('Please correct the data sent.'));
43+
$this->messageManager->addErrorMessage(__('Please correct the data sent.'));
4444
}
4545
/** @var \Magento\Backend\Model\View\Result\Redirect $resultRedirect */
4646
$resultRedirect = $this->resultFactory->create(ResultFactory::TYPE_REDIRECT);

app/code/Magento/Analytics/ReportXml/ReportProvider.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ public function __construct(
5757
private function getIteratorName(Query $query)
5858
{
5959
$config = $query->getConfig();
60-
return isset($config['iterator']) ? $config['iterator'] : null;
60+
return $config['iterator'] ?? null;
6161
}
6262

6363
/**

app/code/Magento/Authorizenet/Model/Directpost/Request.php

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -112,50 +112,50 @@ public function setDataFromOrder(
112112
sprintf('%.2F', $order->getBaseShippingAmount())
113113
);
114114

115-
//need to use strval() because NULL values IE6-8 decodes as "null" in JSON in JavaScript,
115+
//need to use (string) because NULL values IE6-8 decodes as "null" in JSON in JavaScript,
116116
//but we need "" for null values.
117117
$billing = $order->getBillingAddress();
118118
if (!empty($billing)) {
119-
$this->setXFirstName(strval($billing->getFirstname()))
120-
->setXLastName(strval($billing->getLastname()))
121-
->setXCompany(strval($billing->getCompany()))
122-
->setXAddress(strval($billing->getStreetLine(1)))
123-
->setXCity(strval($billing->getCity()))
124-
->setXState(strval($billing->getRegion()))
125-
->setXZip(strval($billing->getPostcode()))
126-
->setXCountry(strval($billing->getCountryId()))
127-
->setXPhone(strval($billing->getTelephone()))
128-
->setXFax(strval($billing->getFax()))
129-
->setXCustId(strval($billing->getCustomerId()))
130-
->setXCustomerIp(strval($order->getRemoteIp()))
131-
->setXCustomerTaxId(strval($billing->getTaxId()))
132-
->setXEmail(strval($order->getCustomerEmail()))
133-
->setXEmailCustomer(strval($paymentMethod->getConfigData('email_customer')))
134-
->setXMerchantEmail(strval($paymentMethod->getConfigData('merchant_email')));
119+
$this->setXFirstName((string)$billing->getFirstname())
120+
->setXLastName((string)$billing->getLastname())
121+
->setXCompany((string)$billing->getCompany())
122+
->setXAddress((string)$billing->getStreetLine(1))
123+
->setXCity((string)$billing->getCity())
124+
->setXState((string)$billing->getRegion())
125+
->setXZip((string)$billing->getPostcode())
126+
->setXCountry((string)$billing->getCountryId())
127+
->setXPhone((string)$billing->getTelephone())
128+
->setXFax((string)$billing->getFax())
129+
->setXCustId((string)$billing->getCustomerId())
130+
->setXCustomerIp((string)$order->getRemoteIp())
131+
->setXCustomerTaxId((string)$billing->getTaxId())
132+
->setXEmail((string)$order->getCustomerEmail())
133+
->setXEmailCustomer((string)$paymentMethod->getConfigData('email_customer'))
134+
->setXMerchantEmail((string)$paymentMethod->getConfigData('merchant_email'));
135135
}
136136

137137
$shipping = $order->getShippingAddress();
138138
if (!empty($shipping)) {
139139
$this->setXShipToFirstName(
140-
strval($shipping->getFirstname())
140+
(string)$shipping->getFirstname()
141141
)->setXShipToLastName(
142-
strval($shipping->getLastname())
142+
(string)$shipping->getLastname()
143143
)->setXShipToCompany(
144-
strval($shipping->getCompany())
144+
(string)$shipping->getCompany()
145145
)->setXShipToAddress(
146-
strval($shipping->getStreetLine(1))
146+
(string)$shipping->getStreetLine(1)
147147
)->setXShipToCity(
148-
strval($shipping->getCity())
148+
(string)$shipping->getCity()
149149
)->setXShipToState(
150-
strval($shipping->getRegion())
150+
(string)$shipping->getRegion()
151151
)->setXShipToZip(
152-
strval($shipping->getPostcode())
152+
(string)$shipping->getPostcode()
153153
)->setXShipToCountry(
154-
strval($shipping->getCountryId())
154+
(string)$shipping->getCountryId()
155155
);
156156
}
157157

158-
$this->setXPoNum(strval($payment->getPoNumber()));
158+
$this->setXPoNum((string)$payment->getPoNumber());
159159

160160
return $this;
161161
}

app/code/Magento/Authorizenet/view/frontend/requirejs-config.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@
66
var config = {
77
map: {
88
'*': {
9-
transparent: 'Magento_Payment/transparent'
9+
transparent: 'Magento_Payment/js/transparent',
10+
'Magento_Payment/transparent': 'Magento_Payment/js/transparent'
1011
}
1112
}
1213
};

app/code/Magento/Backend/App/Action/Plugin/Authentication.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ protected function _processNotLoggedInUser(\Magento\Framework\App\RequestInterfa
160160
} else {
161161
$this->_actionFlag->set('', \Magento\Framework\App\ActionInterface::FLAG_NO_DISPATCH, true);
162162
$this->_response->setRedirect($this->_url->getCurrentUrl());
163-
$this->messageManager->addError(__('Invalid Form Key. Please refresh the page.'));
163+
$this->messageManager->addErrorMessage(__('Invalid Form Key. Please refresh the page.'));
164164
$isRedirectNeeded = true;
165165
}
166166
}
@@ -205,7 +205,7 @@ protected function _performLogin(\Magento\Framework\App\RequestInterface $reques
205205
$this->_auth->login($username, $password);
206206
} catch (AuthenticationException $e) {
207207
if (!$request->getParam('messageSent')) {
208-
$this->messageManager->addError($e->getMessage());
208+
$this->messageManager->addErrorMessage($e->getMessage());
209209
$request->setParam('messageSent', true);
210210
$outputValue = false;
211211
}

app/code/Magento/Backend/App/DefaultPath.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,6 @@ public function __construct(\Magento\Backend\App\ConfigInterface $config)
4242
*/
4343
public function getPart($code)
4444
{
45-
return isset($this->_parts[$code]) ? $this->_parts[$code] : null;
45+
return $this->_parts[$code] ?? null;
4646
}
4747
}

app/code/Magento/Backend/Block/Dashboard/Bar.php

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -38,14 +38,6 @@ public function getTotals()
3838
*/
3939
public function addTotal($label, $value, $isQuantity = false)
4040
{
41-
/*if (!$isQuantity) {
42-
$value = $this->format($value);
43-
$decimals = substr($value, -2);
44-
$value = substr($value, 0, -2);
45-
} else {
46-
$value = ($value != '')?$value:0;
47-
$decimals = '';
48-
}*/
4941
if (!$isQuantity) {
5042
$value = $this->format($value);
5143
}

app/code/Magento/Backend/Block/Media/Uploader.php

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@
55
*/
66
namespace Magento\Backend\Block\Media;
77

8+
use Magento\Framework\App\ObjectManager;
9+
use Magento\Framework\Serialize\Serializer\Json;
10+
811
/**
912
* Adminhtml media library uploader
1013
* @api
@@ -27,17 +30,25 @@ class Uploader extends \Magento\Backend\Block\Widget
2730
*/
2831
protected $_fileSizeService;
2932

33+
/**
34+
* @var Json
35+
*/
36+
private $jsonEncoder;
37+
3038
/**
3139
* @param \Magento\Backend\Block\Template\Context $context
3240
* @param \Magento\Framework\File\Size $fileSize
3341
* @param array $data
42+
* @param Json $jsonEncoder
3443
*/
3544
public function __construct(
3645
\Magento\Backend\Block\Template\Context $context,
3746
\Magento\Framework\File\Size $fileSize,
38-
array $data = []
47+
array $data = [],
48+
Json $jsonEncoder = null
3949
) {
4050
$this->_fileSizeService = $fileSize;
51+
$this->jsonEncoder = $jsonEncoder ?: ObjectManager::getInstance()->get(Json::class);
4152
parent::__construct($context, $data);
4253
}
4354

@@ -107,7 +118,7 @@ public function getJsObjectName()
107118
*/
108119
public function getConfigJson()
109120
{
110-
return $this->_coreData->jsonEncode($this->getConfig()->getData());
121+
return $this->jsonEncoder->encode($this->getConfig()->getData());
111122
}
112123

113124
/**

app/code/Magento/Backend/Block/Widget/Grid/Column/Renderer/Currency.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ public function render(\Magento\Framework\DataObject $row)
8282
{
8383
if ($data = (string)$this->_getValue($row)) {
8484
$currency_code = $this->_getCurrencyCode($row);
85-
$data = floatval($data) * $this->_getRate($row);
85+
$data = (float)$data * $this->_getRate($row);
8686
$sign = (bool)(int)$this->getColumn()->getShowNumberSign() && $data > 0 ? '+' : '';
8787
$data = sprintf("%f", $data);
8888
$data = $this->_localeCurrency->getCurrency($currency_code)->toCurrency($data);
@@ -118,10 +118,10 @@ protected function _getCurrencyCode($row)
118118
protected function _getRate($row)
119119
{
120120
if ($rate = $this->getColumn()->getRate()) {
121-
return floatval($rate);
121+
return (float)$rate;
122122
}
123123
if ($rate = $row->getData($this->getColumn()->getRateField())) {
124-
return floatval($rate);
124+
return (float)$rate;
125125
}
126126
return $this->_defaultBaseCurrency->getRate($this->_getCurrencyCode($row));
127127
}

app/code/Magento/Backend/Block/Widget/Grid/Column/Renderer/Price.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ public function render(\Magento\Framework\DataObject $row)
6060
return $data;
6161
}
6262

63-
$data = floatval($data) * $this->_getRate($row);
63+
$data = (float)$data * $this->_getRate($row);
6464
$data = sprintf("%f", $data);
6565
$data = $this->_localeCurrency->getCurrency($currencyCode)->toCurrency($data);
6666
return $data;
@@ -94,10 +94,10 @@ protected function _getCurrencyCode($row)
9494
protected function _getRate($row)
9595
{
9696
if ($rate = $this->getColumn()->getRate()) {
97-
return floatval($rate);
97+
return (float)$rate;
9898
}
9999
if ($rate = $row->getData($this->getColumn()->getRateField())) {
100-
return floatval($rate);
100+
return (float)$rate;
101101
}
102102
return 1;
103103
}

app/code/Magento/Backend/Controller/Adminhtml/Auth/Logout.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ class Logout extends \Magento\Backend\Controller\Adminhtml\Auth
1616
public function execute()
1717
{
1818
$this->_auth->logout();
19-
$this->messageManager->addSuccess(__('You have logged out.'));
19+
$this->messageManager->addSuccessMessage(__('You have logged out.'));
2020

2121
/** @var \Magento\Backend\Model\View\Result\Redirect $resultRedirect */
2222
$resultRedirect = $this->resultRedirectFactory->create();

app/code/Magento/Backend/Controller/Adminhtml/Cache/CleanImages.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,11 @@ public function execute()
2828
try {
2929
$this->_objectManager->create(\Magento\Catalog\Model\Product\Image::class)->clearCache();
3030
$this->_eventManager->dispatch('clean_catalog_images_cache_after');
31-
$this->messageManager->addSuccess(__('The image cache was cleaned.'));
31+
$this->messageManager->addSuccessMessage(__('The image cache was cleaned.'));
3232
} catch (LocalizedException $e) {
33-
$this->messageManager->addError($e->getMessage());
33+
$this->messageManager->addErrorMessage($e->getMessage());
3434
} catch (\Exception $e) {
35-
$this->messageManager->addException($e, __('An error occurred while clearing the image cache.'));
35+
$this->messageManager->addExceptionMessage($e, __('An error occurred while clearing the image cache.'));
3636
}
3737

3838
/** @var \Magento\Backend\Model\View\Result\Redirect $resultRedirect */

app/code/Magento/Backend/Controller/Adminhtml/Cache/CleanMedia.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,12 @@ public function execute()
2828
try {
2929
$this->_objectManager->get(\Magento\Framework\View\Asset\MergeService::class)->cleanMergedJsCss();
3030
$this->_eventManager->dispatch('clean_media_cache_after');
31-
$this->messageManager->addSuccess(__('The JavaScript/CSS cache has been cleaned.'));
31+
$this->messageManager->addSuccessMessage(__('The JavaScript/CSS cache has been cleaned.'));
3232
} catch (LocalizedException $e) {
33-
$this->messageManager->addError($e->getMessage());
33+
$this->messageManager->addErrorMessage($e->getMessage());
3434
} catch (\Exception $e) {
35-
$this->messageManager->addException($e, __('An error occurred while clearing the JavaScript/CSS cache.'));
35+
$this->messageManager
36+
->addExceptionMessage($e, __('An error occurred while clearing the JavaScript/CSS cache.'));
3637
}
3738

3839
/** @var \Magento\Backend\Model\View\Result\Redirect $resultRedirect */

app/code/Magento/Backend/Controller/Adminhtml/Cache/CleanStaticFiles.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ public function execute()
2626
{
2727
$this->_objectManager->get(\Magento\Framework\App\State\CleanupFiles::class)->clearMaterializedViewFiles();
2828
$this->_eventManager->dispatch('clean_static_files_cache_after');
29-
$this->messageManager->addSuccess(__('The static files cache has been cleaned.'));
29+
$this->messageManager->addSuccessMessage(__('The static files cache has been cleaned.'));
3030

3131
/** @var \Magento\Backend\Model\View\Result\Redirect $resultRedirect */
3232
$resultRedirect = $this->resultFactory->create(ResultFactory::TYPE_REDIRECT);

app/code/Magento/Backend/Controller/Adminhtml/Cache/FlushAll.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ public function execute()
2727
foreach ($this->_cacheFrontendPool as $cacheFrontend) {
2828
$cacheFrontend->getBackend()->clean();
2929
}
30-
$this->messageManager->addSuccess(__("You flushed the cache storage."));
30+
$this->messageManager->addSuccessMessage(__("You flushed the cache storage."));
3131
/** @var \Magento\Backend\Model\View\Result\Redirect $resultRedirect */
3232
$resultRedirect = $this->resultRedirectFactory->create();
3333
return $resultRedirect->setPath('adminhtml/*');

app/code/Magento/Backend/Controller/Adminhtml/Cache/FlushSystem.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ public function execute()
2727
$cacheFrontend->clean();
2828
}
2929
$this->_eventManager->dispatch('adminhtml_cache_flush_system');
30-
$this->messageManager->addSuccess(__("The Magento cache storage has been flushed."));
30+
$this->messageManager->addSuccessMessage(__("The Magento cache storage has been flushed."));
3131
/** @var \Magento\Backend\Model\View\Result\Redirect $resultRedirect */
3232
$resultRedirect = $this->resultRedirectFactory->create();
3333
return $resultRedirect->setPath('adminhtml/*');

0 commit comments

Comments
 (0)