Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/2.2-develop' into #14020-Cart-…
Browse files Browse the repository at this point in the history
…Sales-Rule-with-negated-condition-over-special-price-does-not-work-for-configurable-products
  • Loading branch information
novikor committed Aug 9, 2018
2 parents 618f408 + adc6c00 commit e7130bf
Show file tree
Hide file tree
Showing 839 changed files with 13,222 additions and 3,425 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,11 @@ public function execute()
)->markAsRead(
$notificationId
);
$this->messageManager->addSuccess(__('The message has been marked as Read.'));
$this->messageManager->addSuccessMessage(__('The message has been marked as Read.'));
} catch (\Magento\Framework\Exception\LocalizedException $e) {
$this->messageManager->addError($e->getMessage());
$this->messageManager->addErrorMessage($e->getMessage());
} catch (\Exception $e) {
$this->messageManager->addException(
$this->messageManager->addExceptionMessage(
$e,
__("We couldn't mark the notification as Read because of an error.")
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public function execute()
{
$ids = $this->getRequest()->getParam('notification');
if (!is_array($ids)) {
$this->messageManager->addError(__('Please select messages.'));
$this->messageManager->addErrorMessage(__('Please select messages.'));
} else {
try {
foreach ($ids as $id) {
Expand All @@ -32,13 +32,13 @@ public function execute()
$model->setIsRead(1)->save();
}
}
$this->messageManager->addSuccess(
$this->messageManager->addSuccessMessage(
__('A total of %1 record(s) have been marked as Read.', count($ids))
);
} catch (\Magento\Framework\Exception\LocalizedException $e) {
$this->messageManager->addError($e->getMessage());
$this->messageManager->addErrorMessage($e->getMessage());
} catch (\Exception $e) {
$this->messageManager->addException(
$this->messageManager->addExceptionMessage(
$e,
__("We couldn't mark the notification as Read because of an error.")
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public function execute()
{
$ids = $this->getRequest()->getParam('notification');
if (!is_array($ids)) {
$this->messageManager->addError(__('Please select messages.'));
$this->messageManager->addErrorMessage(__('Please select messages.'));
} else {
try {
foreach ($ids as $id) {
Expand All @@ -32,11 +32,12 @@ public function execute()
$model->setIsRemove(1)->save();
}
}
$this->messageManager->addSuccess(__('Total of %1 record(s) have been removed.', count($ids)));
$this->messageManager->addSuccessMessage(__('Total of %1 record(s) have been removed.', count($ids)));
} catch (\Magento\Framework\Exception\LocalizedException $e) {
$this->messageManager->addError($e->getMessage());
$this->messageManager->addErrorMessage($e->getMessage());
} catch (\Exception $e) {
$this->messageManager->addException($e, __("We couldn't remove the messages because of an error."));
$this->messageManager
->addExceptionMessage($e, __("We couldn't remove the messages because of an error."));
}
}
$this->_redirect('adminhtml/*/');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,12 @@ public function execute()

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

$this->_redirect('adminhtml/*/');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,10 @@ public function execute()
);
return $resultLayout;
} catch (\Exception $e) {
$this->messageManager->addError($e->getMessage());
$this->messageManager->addErrorMessage($e->getMessage());
}
} else {
$this->messageManager->addError(__('Please correct the data sent.'));
$this->messageManager->addErrorMessage(__('Please correct the data sent.'));
}
/** @var \Magento\Backend\Model\View\Result\Redirect $resultRedirect */
$resultRedirect = $this->resultFactory->create(ResultFactory::TYPE_REDIRECT);
Expand Down
2 changes: 1 addition & 1 deletion app/code/Magento/Analytics/ReportXml/ReportProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public function __construct(
private function getIteratorName(Query $query)
{
$config = $query->getConfig();
return isset($config['iterator']) ? $config['iterator'] : null;
return $config['iterator'] ?? null;
}

/**
Expand Down
52 changes: 26 additions & 26 deletions app/code/Magento/Authorizenet/Model/Directpost/Request.php
Original file line number Diff line number Diff line change
Expand Up @@ -112,50 +112,50 @@ public function setDataFromOrder(
sprintf('%.2F', $order->getBaseShippingAmount())
);

//need to use strval() because NULL values IE6-8 decodes as "null" in JSON in JavaScript,
//need to use (string) because NULL values IE6-8 decodes as "null" in JSON in JavaScript,
//but we need "" for null values.
$billing = $order->getBillingAddress();
if (!empty($billing)) {
$this->setXFirstName(strval($billing->getFirstname()))
->setXLastName(strval($billing->getLastname()))
->setXCompany(strval($billing->getCompany()))
->setXAddress(strval($billing->getStreetLine(1)))
->setXCity(strval($billing->getCity()))
->setXState(strval($billing->getRegion()))
->setXZip(strval($billing->getPostcode()))
->setXCountry(strval($billing->getCountryId()))
->setXPhone(strval($billing->getTelephone()))
->setXFax(strval($billing->getFax()))
->setXCustId(strval($billing->getCustomerId()))
->setXCustomerIp(strval($order->getRemoteIp()))
->setXCustomerTaxId(strval($billing->getTaxId()))
->setXEmail(strval($order->getCustomerEmail()))
->setXEmailCustomer(strval($paymentMethod->getConfigData('email_customer')))
->setXMerchantEmail(strval($paymentMethod->getConfigData('merchant_email')));
$this->setXFirstName((string)$billing->getFirstname())
->setXLastName((string)$billing->getLastname())
->setXCompany((string)$billing->getCompany())
->setXAddress((string)$billing->getStreetLine(1))
->setXCity((string)$billing->getCity())
->setXState((string)$billing->getRegion())
->setXZip((string)$billing->getPostcode())
->setXCountry((string)$billing->getCountryId())
->setXPhone((string)$billing->getTelephone())
->setXFax((string)$billing->getFax())
->setXCustId((string)$billing->getCustomerId())
->setXCustomerIp((string)$order->getRemoteIp())
->setXCustomerTaxId((string)$billing->getTaxId())
->setXEmail((string)$order->getCustomerEmail())
->setXEmailCustomer((string)$paymentMethod->getConfigData('email_customer'))
->setXMerchantEmail((string)$paymentMethod->getConfigData('merchant_email'));
}

$shipping = $order->getShippingAddress();
if (!empty($shipping)) {
$this->setXShipToFirstName(
strval($shipping->getFirstname())
(string)$shipping->getFirstname()
)->setXShipToLastName(
strval($shipping->getLastname())
(string)$shipping->getLastname()
)->setXShipToCompany(
strval($shipping->getCompany())
(string)$shipping->getCompany()
)->setXShipToAddress(
strval($shipping->getStreetLine(1))
(string)$shipping->getStreetLine(1)
)->setXShipToCity(
strval($shipping->getCity())
(string)$shipping->getCity()
)->setXShipToState(
strval($shipping->getRegion())
(string)$shipping->getRegion()
)->setXShipToZip(
strval($shipping->getPostcode())
(string)$shipping->getPostcode()
)->setXShipToCountry(
strval($shipping->getCountryId())
(string)$shipping->getCountryId()
);
}

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

return $this;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
var config = {
map: {
'*': {
transparent: 'Magento_Payment/transparent'
transparent: 'Magento_Payment/js/transparent',
'Magento_Payment/transparent': 'Magento_Payment/js/transparent'
}
}
};
4 changes: 2 additions & 2 deletions app/code/Magento/Backend/App/Action/Plugin/Authentication.php
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ protected function _processNotLoggedInUser(\Magento\Framework\App\RequestInterfa
} else {
$this->_actionFlag->set('', \Magento\Framework\App\ActionInterface::FLAG_NO_DISPATCH, true);
$this->_response->setRedirect($this->_url->getCurrentUrl());
$this->messageManager->addError(__('Invalid Form Key. Please refresh the page.'));
$this->messageManager->addErrorMessage(__('Invalid Form Key. Please refresh the page.'));
$isRedirectNeeded = true;
}
}
Expand Down Expand Up @@ -205,7 +205,7 @@ protected function _performLogin(\Magento\Framework\App\RequestInterface $reques
$this->_auth->login($username, $password);
} catch (AuthenticationException $e) {
if (!$request->getParam('messageSent')) {
$this->messageManager->addError($e->getMessage());
$this->messageManager->addErrorMessage($e->getMessage());
$request->setParam('messageSent', true);
$outputValue = false;
}
Expand Down
2 changes: 1 addition & 1 deletion app/code/Magento/Backend/App/DefaultPath.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,6 @@ public function __construct(\Magento\Backend\App\ConfigInterface $config)
*/
public function getPart($code)
{
return isset($this->_parts[$code]) ? $this->_parts[$code] : null;
return $this->_parts[$code] ?? null;
}
}
8 changes: 0 additions & 8 deletions app/code/Magento/Backend/Block/Dashboard/Bar.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,14 +38,6 @@ public function getTotals()
*/
public function addTotal($label, $value, $isQuantity = false)
{
/*if (!$isQuantity) {
$value = $this->format($value);
$decimals = substr($value, -2);
$value = substr($value, 0, -2);
} else {
$value = ($value != '')?$value:0;
$decimals = '';
}*/
if (!$isQuantity) {
$value = $this->format($value);
}
Expand Down
15 changes: 13 additions & 2 deletions app/code/Magento/Backend/Block/Media/Uploader.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@
*/
namespace Magento\Backend\Block\Media;

use Magento\Framework\App\ObjectManager;
use Magento\Framework\Serialize\Serializer\Json;

/**
* Adminhtml media library uploader
* @api
Expand All @@ -27,17 +30,25 @@ class Uploader extends \Magento\Backend\Block\Widget
*/
protected $_fileSizeService;

/**
* @var Json
*/
private $jsonEncoder;

/**
* @param \Magento\Backend\Block\Template\Context $context
* @param \Magento\Framework\File\Size $fileSize
* @param array $data
* @param Json $jsonEncoder
*/
public function __construct(
\Magento\Backend\Block\Template\Context $context,
\Magento\Framework\File\Size $fileSize,
array $data = []
array $data = [],
Json $jsonEncoder = null
) {
$this->_fileSizeService = $fileSize;
$this->jsonEncoder = $jsonEncoder ?: ObjectManager::getInstance()->get(Json::class);
parent::__construct($context, $data);
}

Expand Down Expand Up @@ -107,7 +118,7 @@ public function getJsObjectName()
*/
public function getConfigJson()
{
return $this->_coreData->jsonEncode($this->getConfig()->getData());
return $this->jsonEncoder->encode($this->getConfig()->getData());
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ public function render(\Magento\Framework\DataObject $row)
{
if ($data = (string)$this->_getValue($row)) {
$currency_code = $this->_getCurrencyCode($row);
$data = floatval($data) * $this->_getRate($row);
$data = (float)$data * $this->_getRate($row);
$sign = (bool)(int)$this->getColumn()->getShowNumberSign() && $data > 0 ? '+' : '';
$data = sprintf("%f", $data);
$data = $this->_localeCurrency->getCurrency($currency_code)->toCurrency($data);
Expand Down Expand Up @@ -118,10 +118,10 @@ protected function _getCurrencyCode($row)
protected function _getRate($row)
{
if ($rate = $this->getColumn()->getRate()) {
return floatval($rate);
return (float)$rate;
}
if ($rate = $row->getData($this->getColumn()->getRateField())) {
return floatval($rate);
return (float)$rate;
}
return $this->_defaultBaseCurrency->getRate($this->_getCurrencyCode($row));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ public function render(\Magento\Framework\DataObject $row)
return $data;
}

$data = floatval($data) * $this->_getRate($row);
$data = (float)$data * $this->_getRate($row);
$data = sprintf("%f", $data);
$data = $this->_localeCurrency->getCurrency($currencyCode)->toCurrency($data);
return $data;
Expand Down Expand Up @@ -94,10 +94,10 @@ protected function _getCurrencyCode($row)
protected function _getRate($row)
{
if ($rate = $this->getColumn()->getRate()) {
return floatval($rate);
return (float)$rate;
}
if ($rate = $row->getData($this->getColumn()->getRateField())) {
return floatval($rate);
return (float)$rate;
}
return 1;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class Logout extends \Magento\Backend\Controller\Adminhtml\Auth
public function execute()
{
$this->_auth->logout();
$this->messageManager->addSuccess(__('You have logged out.'));
$this->messageManager->addSuccessMessage(__('You have logged out.'));

/** @var \Magento\Backend\Model\View\Result\Redirect $resultRedirect */
$resultRedirect = $this->resultRedirectFactory->create();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,11 @@ public function execute()
try {
$this->_objectManager->create(\Magento\Catalog\Model\Product\Image::class)->clearCache();
$this->_eventManager->dispatch('clean_catalog_images_cache_after');
$this->messageManager->addSuccess(__('The image cache was cleaned.'));
$this->messageManager->addSuccessMessage(__('The image cache was cleaned.'));
} catch (LocalizedException $e) {
$this->messageManager->addError($e->getMessage());
$this->messageManager->addErrorMessage($e->getMessage());
} catch (\Exception $e) {
$this->messageManager->addException($e, __('An error occurred while clearing the image cache.'));
$this->messageManager->addExceptionMessage($e, __('An error occurred while clearing the image cache.'));
}

/** @var \Magento\Backend\Model\View\Result\Redirect $resultRedirect */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,12 @@ public function execute()
try {
$this->_objectManager->get(\Magento\Framework\View\Asset\MergeService::class)->cleanMergedJsCss();
$this->_eventManager->dispatch('clean_media_cache_after');
$this->messageManager->addSuccess(__('The JavaScript/CSS cache has been cleaned.'));
$this->messageManager->addSuccessMessage(__('The JavaScript/CSS cache has been cleaned.'));
} catch (LocalizedException $e) {
$this->messageManager->addError($e->getMessage());
$this->messageManager->addErrorMessage($e->getMessage());
} catch (\Exception $e) {
$this->messageManager->addException($e, __('An error occurred while clearing the JavaScript/CSS cache.'));
$this->messageManager
->addExceptionMessage($e, __('An error occurred while clearing the JavaScript/CSS cache.'));
}

/** @var \Magento\Backend\Model\View\Result\Redirect $resultRedirect */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public function execute()
{
$this->_objectManager->get(\Magento\Framework\App\State\CleanupFiles::class)->clearMaterializedViewFiles();
$this->_eventManager->dispatch('clean_static_files_cache_after');
$this->messageManager->addSuccess(__('The static files cache has been cleaned.'));
$this->messageManager->addSuccessMessage(__('The static files cache has been cleaned.'));

/** @var \Magento\Backend\Model\View\Result\Redirect $resultRedirect */
$resultRedirect = $this->resultFactory->create(ResultFactory::TYPE_REDIRECT);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public function execute()
foreach ($this->_cacheFrontendPool as $cacheFrontend) {
$cacheFrontend->getBackend()->clean();
}
$this->messageManager->addSuccess(__("You flushed the cache storage."));
$this->messageManager->addSuccessMessage(__("You flushed the cache storage."));
/** @var \Magento\Backend\Model\View\Result\Redirect $resultRedirect */
$resultRedirect = $this->resultRedirectFactory->create();
return $resultRedirect->setPath('adminhtml/*');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public function execute()
$cacheFrontend->clean();
}
$this->_eventManager->dispatch('adminhtml_cache_flush_system');
$this->messageManager->addSuccess(__("The Magento cache storage has been flushed."));
$this->messageManager->addSuccessMessage(__("The Magento cache storage has been flushed."));
/** @var \Magento\Backend\Model\View\Result\Redirect $resultRedirect */
$resultRedirect = $this->resultRedirectFactory->create();
return $resultRedirect->setPath('adminhtml/*');
Expand Down
Loading

0 comments on commit e7130bf

Please sign in to comment.